Word-boundary and anchored regexes fall back to NFA execution in RE2JS 1.3.3. Upgrade to 2.8.8, which supports assertions in its DFA, and replace the private matcher-input mutation with the public reset API. This complements the Boolean-search optimization in #652.
Preserve RE2 syntax at the shared translation boundary. Translating entire patterns with the new JavaScript-oriented translator silently turns unsupported escapes, including numeric backreferences 8/9, into literals. Translate only supported Unicode/control escape tokens, preserving escaped backslashes and quoted RE2 regions. Invalid escapes still reach RE2's compiler and fail normally.
Validation: 2,270 focused regex/search/rg/grep/sed/awk/expr/find tests passed, 93 existing skips; typecheck and scoped Biome checks passed. In the combined application fork with #652, the generated 106 MB assertion-search fixture fell from 19.174s to 0.885s, with identical no-match output. This is a component benchmark, not an application latency claim. That combined build also passed 74 public-command comparisons and 17 distribution tests.
No WASM dependency or arbitrary native-regex fallback is added. The upstream engine's memory policy changes; its DFA cache is bounded, while process-level resource isolation remains the caller's responsibility.
Activity
5Review the following changes in direct dependencies. Learn more about Socket for GitHub.
| Diff | Package | Supply Chain Security | Vulnerability | Quality | Maintenance | License |
|---|---|---|---|---|---|---|
| npm/re2js@1.3.3 ⏵ 2.8.8 | -2 | +5 |
🤖 auto-maintain review
Automated, advisory triage for @asafyish's PR. Facts below are read from the GitHub API.
| Check | Result |
|---|---|
| Author's merged PRs (this repo) | 1 |
| Account established | ✅ (age 5392d · 13 followers · 7 public repos) |
| Commits signed/verified | ⚠️ 0/1 |
| Changeset included | ✅ (.changeset/assertion-regex-search.md) |
Review panel: 🟡 medium highest severity
just-bash maintainer code review: 🟢 low
No actionable defects found in the complete base-to-head diff.
General code review: 🟢 low
No actionable correctness or maintainability issues found in the complete diff.
Adversarial security: 🟢 low
No actionable adversarial security issues found in the complete diff.
Adversarial security (second opinion): 🟡 medium
No backdoor, exfiltration, install-script, or CI tampering found; the diff is confined to a re2js bump, a public matcher reset, and a narrowed escape translator, but the hand-rolled `\Q…\E` scan diverges from RE2's own quoting rules and can silently change what a pattern matches.
- packages/just-bash/src/regex/user-regex.ts:79 — The new `\Q…\E` scan in `translatePattern` does not mirror RE2's quoted-region rules: RE2 consumes `\` inside a `\Q` region as one literal backslash, while `[\s\S]*?(?:\E|$)` stops at the first two-char `\E` it sees. For a pattern like `\Qfoo\E\u0041`, the tokenizer treats the region as ended and rewrites `\u0041` to `\x{41}`, but RE2 is still inside the quoted region at that point, so the compiled pattern silently matches the literal text `foo\E\x{41}` instead of `foo\E\u0041`. Escapes should not be rewritten in spans RE2 still treats as quoted.
Standard Bash and host portability: 🟡 medium
The shared translation change introduces a concrete compatibility regression for escaped ordinary characters.
- packages/just-bash/src/regex/user-regex.ts:79 — Preserving every unsupported escape globally breaks Bash/host regex compatibility. GNU Bash `[[ Z =~ \Z ]]`, GNU grep, and gawk treat `\Z` as literal `Z`, but this change makes shared `UserRegex("\Z")` throw, so previously valid scripts now fail. Normalize dialect-specific ordinary escapes before RE2 compilation.
Posted by auto-maintain. This automated code review is advisory; a human maintainer makes the call.
Verified both reported examples against RE2JS itself and the current wrapper; neither is a regression introduced here.
- Quoting: RE2JS 2.8.8's parser finds the terminator with
lit.indexOf("\E"); it does not consume escaped-backslash pairs inside the quoted region as the review claims. For the supplied pattern\Qfoo\E\u0041, the wrapper matchesfoo\A, and does not match either literalfoo\E\u0041orfoo\E\x{41}. This is consistent with RE2's quoted span ending at the first\E. \Z: RE2JS 1.3.3's existing translateRegExp preserves\Z, and compiling it already throwsinvalid escape sequence. The changed translator preserves that behavior. A GNU dialect compatibility change could be considered separately, but this upgrade does not turn a previously supported\Zinto an error.
The targeted example check and the existing translation suite pass. No production change is needed for these two findings.
This pull request is a draft
Merging is unavailable until it is marked ready for review.
@asafyish is attempting to deploy a commit to the Vercel Labs Team on Vercel.
A member of the Team first needs to authorize it.