-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: clean up * chore: move devise inside rails instead of 3rd party * refactor: move logic inside loadRules
- Loading branch information
1 parent
52483c8
commit 5c0b2b8
Showing
19 changed files
with
109 additions
and
486 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
pkg/commands/process/settings/rules/ruby/rails/devise_password_length.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
type: "risk" | ||
languages: | ||
- ruby | ||
patterns: | ||
- pattern: | | ||
class $<_> | ||
$<!>devise password_length: $<MIN_LENGTH>..$<MAX_LENGTH> | ||
end | ||
filters: | ||
- either: | ||
- variable: MAX_LENGTH | ||
less_than: 35 | ||
- variable: MIN_LENGTH | ||
less_than: 8 | ||
- pattern: | | ||
Devise.setup do |$<CONFIG:identifier>| | ||
$<CONFIG>.password_length = $<MIN_LENGTH>..$<MAX_LENGTH> | ||
end | ||
filters: | ||
- variable: MIN_LENGTH | ||
less_than: 8 | ||
- pattern: | | ||
Devise.setup do |$<CONFIG:identifier>| | ||
$<CONFIG>.password_length = $<LENGTH> | ||
end | ||
filters: | ||
- variable: LENGTH | ||
less_than: 8 | ||
match_violation: true | ||
detect_presence: true | ||
trigger: "global" | ||
severity: | ||
default: "high" | ||
metadata: | ||
description: "Enforce stronger password requirements." | ||
remediation_message: | | ||
## Description | ||
Minimum password length should be enforced any time password creation occurs. This rule checks if configurations and validations made for passwords include a minimum length of 8. | ||
## Remediations | ||
✅ OWASP recommends a password length of at least 8 characters, which is easy to enforce at the model level in Rails using validation constraint: | ||
```ruby | ||
validates :password, presence: true, length: { minimum: 8, maximum: 255 } | ||
``` | ||
<!-- | ||
## Resources | ||
Coming soon. | ||
--> | ||
dsr_id: "DSR-8" | ||
id: "ruby_rails_devise_password_length" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.