• Stars
    star
    207
  • Rank 189,166 (Top 4 %)
  • Language
    PHP
  • License
    GNU Lesser Genera...
  • Created almost 6 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

πŸ”’ Laravel validation rules that follow the password related recommendations found in NIST Special Publication 800-63B section 5.

πŸ”’ Laravel NIST Password Rules

Build Status Coverage Status StyleCI Packagist

This package provides Laravel validation rules that follow the password related recommendations found in NIST Special Publication 800-63B section 5.

Laravel NIST Password Rules implements the following recommendations.

Recommendation Implementation
[...] at least 8 characters in length A standard validation rule in all rule sets to validate against this minimum length of 8 characters.
Passwords obtained from previous breach corpuses The BreachedPasswords rule securely checks the password against previous 3rd party data breaches, using the Have I Been Pwned - Pwned Passwords API.
Dictionary words The DictionaryWords rule checks the password against a list of over 102k dictionary words.
Context-specific words, such as the name of the service, the username The ContextSpecificWords rule checks the password does not contain the provided username, and any words defined the configured app name or app URL.
Context-specific words, [...] and derivatives thereof The DerivativesOfContextSpecificWords rule checks the password is not too similar to the provided username, and any words defined the configured app name or app URL.
Repetitive or sequential characters (e.g. β€˜aaaaaa’, β€˜1234abcd’) The RepetitiveCharacters and SequentialCharacters rules checks if the password consists of only repetitive or sequential characters.

It also provides methods to return validation rules arrays for various scenarios, such as register, login, and password changes. These arrays can be passed directly into the Laravel validator.

Installation

Laravel NIST Password Rules can be easily installed using Composer. Just run the following command from the root of your project.

composer require langleyfoxall/laravel-nist-password-rules

If you have never used the Composer dependency manager before, head to the Composer website for more information on how to get started.

Optionally, you may publish the package's translation files with the following Artisan command.

php artisan vendor:publish --provider="LangleyFoxall\LaravelNISTPasswordRules\ServiceProvider"

Usage

To use the Laravel NIST Password Rules in your project, first use the PasswordRules class, then call the appropriate static methods to return an array of appropriate validation rules. There are methods available for the following scenerios.

  • Register
  • Change password, with old password
  • Change password, without old password
  • Optionally change password, with old password
  • Optionally change password, without old password
  • Login

See the code below for example usage syntax.

use LangleyFoxall\LaravelNISTPasswordRules\PasswordRules;

// Register
$this->validate($request, [
    'email' => 'required',
    'password' => PasswordRules::register($request->email),
]);

// Register, without requiring password confirmation
$this->validate($request, [
    'email' => 'required',
    'password' => PasswordRules::register($request->email, false),
]);

// Change password, with old password
$this->validate($request, [
    'old_password' => 'required',
    'password' => PasswordRules::changePassword($request->email, 'old_password'),
]);

// Change password, without old password
$this->validate($request, [
    'password' => PasswordRules::changePassword($request->email),
]);

// Optionally change password, with old password
$this->validate($request, [
    'old_password' => 'required',
    'password' => PasswordRules::optionallyChangePassword($request->email, 'old_password'),
]);

// Optionally change password, without old password
$this->validate($request, [
    'password' => PasswordRules::optionallyChangePassword($request->email),
]);

// Login
$this->validate($request, [
    'email' => 'required',
    'password' => PasswordRules::login(),
]);

The optionallyChangePassword method supplies validation rules that are appropriate for forms in which the password can be optionally changed if filled in.

More Repositories

1

xero-laravel

πŸ’Έ Access the Xero accounting system using an Eloquent-like syntax
PHP
84
star
2

math_eval

βœ–οΈβž•βž–βž— `math_eval` safely evaluates mathematical expressions
PHP
42
star
3

react-dynamic-form-builder

A package that allows the building of forms in React.
JavaScript
21
star
4

react-dynamic-data-table

Re-usable data table for React with sortable columns, pagination and more.
JavaScript
12
star
5

technologies

Technical overview of Langley Foxall, related technologies, frameworks, style guides and more.
HTML
9
star
6

eloquent-csv-importer

A Laravel package that allows you to map and import data from CSV files to Laravel Models
PHP
8
star
7

laravel-redacted-model

Laravel Redacted Model makes it easier to hide or modify fields on a model based on given conditions in order to reduce data leakage in Laravel applications.
PHP
8
star
8

react-dynamic-data-table-laravel-api

Laravel API endpoint responder for the React Dynamic Data Table component.
PHP
8
star
9

modules-laravel

Package for building modular laravel applications
PHP
7
star
10

eloquent-report-generator

Generates reports from Eloquent models in many formats, such as CSV, PDF, Markdown, and HTML.
PHP
5
star
11

helpers-laravel

A repository of laravel specific helper classes to help standardise work. API helpers, converters etc.
PHP
4
star
12

laravel-validation-rules

A set of commonly used validation rules, such as UK Postcodes, Phone numbers and more.
PHP
3
star
13

php-rsa-signer

πŸ”’ Simplifies the process of signing API payloads with a specific private key
PHP
3
star
14

react-native-expo-sql-migrations

JavaScript
2
star
15

laravel-boilerplate

Boilerplate for Laravel with common tools/plugins for ease of development.
PHP
2
star
16

pdf-stitcher

Allows you to easily stitch together multiple PDFs into a single file
PHP
2
star
17

php-simple-google-maps

This package provides a simple PHP client for various Google Maps APIs.
PHP
2
star
18

press-association-tv-api-wrapper

πŸ“ΊβŒšοΈ Provides access to information regarding TV channels, schedules and schedule items
PHP
2
star
19

react-dynamic-context-menu

A simple context menu to provide actions via right click on any component.
JavaScript
1
star
20

react-click-outside

πŸ–±οΈA simple React Component for handling clicking outside of elements
JavaScript
1
star