fix(review): sanitize REES enrichment prompts#1554
Open
JSONbored wants to merge 1 commit into
Open
Conversation
❌ 1 Tests Failed:
View the top 1 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
|
Caution 🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥 🛑 Gittensory review — blocked
🛑 Blocked CI checks failing
Nits — 2 non-blocking
Review context
Contributor next steps
Signal definitions
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
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
promptSectionandsystemSuffixtext to reach the model and bypass existing prompt-injection/public-safety controls.Description
promptSectionwithneutralizePromptInjectionandsanitizePublicComment, and cap the returned prompt section toMAX_ENRICHMENT_PROMPT_SECTION_CHARS(8000 chars) before splicing. (src/review/enrichment-wire.ts)systemSuffixwith a fixed local verification suffixENRICHMENT_SYSTEM_SUFFIXso the external service cannot inject system-level instructions. (src/review/enrichment-wire.ts)sanitizeEnrichmentPromptSectionhelper that enforces type, trimming, prompt-injection neutralization, public-safety filtering, and length capping. (src/review/enrichment-wire.ts)test/unit/enrichment-wire.test.ts,test/unit/ai-review.test.ts)Testing
tsc --noEmit(typecheck) and it passed.npx vitest run test/unit/enrichment-wire.test.ts test/unit/ai-review.test.tsand both files passed (all related tests green).git diff --checkand it reported no whitespace/conflict issues.npm run test:ciandnpm audit --audit-level=moderate;test:ciexecution hit unrelated transient network/DNS failures duringactionlintsetup and some long-running existing suite shards timed out in this environment, andnpm auditreturned403 Forbiddenfrom the registry audit endpoint, so the full gate/audit could not be completed here.Codex Task