Repository navigation
feat(redteam): add detection-to-action smoke benchmark - #3362
MohammadHaroonAbuomar merged 7 commits into
Conversation
Signed-off-by: kerberosmansour <13433538+kerberosmansour@users.noreply.github.com>
Signed-off-by: kerberosmansour <13433538+kerberosmansour@users.noreply.github.com>
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
🤖 AI Agent: code-reviewer — Action items:
TL;DR: 0 blockers, 2 warnings. The PR introduces a well-structured and security-conscious red-team smoke benchmark, but there are minor areas for improvement.
Action items:
Warnings (fine as follow-up PRs):
|
🤖 AI Agent: security-scanner — View details
No security issues found. |
🤖 AI Agent: docs-sync-checker — Docs Sync
Docs SyncDocumentation is in sync. |
🤖 AI Agent: test-generator — `tests/redteam/benchmark/benchmark.py`
|
🤖 AI Agent: breaking-change-detector — API Compatibility
API CompatibilityNo breaking changes detected. |
|
🟡 Contributor Check: MEDIUM
Automated check by AGT Contributor Check. |
PR Review Summary
Verdict: AI review comments are untrusted advisory output. The summary reports workflow-generated completion status only, not model-authored pass/fail claims. |
Signed-off-by: kerberosmansour <13433538+kerberosmansour@users.noreply.github.com>
MohammadHaroonAbuomar
left a comment
There was a problem hiding this comment.
- contract.schema.json <-> benchmark.py drift test still missing: the existing schema test only checks $defs names, additionalProperties:false, and the certification const; nothing cross-checks the schema's required/properties against SCENARIO_FIELDS/TRACE_FIELDS/RESULT_FIELDS/REPORT_FIELDS, so the two sources of truth can drift silently.
- one-line phase-2 note in tests/redteam/benchmark/README.md that detection_verdict is declared scenario metadata (live detection = phase 2); a real detector catching an evasion would currently be a contract violation.
- (process) MAINTAINER: approve the fork workflow runs; the PR's own redteam-benchmark.yml has never executed in CI (local equivalent passes: 18 tests + 4 subtests incl e2e smoke).
Signed-off-by: kerberosmansour <13433538+kerberosmansour@users.noreply.github.com>
|
Addressed in
Local validation now passes with 19 contract tests, including the four schema-definition subtests, plus the end-to-end smoke run, Ruff formatting/lint, Python compilation, and diff checks. The fork workflow approval remains a maintainer-only process step, as noted in the review. |
|
MohammadHaroonAbuomar can you review the changes please? |
MohammadHaroonAbuomar
left a comment
There was a problem hiding this comment.
Minor:
- the set hash is order-sensitive (json.dumps of the list); sort by id before hashing or rename.
- simulate_trace containment is metadata-derived (documented phase-2 detector); workflow pins should adopt #3365's baseline after it merges.
MohammadHaroonAbuomar
left a comment
There was a problem hiding this comment.
Minor:
- the set hash is order-sensitive (json.dumps of the list); sort by id before hashing or rename.
- simulate_trace containment is metadata-derived (documented phase-2 detector); workflow pins should adopt #3365's baseline after it merges.
Signed-off-by: kerberosmansour <13433538+kerberosmansour@users.noreply.github.com>
Commits dd01cf9 (drift test, README note) and 96604da (hash recompute, scenario_id cross-check, id-sorted hash) address each request. At head 29f963d I ran the contract tests (21 pass), run-smoke.sh (OK), and probes: the drift test fails when a field is added to either side; a forged report with 24 copies of one benign result and a bogus hash exits 1 through the hygiene CLI, as does one with a genuine hash but duplicated ids; reversed and shuffled fixtures hash identically.
MohammadHaroonAbuomar
left a comment
There was a problem hiding this comment.
Verified at 29f963d: the schema-versus-constants drift test fails when a field is added to either side, a forged report with a bogus scenario_set_hash or foreign scenario_ids exits 1 through the hygiene CLI, the set hash is id-sorted, and the README carries the phase-two note. 21 contract tests pass and run-smoke.sh is green.
|
The only CI run on this head is from mid-August and its required checks have expired, so the merge gate cannot see them. Please rebase onto current main and force-push to trigger a fresh run. The content is already reviewed and approved; nothing else is needed. |
|
The branch is behind main again after today's merges, and the update-branch action no longer has permission on your fork (maintainer edits look switched off), so please rebase onto current main and force-push. The content is approved; nothing else is needed. |
* feat(redteam): add detection-to-action smoke benchmark Signed-off-by: kerberosmansour <13433538+kerberosmansour@users.noreply.github.com> * ci(redteam): run evidence benchmark smoke Signed-off-by: kerberosmansour <13433538+kerberosmansour@users.noreply.github.com> * test(redteam): harden benchmark validation and CI Signed-off-by: kerberosmansour <13433538+kerberosmansour@users.noreply.github.com> * test(redteam): guard schema contract drift Signed-off-by: kerberosmansour <13433538+kerberosmansour@users.noreply.github.com> * fix(redteam): bind reports to scenario set Signed-off-by: kerberosmansour <13433538+kerberosmansour@users.noreply.github.com> --------- Signed-off-by: kerberosmansour <13433538+kerberosmansour@users.noreply.github.com> Co-authored-by: MohammadHaroonAbuomar <40180927+MohammadHaroonAbuomar@users.noreply.github.com> Signed-off-by: yuvrajsingh2428 <offcyuvi2428@gmail.com>
Summary
Adds the first accepted phase of the evidence-led red-team benchmark proposed in #3349:
tests/redteam;detected/executedandundetected/containedvisible;agt red-teampath.The smoke gate fails on executed attacks, benign false blocks, benign detector flags, contract violations, evidence-level overclaims, raw/secret-bearing artifacts, or certification claims. It does not produce a single aggregate resilience score.
Issue and accepted scope
Refs #3349.
This implements the initial scope supported in the maintainer feedback:
#3349 (comment)
The public CLI,
agent-srelive execution support, 240-scenario measurement suite, external 54k corpus, and 250-record live tier remain deferred for separate review.Follow-up hardening
Cross-platform and evidence-integrity review of the reference implementation led to a small hardening pass in this PR:
propertiesandrequiredfields are checked bidirectionally against the four Python record-field constants, preventing contract drift;detection_verdictis declared scenario metadata in this phase and real detector output is phase-two work;The corresponding reference implementation fixes are in kerberosmansour/AGT-Embeddings-Experiment#42. They distinguish an observed model refusal from incomplete live trace capture, remove import-time fixture loading, and document/guard generated corpus tests.
This AGT contribution remains intentionally L2-only. It does not port the live or corpus tiers.
Validation
python3 -m unittest discover -s tests/redteam -p 'test_benchmark_contract.py' -v— 19 tests passed, including the four schema-definition drift subtests, both executed-attack matrix subtests, and the fail-closed input/hygiene regressions.bash tests/redteam/benchmark/run-smoke.sh— 24 scenarios validated; matrix6 detected/contained, 0 detected/executed, 6 undetected/contained, 0 undetected/executed; 12/12 benign cases allowed; hygiene passed.python3 -m ruff format --check ...— passed.python3 -m ruff check ... --select E,F,W --ignore E501— passed.python3 -m py_compile ...— passed.actionlint .github/workflows/redteam-benchmark.yml— passed.shellcheck tests/redteam/benchmark/run-smoke.sh— passed.The existing
tests/redteam/test_asi.pyremains unchanged. Its 84 tests collect successfully; executing them on currentmainis independently blocked by their existing reference to the absenttemplates/policies/starters/*fixture path.Security and evidence boundary
L2_mock_behaviouralandcertification_claim: false.executedmeans a benign dry-run completed inside the mock harness; every trace recordsside_effects: none.Compatibility
This is additive test and CI coverage. It does not change packages, runtime governance behavior, existing playbooks, existing red-team tests, or the public CLI.
Prior art
The contract, evidence levels, and attempted-versus-executed trace semantics are adapted from the MIT-licensed reference implementation: