fix(gate): unconditional secret-leak block; don't let inconclusive AI bury blockers - #1237
Merged
Conversation
… bury blockers Two AI-safety gaps in the gate: - The concrete-credential secret-leak scan only ran when GITTENSORY_REVIEW_SAFETY was ON and the repo was allowlisted, so a registered-but-not-allowlisted repo got zero secret-leak gate while the engine still auto-merged/closed. A real-format committed credential (github_token, aws_access_key, …) is a leak on any repo, so the scan now runs unconditionally. secretLeakFinding already filters to HARD_SECRET_KINDS, so it never mis-fires on config/workflow content; the prompt-injection defang and AI review stay flag-gated. - evaluateGateCheck returned a neutral "held for human" and dropped every configured deterministic blocker the moment an AI review was inconclusive, so a contributor who forced a non-JSON / budget-exhausted AI result could bury a PR's real violations (secret_leak, duplicate, missing-issue, slop, quality) in a hold. The inconclusive hold is now evaluated AFTER deterministic blockers and only when none fired — a real violation still blocks; a clean PR with an inconclusive AI is still held (never auto-closed on a model hiccup).
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1237 +/- ##
==========================================
- Coverage 94.96% 94.96% -0.01%
==========================================
Files 177 177
Lines 19779 19776 -3
Branches 7115 7112 -3
==========================================
- Hits 18783 18780 -3
Misses 397 397
Partials 599 599
🚀 New features to boost your workflow:
|
2 tasks
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
Closes audit findings 3.4 and 3.5 (the concrete, high-value parts of the AI-safety cluster).
GITTENSORY_REVIEW_SAFETYwas ON and the repo was allowlisted, so a registered-but-not-allowlisted repo got zero secret-leak gate while the engine still auto-merged/closed. A real-format committed credential (github_token,aws_access_key, …) is a leak on any repo, somaybeAddSecretLeakFindingnow runs unconditionally against the resolved diff.secretLeakFindingalready filters toHARD_SECRET_KINDS(the weak heuristics that false-positive on config/workflow content are dropped), so it never mis-fires; the prompt-injection defang and AI review stay flag-gated.evaluateGateCheckreturned a neutral "held for human" and dropped every configured deterministic blocker the instant an AI review wasai_review_inconclusive. A contributor who forced a non-JSON / budget-exhausted AI result could bury a PR's real violations (secret_leak, duplicate, missing-issue, slop, quality) in a hold. The inconclusive hold is now evaluated after deterministic blockers and only when none fired — a real violation still hard-blocks; a clean PR with an inconclusive AI is still held (never auto-closed on a model hiccup).3.3 (strengthening the prompt-injection keyword blocklist) is deferred: per the audit it's flag-gated, on for the live repos, and can only downgrade (suppress an AI hold) — a larger redesign best done on its own.
Scope
src/queue/processors.ts,src/rules/advisory.ts,src/review/safety.ts); no schema change; no migrationValidation
npm run test:ci— full gate greennpm audit --audit-level=moderate— 0 vulnerabilitiesSafety
site//CNAME/lovable