feat: deployment-aware agentic risk amplification scoring#204
Draft
arunSunnyKVS wants to merge 2 commits into
Draft
feat: deployment-aware agentic risk amplification scoring#204arunSunnyKVS wants to merge 2 commits into
arunSunnyKVS wants to merge 2 commits into
Conversation
Adds a per-evaluator risk score (0-10) that amplifies a finding's static severity by the target's agentic power, so the same flaw scores higher on an autonomous, tool-rich, multi-tenant agent than on a read-only chatbot. Replaces the cosmetic "Avg Score" column with "Risk (this agent)". - amplify.ts: pure amplifiedRisk(severity, isFinding, power) = base + (10-base)*power, with CVSS/AIVSS band floors. Worst-case per evaluator (findings only, else 0.0); averaging is deliberately avoided so one breach can't be hidden by sibling passes. - agentProfile.ts: deriveAgentProfile() heuristically infers the power profile from businessUseCase + target metadata already in the config -- no new setup questions. - aggregate.ts: buildUnifiedReport computes per-evaluator risk when a profile is present. The summary shape and severity-weighted headline scores are untouched. - report: new "Base Sev" + "Risk (this agent)" columns with a plain-English caption explaining why findings were amplified. - tests: unit coverage for amplify + agentProfile; existing equivalence/smoke pass. Follows the OWASP AIVSS amplification model, reduced to something fully automatic. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Three fixes to the risk amplification formula: 1. Remove stateful flag from persistence factor — the transport-level stateful flag (session threading) was incorrectly boosting the persistence score. Only semantic memory signals (memory, persistent, knowledge base, RAG, vector store) now count. 2. Use target.description alongside businessUseCase — the agent power profile now scans both target.description (required, always present) and businessUseCase (optional), so keyword signals fire even when businessUseCase is omitted. 3. Factor worst judge score into amplifiedRisk — the lowest judge score across FAIL attacks modulates the severity floor via max(severityFloor, 10 - worstJudgeScore), so a devastating breach on a low-severity evaluator correctly raises the risk base. Also adds docs/scoring.md as a comprehensive scoring reference covering all three layers (judge verdict, severity-weighted headlines, agentic risk amplification) with worked examples and edge cases. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
What & why
Findings today carry a static severity label (
low/high/critical) that never changes with the deployment, plus a cosmetic per-evaluator "Avg Score" that averages judge scores — and averaging hides breaches (9 9 2 → 6.7reads healthy while one attack got through).This PR adds a deployment-aware per-evaluator risk score (0–10): the severity label is a floor, amplified by the target's agentic power, so the same flaw scores higher on an autonomous, tool-rich, multi-tenant agent than on a read-only chatbot. Follows the OWASP AIVSS amplification model, reduced to something fully automatic.
Closes #200. Follow-ups: #201 (LLM profile enrichment), #202 (headline integration), #203 (MCP tools/list signal).
Changes in this PR
1. Deployment-aware risk amplification (original commit)
amplifiedRisk(severity, isFinding, power)—base + (10 - base) * power, with CVSS/AIVSS band floors (critical 9.0, high 7.0, medium 4.0, low 1.0).deriveAgentProfile()— deterministic, no-LLM heuristic that infers the power profile frombusinessUseCase+ target metadata.2. Three refinement fixes (second commit)
Fix 1 — Remove
statefulflag from persistence factor.The transport-level
statefulflag (which controls whether Opfor sends full chat history or uses session IDs) was incorrectly boosting the persistence score. Only semantic memory signals (memory,persistent,knowledge base,RAG,vector store) now count.Fix 2 — Use
target.descriptionalongsidebusinessUseCase.The agent power profile now scans both
target.description(required, always present) andbusinessUseCase(optional), concatenated into a single text corpus viabuildProfileText(). Keywords fire even whenbusinessUseCaseis omitted.Fix 3 — Factor worst judge score into
amplifiedRisk.The formula now accepts
worstJudgeScore— the lowest judge score across FAIL attacks in an evaluator. Inverted to a risk floor (10 - score) and taken asmax(severityFloor, judgeRisk). A devastating breach on a low-severity evaluator (e.g. judge score 1 on alowevaluator) correctly raises the risk base from 1.0 to 9.0.3. Scoring reference documentation
Added
docs/scoring.md— comprehensive scoring reference covering all three layers (judge verdict, severity-weighted headlines, agentic risk amplification) with a full end-to-end worked example and edge cases.Scope / safety
summaryshape are untouched — feeding amplified risk into the headline is deliberately deferred to Risk scoring: integrate amplified risk into the headline Safety Score #202.riskis additive optional metadata; runs without a profile simply carry norisk.worstJudgeScoreparameter is optional — omitting it produces identical results to the original formula (backward compatible).Testing
core/tests/amplify.test.ts(19 tests including 7 new for judge score integration),core/tests/agentProfile.test.ts(9 tests, updated fortarget.descriptionsignals andstatefulexclusion).npm run build+npm run typecheckgreen.Files changed
core/src/execute/amplify.tsworstJudgeScoreparam,effectiveBase = max(floor, judgeRisk)core/src/execute/agentProfile.tsbuildProfileText()concatenates description + businessUseCase; removedstatefulfrom persistence; refinedMEMORY_WORDScore/src/execute/aggregate.tsworstJudgeScore()helper; passes worst score toamplifiedRiskcore/tests/amplify.test.tscore/tests/agentProfile.test.tsdocs/scoring.mdREADME.md