Align alphaNumericRegex() with the documented grouped SHA pattern#21838
Draft
Copilot wants to merge 4 commits into
Draft
Align alphaNumericRegex() with the documented grouped SHA pattern#21838Copilot wants to merge 4 commits into
alphaNumericRegex() with the documented grouped SHA pattern#21838Copilot wants to merge 4 commits into
Conversation
Copilot created this pull request from a session on behalf of
owen-mc
May 12, 2026 13:03
View session
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug Fix
The
alphaNumericRegex()helper inactions/ql/lib/codeql/actions/Bash.qllno longer matched the regex shape documented in the QLDoc after the pinned-SHA example was widened to support either 40 or 64 hex characters. This caused the implementation and documentation to diverge for grouped and optional quantified forms.What was the bug?
alphaNumericRegex()only matched a single character class followed by one quantifier:^[0-9]+$^[A-Za-z0-9_]{40}$^[0-9a-zA-Z]{40}([0-9a-zA-Z]{24})?$How did you fix it?
Expanded accepted regex structure
alphaNumericRegex()to build up the accepted pattern in stages:+or{n})?^and$Kept the helper aligned with the QLDoc example
([0-9a-zA-Z]{24})?, which is the shape used by the updated pinned-SHA example.Minor cleanup
Example
alphaNumericRegex()now matches patterns of this form: