Repository navigation
Dynamic regex audit - #3131
Merged
Merged
Dynamic regex audit#3131
Conversation
Ruby 3.4.12 fixed Onigmo memory-safety bugs that are reachable only by compiling a regex from attacker-controlled text; matching untrusted text against our own patterns is fine. We audited our code and found no regex compiled from untrusted input. This test keeps it that way. It parses our production and CI/CD Ruby (app/, lib/ including rake tasks, config/, Rakefile, and Ruby scripts in script/ and bin/) with Prism and finds every Regexp.new/compile/union, interpolated regex literal, and String#match/match? whose pattern isn't obviously trusted. Literals, constants, and values computed only from them (including ENV, ARGV, and STDIN, which we control) are trusted. Any other site must be listed in ALLOWLIST, keyed by its untrusted inputs (e.g., "match: name_pattern") rather than line numbers, so unrelated edits don't break it but changing an input forces a re-review. Stale entries also fail. The 21 current entries are all reviewed as safe: their inputs come from regex literals, repository content, or translation terms passed through Regexp.escape. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
The check "[ $# = '' ]" compared the argument count to an empty
string, so it was never true: an empty branch name passed validation
("Branch name validated") and exited 0. Test the name itself with
"[ -z "$BRANCH_NAME" ]" instead.
No test covered this script, so add one that runs it on valid and
invalid names (empty, leading "-", leading "/").
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3131 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 90 90
Lines 4818 4818
=========================================
Hits 4818 4818 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
No description provided.