Skip to content

Commit

Permalink
fix: clarify permissive regexp rules (#371)
Browse files Browse the repository at this point in the history
  • Loading branch information
elsapet authored Apr 12, 2024
1 parent c366d47 commit 9081651
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion rules/go/lang/permissive_regex_validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ metadata:
Validations using regular expressions should use the start of text (\A) and
end of text (\z or \Z) boundaries.
Note, it is best security practice to prefer the boundary expressions \A and \z or \Z
over ^ and $, because ^ and $ operate as line-based boundaries when multiline mode is enabled.
## Remediations
❌ Avoid matching without start and end boundaries:
Expand All @@ -40,7 +43,7 @@ metadata:
❌ Avoid using line-based boundaries:
```go
regexp.MustCompile("^foo$"}
regexp.MustCompile("^foo$")
```
✅ Use whole-text boundaries:
Expand Down
3 changes: 3 additions & 0 deletions rules/php/symfony/permissive_regex_validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ metadata:
Validations using regular expressions should use the start of text (\A) and
end of text (\z or \Z) boundaries.
Note, it is best security practice to prefer the boundary expressions \A and \z or \Z
over ^ and $, because ^ and $ operate as line-based boundaries when multiline mode is enabled.
## Remediations
❌ Avoid matching without start and end boundaries:
Expand Down

0 comments on commit 9081651

Please sign in to comment.