fix(review): bound manifest path instruction globs#1396
Open
JSONbored wants to merge 1 commit into
Open
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
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.
Motivation
review.path_instructions[].pathfield was accepted without per-item length/character limits and was repeatedly compiled into regexes and emitted verbatim into the AI prompt, enabling CPU/memory/AI-budget exhaustion from malicious manifests.Description
MAX_REVIEW_PATH_GUIDANCE_LENGTHandCONTROL_CHARACTER_PATTERNand validatereview.path_instructions[].pathto reject control characters and truncate toMAX_ITEM_LENGTHduring parsing inparseReviewPathInstructionsinsrc/signals/focus-manifest.ts.resolveReviewPathInstructionsto normalize changed paths once, compile each manifest glob once viacompileManifestPathMatcher, and evaluate those matchers against normalized paths rather than recompiling per path.test/unit/focus-manifest.test.tsto cover control-character rejection, overlong-path truncation, prompt guidance bounding, and blank-normalized-path behavior.Testing
npx vitest run test/unit/focus-manifest.test.tsand all tests in that file passed (113 tests) covering the new branches and regressions.npm run typecheckandtsc --noEmitwhich succeeded with no type errors.npx vitest --coveragefor the unit file andnpm run test:coveragefor the full suite executed tests, but coverage generation failed due to an unrelated coverage provider/runtime error (TypeError: jsTokens is not a function) coming from the coverage toolchain; this prevented producing a full coverage report locally.npm audit --audit-level=moderatecould not complete due to the registry returning403 Forbiddenin this environment.Codex Task