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

Fix anchoring in ID validation regex. #3956

Merged
merged 2 commits into from Mar 26, 2024
Merged

Fix anchoring in ID validation regex. #3956

merged 2 commits into from Mar 26, 2024

Conversation

sengi
Copy link
Contributor

@sengi sengi commented Mar 26, 2024

Ruby regexes are — bizarrely — multiline by default, so ComponentWrapperHelper::check_id_is_valid would have erroneously accepted an ID string that contained newlines.

Fixes https://github.com/alphagov/govuk_publishing_components/security/code-scanning/8.

No visual changes. Should also be no functional change for normal usage.

`ComponentWrapperHelper::check_id_is_valid` would erroneously accept an
ID string that contained newlines.

Fixes
https://github.com/alphagov/govuk_publishing_components/security/code-scanning/8.
@sengi sengi requested a review from andysellick March 26, 2024 11:44
@govuk-ci govuk-ci temporarily deployed to components-gem-pr-3956 March 26, 2024 11:44 Inactive
- Add a test case for invalid element IDs containing newlines.
- Clean up the existing tests to remove some duplicated test cases
  (single responsibility principle for tests) and avoid change detecting
  on error message strings.
@govuk-ci govuk-ci temporarily deployed to components-gem-pr-3956 March 26, 2024 12:48 Inactive
Copy link
Contributor

@andysellick andysellick left a comment

Choose a reason for hiding this comment

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

👏

@sengi sengi merged commit facb84c into main Mar 26, 2024
13 checks passed
@sengi sengi deleted the sengi/cwe-20 branch March 26, 2024 15:51
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.

None yet

3 participants