fix(review): sanitize REES enrichment prompts - #1554
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1554 +/- ##
=======================================
Coverage 95.36% 95.37%
=======================================
Files 197 197
Lines 21464 21472 +8
Branches 7759 7761 +2
=======================================
+ Hits 20470 20478 +8
Misses 416 416
Partials 578 578
🚀 New features to boost your workflow:
|
|
Caution 🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥 🛑 Gittensory review — blocked
🛑 Blocked Review summary Nits (4)
CI checks failing
Nits — 2 non-blocking
Review context
Contributor next steps
Signal definitions
Review detailsGenerated from public PR metadata and the diff. Advisory only; deterministic signals remain authoritative. The change correctly closes a prompt-injection path where REES-returned `promptSection` and `systemSuffix` were spliced verbatim into reviewer prompts. `sanitizeEnrichmentPromptSection` chains `neutralizePromptInjection` → `sanitizePublicComment` → length-cap before use, and the REES `systemSuffix` is fully replaced with the fixed `ENRICHMENT_SYSTEM_SUFFIX` constant rather than being forwarded from the external service. Tests are updated to assert sanitization, length enforcement, public-safety rejection, and that the fixed suffix — not the raw REES string — appears in output; imports of both sanitization utilities are confirmed present in the full file. Nits (4)
🟩 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.
|
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
…SONbored#1138) THE dominant contributor-flood failure (robustness audit). Two disposition bugs killed/stranded good PRs: 1. FORK FALSE-CLOSE: ciState='unverified' (a fork whose Actions await maintainer approval, or unreadable check-runs) made reviewGood=false, so a CONTRIBUTOR with a passing gate was one-shot CLOSED citing 'CI could not be verified' — and re-closed every push. FIX: willClose now fires ONLY on a REAL adverse signal — a confirmed gate FAILURE, a red required CI (ciFailed), or a base CONFLICT. Unverified / not-yet-mergeable is HELD for review, never killed. (Owner/automation still never close; guarded paths still held.) 2. NEUTRAL SILENT-STUCK: a non-confirmed contributor PR with any advisory blocker gets conclusion='neutral', and the planner returned [] immediately — no label, no disposition — so the PR looked 'unreviewed forever' (the metagraphed JSONbored#1551/JSONbored#1554 class). FIX: only SKIPPED short-circuits; a NEUTRAL gate now FLOWS to the disposition so the PR is surfaced with a label + held (never silently undecided). Neutral is NOT auto-merged (that trust/policy decision is deferred, not bundled here). Full suite green (3589). Updated agent-actions + queue tests that asserted the old (harmful) close/silent behavior.
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