Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

148 format validation vulnerability #179

Merged
merged 2 commits into from
Sep 8, 2023
Merged

Conversation

Janell-Huyck
Copy link
Contributor

Fixes #148

Fixes regular expression validation of phone number.

Our previous regular expression validation of the phone number has a security vulnerability. A phone number like "123-456-7890 malicious_code_here" would have been marked as valid. This fix removes that vulnerability. By adding in anchors to the regex check: (/\A\d{3}-\d{3}-\d{4}\z/), we ensure that the string is exactly a phone number in the format 111-111-1111 and nothing else.

Rspec: also included a happy path and more edge case checks for phone number validation.

@Janell-Huyck Janell-Huyck force-pushed the 148-format-validation-vulnerability branch from d179add to 6b385b6 Compare September 8, 2023 13:59
@crowesn crowesn self-assigned this Sep 8, 2023
Copy link
Contributor

@crowesn crowesn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Merging.

@crowesn crowesn merged commit c0f12b1 into qa Sep 8, 2023
@crowesn crowesn deleted the 148-format-validation-vulnerability branch September 8, 2023 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Brakeman: Format Validation vulnerability
2 participants