From 639ba3327b7ce702fb48532fa387d50ae4fdce0b Mon Sep 17 00:00:00 2001 From: Zhibo Lin <147509942+LE0-Lin@users.noreply.github.com> Date: Mon, 7 Sep 2026 00:07:22 +0800 Subject: [PATCH] Fix prohibited command table false positive --- CHANGELOG.md | 9 +++++++++ README.md | 10 ++++++---- benchmarks/README.md | 15 +++++++++------ benchmarks/adversarial-v1-report.md | 8 ++++---- benchmarks/adversarial_cases.json | 14 ++++++++++++++ benchmarks/corpus.json | 30 +++++++++++++++++++++++++++++ docs/limitations.md | 2 +- src/agent_config_score/scanner.py | 29 +++++++++++++++++++++++++--- tests/test_scanner.py | 27 ++++++++++++++++++++++++++ 9 files changed, 126 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95f0df5..e1093b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,15 @@ ## Unreleased +### Fixed + +- Do not report a dangerous command repeated as the left-hand example in a nearby Markdown replacement table when preceding text explicitly prohibits that same command. + +### Changed + +- Expanded Adversarial Benchmark v1 from 122 to 134 deterministic contracts with positive and negative Markdown-table cases across six instruction formats. +- Expanded the pinned real-repository smoke benchmark from three to five projects with one reviewed negative control and one active infrastructure-danger finding. + ## v0.21.0 ### Added diff --git a/README.md b/README.md index 1e06c0f..5d0b228 100644 --- a/README.md +++ b/README.md @@ -251,8 +251,8 @@ formats and separates current guarantees from open research challenges: | Tier | Result | Meaning | |---|---:|---| -| Deterministic contract | 122/122 exact matches | Current rule behavior stayed reproducible | -| Clean negative controls | 50/50 passed | No unexpected finding in controlled clean cases | +| Deterministic contract | 134/134 exact matches | Current rule behavior stayed reproducible | +| Clean negative controls | 56/56 passed | No unexpected finding in controlled clean cases | | Open challenge set | 4/8 detected | Four danger surfaces are covered; four semantic cases remain unsolved | The contract suite reports 100% precision and recall only for its closed labeled @@ -275,15 +275,17 @@ sanitized before/after example, then submit the ## Real-repository benchmark -The v0.17.0 scanner was replayed against pinned commits from three public AI coding projects; source code was scanned but never executed. +The scanner is replayed against pinned commits from five public projects with coding-agent instructions; source code is scanned but never executed. | Repository | Commit | Files found | Result | Manually reviewed signal | |---|---|---:|---:|---| | [`openai/codex`](https://github.com/openai/codex) | `d58d0e5` | 2 | B 82 | 3 references to absent `.rs` files; 1 context-size warning | | [`anomalyco/opencode`](https://github.com/anomalyco/opencode) | `9f69463` | 18 | A 94 | 1 context-size warning | | [`browser-use/browser-use`](https://github.com/browser-use/browser-use) | `d379a32` | 2 | B 88 | 1 context-size warning | +| [`Reaparr/Reaparr`](https://github.com/Reaparr/Reaparr) | `d9926d6` | 1 | A 100 | Prohibited `rm -rf` replacement-table example remains clean | +| [`olup/origan`](https://github.com/olup/origan) | `95ac789` | 1 | B 88 | 1 active aggressive Docker cleanup error | -All six findings matched their rule definitions in manual review. This small corpus is a reproducible smoke benchmark, not a quality leaderboard or a claim of broad statistical accuracy. The pinned inputs, reviewed expectations, limitations, and one-command runner live in [`benchmarks/`](https://github.com/LE0-Lin/AgentConfigScore/blob/v0/benchmarks/README.md). +All seven findings matched their rule definitions in manual review. This small corpus is a reproducible smoke benchmark, not a quality leaderboard or a claim of broad statistical accuracy. The pinned inputs, reviewed expectations, limitations, and one-command runner live in [`benchmarks/`](https://github.com/LE0-Lin/AgentConfigScore/blob/v0/benchmarks/README.md). ## Manual GitHub Actions setup diff --git a/benchmarks/README.md b/benchmarks/README.md index 6824bfe..0be012a 100644 --- a/benchmarks/README.md +++ b/benchmarks/README.md @@ -9,16 +9,16 @@ Neither benchmark is a claim that A 100 means semantic prompt quality. ## Adversarial mutation Benchmark v1 -Benchmark v1 contains 122 deterministic contract cases and 8 explicitly labeled +Benchmark v1 contains 134 deterministic contract cases and 8 explicitly labeled open challenges. The contracts cover positive detections and clean negative controls across `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, legacy and modern Cursor rules, and GitHub Copilot instructions. The current committed result is: -- 122/122 exact contract matches; -- 73 expected rule detections with no extra or missing rule IDs; -- 50/50 clean negative controls; +- 134/134 exact contract matches; +- 79 expected rule detections with no extra or missing rule IDs; +- 56/56 clean negative controls; - 4/8 challenge cases detected after adding four narrow danger-surface rules. The 100% contract precision and recall describe this closed, maintained test @@ -40,7 +40,8 @@ behavior. ## Real-repository smoke benchmark -This benchmark scans pinned commits from three public AI coding projects. It is +This benchmark scans pinned commits from five public projects with coding-agent +instructions. It is designed to make scanner behavior reproducible and to catch noisy path heuristics before release. It is not a ranking of the projects or a claim that three repositories represent every instruction style. @@ -53,8 +54,10 @@ cannot judge, read the [score contract and known limitations](../docs/limitation | `openai/codex` | `d58d0e5` | 2 | B 82 | 3 absent `.rs` path occurrences; 1 context-size warning | | `anomalyco/opencode` | `9f69463` | 18 | A 94 | 1 context-size warning | | `browser-use/browser-use` | `d379a32` | 2 | B 88 | 1 context-size warning | +| `Reaparr/Reaparr` | `d9926d6` | 1 | A 100 | Prohibited `rm -rf` replacement-table example remains clean | +| `olup/origan` | `95ac789` | 1 | B 88 | 1 active aggressive Docker cleanup error | -All six findings in the recorded run were manually checked against their rule +All seven findings in the recorded run were manually checked against their rule definitions. In particular, the reviewed output contains no `dead-path` finding for API symbols, package imports, documentation URLs, code-fence examples, platform paths, or generic filename conventions. diff --git a/benchmarks/adversarial-v1-report.md b/benchmarks/adversarial-v1-report.md index a9e75b7..cae23ef 100644 --- a/benchmarks/adversarial-v1-report.md +++ b/benchmarks/adversarial-v1-report.md @@ -1,11 +1,11 @@ # AgentConfigScore Benchmark v1 -Deterministic contract cases: **122/122 exact matches**. +Deterministic contract cases: **134/134 exact matches**. - Precision: **100.0%** - Recall: **100.0%** - F1: **100.0%** -- Clean negative controls: **50/50 passed** +- Clean negative controls: **56/56 passed** | Category | Exact matches | Accuracy | |---|---:|---:| @@ -13,8 +13,8 @@ Deterministic contract cases: **122/122 exact matches**. | `contradiction` | 6/6 | 100.0% | | `coordination` | 1/1 | 100.0% | | `coverage` | 7/7 | 100.0% | -| `danger` | 42/42 | 100.0% | -| `negation` | 36/36 | 100.0% | +| `danger` | 48/48 | 100.0% | +| `negation` | 42/42 | 100.0% | | `path` | 12/12 | 100.0% | | `regression` | 5/5 | 100.0% | | `secret` | 6/6 | 100.0% | diff --git a/benchmarks/adversarial_cases.json b/benchmarks/adversarial_cases.json index ec7aa0d..b2af104 100644 --- a/benchmarks/adversarial_cases.json +++ b/benchmarks/adversarial_cases.json @@ -45,6 +45,20 @@ "files": {"{instruction}": "Do not run rm -rf build.\n"}, "expected_codes": [] }, + { + "id": "prohibited-rm-rf-replacement-table", + "category": "negation", + "note": "A prohibited command repeated in a nearby replacement table is a negative control.", + "files": {"{instruction}": "## Safety\n\nNever use `rm -rf` under any circumstances.\n\nUse `trash` instead:\n\n| Instead of | Use |\n|---|---|\n| `rm -rf