Repository navigation
fix(bridge): bound regex search work - #105
Merged
Merged
Conversation
darsrc
pushed a commit
to darsrc/rea
that referenced
this pull request
Oct 10, 2026
…search fix(bridge): bound regex search work
DrAbdulmalek
pushed a commit
to DrAbdulmalek/rea
that referenced
this pull request
Oct 26, 2026
Rebase of useful morluto#105 content onto main after morluto#104. Keep uv/ZIP security in UV-AND-DOWNLOAD-SECURITY.md; do not close morluto#51.
mvanhorn
added a commit
to mvanhorn/rea
that referenced
this pull request
Nov 1, 2026
The cyclonedx analysis view projects one retained Go build-information parent or one Rust dependency parent into one deterministic CycloneDX 1.6 JSON document from that parent alone. Go modules become pkg:golang Package URLs; a local replacement has no Package URL and records the replaced module as rea:go:original, and an h1 sum is the property rea:go:sum. Rust crates.io packages become pkg:cargo Package URLs, other sources have no Package URL, and a build-kind package has scope excluded. Compositions are incomplete or unknown, the document has no timestamp, a document larger than 1,048,576 bytes is refused by naming export_evidence_bundle, and the tool text, docs, service tests, and verify:cyclonedx:view cover the projection. Fixes morluto#105
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
Harden Hopper-backed procedure and string regex searches against bounded-but-catastrophic Python regular expressions.
invalid_requestresponse;search_proceduresandsearch_stringstool descriptions;This is an independent regex-boundedness contribution toward #29. It does not claim to close the broader issue.
Root cause
The existing validator rejected lookarounds, backreferences, nested repetitions, and unbounded repetitions, but it treated every permitted bounded repetition as safe. Patterns such as:
were therefore accepted even though Python's backtracking engine can explore an exponential number of paths. Candidate length and inventory size could multiply that cost while the bridge handled the request synchronously.
Very large repetition counts could also make
sre_parseraiseOverflowError; that escaped the validation boundary asbridge_exceptioninstead of a stable caller error.Implementation
The bridge now derives two conservative values from the parsed regex AST:
The matcher combines those values with each candidate length and consumes a per-search work budget before calling
re.search. This bounds both a single expensive candidate and cost accumulated while scanning an inventory. Unsupported AST operations fail closed.Boundary behavior is intentional:
Regex safety failures are projected as
invalid_requestwith stable messages. Literal mode does not use Python regex and continues matching the complete value even when returned text must be truncated.Test coverage
A new executable probe loads the real
bridge/hopper_bridge.pywithout opening a Hopper socket. The focused suite covers:invalid_requestdiagnostic projection.Package verification now extracts the generated npm tarball and executes the same catastrophic-pattern probe against the packed production bridge. This prevents the fake launcher used by other package smoke tests from masking a missing bridge hardening change.
Verification
npm run check- 58 test files and 375 tests passed; typecheck, oxlint, Prettier, build, and coverage run passednpm run knip- passednpm run jscpd- passed; no new duplicate block introducednpm run scan:todos- passednpm run verify:package- passed with 68 MCP tools andboundedRegexBridge: truelint-staged, Prettier, oxlint, and typecheck - passedReal Hopper verification was not run because this environment does not provide a Hopper executable and two target binaries. The tests execute the production bridge source and packed bridge directly, but they do not replace the repository's real-Hopper workflow.