Repository navigation
fix: fail closed on invalid regex predicates (#79) - #81
Merged
Merged
Conversation
Reject unsupported/invalid regex/iregex patterns at config load instead of silently matching nothing. Add not_like/not_ilike/not_regex/not_iregex so "match unless" policies do not need lookaround. Document the Rust regex crate limits and compile patterns in lint-policy. Co-authored-by: andy <andy@wearecrew.com>
Align #79 docs with the keep strategy cookbook now on main: prefer keep for small allowlists, and point at not_ilike/not_iregex as the fail-closed alternative to lookaround. Co-authored-by: andy <andy@wearecrew.com>
cursor
Bot
force-pushed
the
cursor/regex-fail-closed-predicates-1aeb
branch
from
August 14, 2026 15:54
7ea1936 to
02d7a88
Compare
ababic
marked this pull request as ready for review
August 14, 2026 15:55
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.
Summary
Fixes #79:
regex/iregexpredicates previously failed open — invalid or unsupported patterns (including lookaround) compiled to a never-match regex ($^), so configs appeared to work while matching nothing.Rebased onto latest
main(includeskeepstrategy from #77/#78 and docs from #82). Conflict insrc/sql.rsresolved by keeping both thekeeppipeline test and the newnot_ilikescrub-unless-staff test.Changes
regex/iregex/not_regex/not_iregexpattern during validation; reject unknown predicate ops.$^fallback in the runtime regex cache (panic if an unvalidated pattern somehow slips through).not_like,not_ilike,not_regex,not_iregexso “match unless …” policies don’t need lookaround.lint-policy: compile-check the same patterns (invalid-regex-predicate); invalid configs also fail before lint because load validation rejects them.regexcrate (not PCRE), lookaround limits, and points atkeep/not_ilikealternatives.Tests
not_ilike/not_iregexscrub-unless-staff behavior (issue repro dump).keepstaff-email pipeline test retained after rebase.invalid-regex-predicate.CI
cargo fmt --check,cargo clippy --all-targets --all-features -D warnings, andcargo test --all-targets --all-features(161 passed) all pass locally after rebase.