@event4u/agent-config 9.6.0 → 9.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +63 -942
- package/README.md +17 -17
- package/dist/agent-src/README.md +2 -2
- package/dist/agent-src/rules/downstream-changes.md +31 -1
- package/dist/agent-src/skills/agent-docs-writing/SKILL.md +34 -16
- package/dist/agent-src/skills/agents-md-thin-root/SKILL.md +9 -9
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/agent-src/templates/github-workflows/doc-impact.yml +101 -0
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +5 -5
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +1 -1
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +2 -2
- package/dist/discovery/trust-report.md +1 -1
- package/dist/discovery/workspaces.json +2 -2
- package/dist/mcp/awesome-mcp-servers.row.md +1 -1
- package/dist/mcp/mcp-cloudflare-catalogue.json +1 -1
- package/dist/mcp/registry-manifest.json +3 -3
- package/docs/CLAIMS.md +2 -1
- package/docs/archive/CHANGELOG-6.0.0-overview.md +953 -0
- package/docs/benchmark.md +33 -9
- package/docs/decisions/ADR-122-adversarial-verification-council.md +30 -0
- package/docs/decisions/ADR-123-runtime-security-scope-and-spawn-hardening.md +31 -0
- package/docs/spawn-site-policy.md +72 -0
- package/docs/threat-model.md +1 -1
- package/package.json +2 -2
- package/src/agent-src/README.md +2 -2
- package/src/scripts/_lib/adversarial_bench_score.ts +106 -0
- package/src/scripts/_lib/spawn_env.ts +24 -4
- package/src/scripts/bench_adversarial_council.ts +292 -0
- package/src/scripts/check_no_new_legacy_path.ts +2 -0
- package/src/scripts/check_source_pointer_freshness.ts +165 -0
- package/src/scripts/hooks/dispatch_hook.ts +5 -1
- package/src/scripts/lint_readme_serial_comma.ts +169 -0
package/docs/benchmark.md
CHANGED
|
@@ -559,7 +559,7 @@ replication on a per-token-billed key.
|
|
|
559
559
|
- Runner: `src/scripts/bench_ab_v2_run.ts --host codex` (checkpoint-resumable).
|
|
560
560
|
- Roadmap: `agents/roadmaps/archive/road-to-opt-measurement-unblock.md` Phase 2.
|
|
561
561
|
|
|
562
|
-
## adversarial-verification-council finding coverage —
|
|
562
|
+
## adversarial-verification-council finding coverage — HONEST NULL (resolved 2026-07-21)
|
|
563
563
|
|
|
564
564
|
Pre-registered claim `adversarial-council-finding-coverage` (docs/CLAIMS.md,
|
|
565
565
|
ADR-122): on the RESIDUAL defect pool — defects that survive a single strong
|
|
@@ -574,14 +574,38 @@ controversial-but-correct control.
|
|
|
574
574
|
**AND** absolute >= +8 pp, **AND** panel FP not worse than baseline within
|
|
575
575
|
noise — encoded + tested in
|
|
576
576
|
[`src/scripts/_lib/adversarial_council_gate.ts`](../src/scripts/_lib/adversarial_council_gate.ts).
|
|
577
|
-
- **Status:
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
577
|
+
- **Status: HONEST NULL (resolved 2026-07-21).** A curated judge-survivable
|
|
578
|
+
corpus was built (`internal/bench/adversarial-council/`: 12 planted-defect
|
|
579
|
+
fixtures across 4 subtlety classes + 3 controversial-but-correct clean
|
|
580
|
+
controls; subtlety distribution published; passed an independent validity
|
|
581
|
+
audit after one fixture was repaired). The registered cross-vendor run
|
|
582
|
+
(anthropic `claude-sonnet-4-5` + openai `gpt-4o`, spend-authorized) resolved
|
|
583
|
+
the claim NEGATIVE:
|
|
584
|
+
|
|
585
|
+
| quantity | value |
|
|
586
|
+
|---|--:|
|
|
587
|
+
| judge-passed residual pool | 5–7 defects (missed by both neutral passes) |
|
|
588
|
+
| single-skeptic residual recall | 0.60 |
|
|
589
|
+
| 2-vendor panel residual recall | 0.60 (**zero lift**) |
|
|
590
|
+
| single-skeptic FP on clean controls | 1.00 |
|
|
591
|
+
| panel FP on clean controls | 1.00 |
|
|
592
|
+
|
|
593
|
+
The second vendor's residual catches were a **strict subset** of the first's,
|
|
594
|
+
so the panel added no marginal coverage; both recall thresholds (+25% rel,
|
|
595
|
+
+8 pp abs) missed → **honest-null**. Under the adversarial-skeptic posture
|
|
596
|
+
both the single skeptic and the panel false-flagged **all three**
|
|
597
|
+
controversial-but-correct controls (100% FP) — the posture over-flags correct
|
|
598
|
+
code. Stable across two runs. Per the locked gate, the Mode 9 surface stays
|
|
599
|
+
**default-off permanently** (like recursive-verification). Reproducible
|
|
600
|
+
artifact: `internal/bench/adversarial-council/runs/`.
|
|
601
|
+
- **Transport lesson.** The first run attempted via `council_cli run` was
|
|
602
|
+
REJECTED as a measurement artifact: that transport runs multi-round
|
|
603
|
+
peer-review with cross-member visibility and returns prose ("Round 2 …
|
|
604
|
+
Reviewer A"), which both violates the independent-skeptic requirement and
|
|
605
|
+
defeats JSON scoring. The valid run uses direct, independent per-vendor
|
|
606
|
+
client calls (`bench_adversarial_council.ts`) with a strict-JSON system
|
|
607
|
+
prompt and a deterministic, pre-validated scorer
|
|
608
|
+
(`adversarial_bench_score.ts` + its synthetic red/green test).
|
|
585
609
|
|
|
586
610
|
|
|
587
611
|
## Defect-finding: team vs self-review vs council (2026-07-20) — HONEST NULL (ceiling-limited) {#honest-null-defect}
|
|
@@ -134,3 +134,33 @@ Each settled decision this roadmap does NOT touch:
|
|
|
134
134
|
ADR-120 (council chairman mode), ADR-109 (subagent-v1 contract).
|
|
135
135
|
- `docs/CLAIMS.md#adversarial-council-finding-coverage` — the pre-registered claim.
|
|
136
136
|
- `cross-vendor-parity` (backed) — the evidence the finding-coverage scope rests on.
|
|
137
|
+
|
|
138
|
+
## Addendum (2026-07-21) — finding-coverage claim resolved HONEST-NULL
|
|
139
|
+
|
|
140
|
+
The pre-registered `adversarial-council-finding-coverage` claim was executed and
|
|
141
|
+
resolved **negative**. A curated judge-survivable corpus
|
|
142
|
+
(`internal/bench/adversarial-council/`: 12 planted-defect fixtures across
|
|
143
|
+
multi-file-interaction / logic-inversion / security-masked / complex-state + 3
|
|
144
|
+
controversial-but-correct clean controls; subtlety distribution published;
|
|
145
|
+
passed an independent validity audit after one fixture was repaired) was run
|
|
146
|
+
cross-vendor (anthropic `claude-sonnet-4-5` + openai `gpt-4o`) under the
|
|
147
|
+
maintainer spend authorization.
|
|
148
|
+
|
|
149
|
+
**Result:** on the judge-passed residual, the 2-vendor skeptic panel matched the
|
|
150
|
+
single skeptic exactly (residual recall 0.60 = 0.60, **zero lift** — the second
|
|
151
|
+
vendor's catches were a strict subset of the first's), at a **100%** false-
|
|
152
|
+
positive rate on the controversial-but-correct controls under the adversarial-
|
|
153
|
+
skeptic posture. Both locked recall thresholds missed -> honest-null. **The
|
|
154
|
+
Mode 9 `adversarial-verification-council` surface stays default-off permanently**
|
|
155
|
+
(no settings change — it already ships off), recorded like recursive-verification
|
|
156
|
+
(ADR-106). Detail + reproducible artifact:
|
|
157
|
+
`docs/benchmark.md#adversarial-verification-council`,
|
|
158
|
+
`internal/bench/adversarial-council/runs/`.
|
|
159
|
+
|
|
160
|
+
**Transport lesson (durable):** `council_cli run`/`debate` is a *deliberation*
|
|
161
|
+
transport — multi-round peer-review with cross-member visibility, prose output.
|
|
162
|
+
It is the WRONG tool for an independent-skeptic, structured-output benchmark (it
|
|
163
|
+
violated the independence requirement and defeated JSON scoring; the first run
|
|
164
|
+
through it was rejected as an artifact). The valid measurement uses direct,
|
|
165
|
+
independent per-vendor client calls with a strict-JSON contract and a
|
|
166
|
+
deterministic, pre-validated scorer.
|
|
@@ -109,3 +109,34 @@ are also rejected: per-file pragma containment (`security_lint.ts`) only.
|
|
|
109
109
|
costs nothing to keep.
|
|
110
110
|
- **Env allowlist instead of deny-by-family.** Rejected — would strip env the
|
|
111
111
|
provider CLIs need and rot as new good vars appear.
|
|
112
|
+
|
|
113
|
+
## Follow-up (2026-07-21) — `road-to-spawn-env-completion`
|
|
114
|
+
|
|
115
|
+
The 9.6.0 external review reproduced a working exploit against the fix this ADR
|
|
116
|
+
shipped: `GIT_CONFIG_COUNT` / `GIT_CONFIG_KEY_<n>` / `GIT_CONFIG_VALUE_<n>` (and
|
|
117
|
+
`GIT_CONFIG_GLOBAL` / `_SYSTEM`) survived the deny-by-family scrub — the
|
|
118
|
+
`GIT_*_COMMAND` family missed them (no `_COMMAND` suffix) — letting an attacker
|
|
119
|
+
set arbitrary git config (`core.fsmonitor` runs shell on every `git status`,
|
|
120
|
+
which the consumer-runtime hooks trigger). `GIT_ALTERNATE_OBJECT_DIRECTORIES`
|
|
121
|
+
and `HOSTALIASES` also leaked. **Confirmed empirically (all 5) and closed:**
|
|
122
|
+
`hardenedSpawnEnv` now denies the whole `GIT_CONFIG`/`GIT_CONFIG_*` family by
|
|
123
|
+
prefix plus the two exact vars, with falsifiable test vectors (red without the
|
|
124
|
+
fix, green with it).
|
|
125
|
+
|
|
126
|
+
**`maintainer-ci-spawn-sweep` blocker — resolved by classification, not mass
|
|
127
|
+
migration.** Rather than migrate ~15 low-risk maintainer/CI sites, all spawn
|
|
128
|
+
sites are now classified in `docs/spawn-site-policy.md` (Consumer Runtime /
|
|
129
|
+
Maintainer CLI / trusted CI / install-time). The consumer-runtime dispatcher
|
|
130
|
+
(`hooks/dispatch_hook.ts`) — missed in PR #984 — now routes through
|
|
131
|
+
`hardenedSpawnEnv`; the maintainer/CI/install sites are documented exempt with
|
|
132
|
+
rationale (env is maintainer- or workflow-controlled, not attacker-influenced).
|
|
133
|
+
|
|
134
|
+
**Secure-spawn lint — rejected (council 2026-07-21, claude-sonnet-4-5 +
|
|
135
|
+
gpt-4o).** A CI lint forbidding raw spawn in runtime paths was proposed (P0 in
|
|
136
|
+
the review) but rejected: it is net-new governance surface (a CI gate +
|
|
137
|
+
allowlist + exemption-adjudication + false-positive triage), which the folded
|
|
138
|
+
complexity-budget lock (PR #983) forbids — the lock text explicitly lists
|
|
139
|
+
"linter". The "retires ad-hoc review" justification failed the retirement test
|
|
140
|
+
(no such review gate exists to retire). `docs/spawn-site-policy.md` is the
|
|
141
|
+
self-enforcing substitute: its completeness claim is checked by git-diff
|
|
142
|
+
visibility at review time, not a build gate.
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Spawn-Site Policy — subprocess env-hardening classification
|
|
2
|
+
|
|
3
|
+
> Every place agent-config spawns a subprocess is classified into one of four
|
|
4
|
+
> buckets. The bucket decides whether the spawn MUST route its environment
|
|
5
|
+
> through `hardenedSpawnEnv()` (`src/scripts/_lib/spawn_env.ts`). This document
|
|
6
|
+
> is the single authoritative inventory — a new spawn site is visible in a PR
|
|
7
|
+
> diff as either an addition to a bucket below or an unclassified site that
|
|
8
|
+
> contradicts this doc's completeness claim. That git-diff visibility is the
|
|
9
|
+
> enforcement mechanism (a dedicated lint was considered and **rejected** — see
|
|
10
|
+
> ADR-123 and the "No lint" note below).
|
|
11
|
+
|
|
12
|
+
## The buckets
|
|
13
|
+
|
|
14
|
+
| Bucket | Definition | Env rule |
|
|
15
|
+
|---|---|---|
|
|
16
|
+
| **Consumer Runtime** | Runs on the end-user's machine as part of the installed package — the hook dispatcher, dispatched hook concerns, and the AI-council CLI transport. The parent `process.env` is whatever the user's agent/shell exposes and is influenceable by repo content the agent just read. | **MUST** pass `env: hardenedSpawnEnv(overrides?)`. |
|
|
17
|
+
| **Maintainer CLI / tooling** | Runs on a maintainer's dev machine, invoked explicitly (benchmarks, fixture replay, wizards, one-off scripts). The env is the maintainer's own. | SHOULD prefer the helper; MAY use raw env with a stated reason. Not attacker-controlled. |
|
|
18
|
+
| **CI (trusted)** | Runs inside this repo's GitHub Actions on the repo's own refs (git/gh helpers reading `git log` / `gh pr view`). Env is set by the workflow file, not by PR content; fork PRs get no secrets. | Raw env permitted. Migrate only if a job begins consuming untrusted fork content into its env. |
|
|
19
|
+
| **Install-time** | Runs during `npx`/install (the installer spawning package managers from a lockfile). | Raw env permitted; installs are lockfile-pinned. Revisit if an installer step ingests untrusted input. |
|
|
20
|
+
|
|
21
|
+
## Consumer-Runtime inventory (the security-critical set)
|
|
22
|
+
|
|
23
|
+
All Consumer-Runtime spawns route through `hardenedSpawnEnv()`:
|
|
24
|
+
|
|
25
|
+
| Site | Spawns | Status |
|
|
26
|
+
|---|---|---|
|
|
27
|
+
| `src/scripts/ai_council/clients.ts::_runSubprocess` | provider CLIs (`codex`/`claude`/`gemini`) | ✅ hardened (ADR-123 / PR #984) |
|
|
28
|
+
| `src/scripts/hot_context_hook.ts` | `git rev-parse` | ✅ hardened (PR #984) |
|
|
29
|
+
| `src/scripts/roadmap_progress_hook.ts` | tsx regenerator (runs git) | ✅ hardened (PR #984) |
|
|
30
|
+
| `src/scripts/hooks/dispatch_hook.ts` | every hook concern via tsx | ✅ hardened (this roadmap) |
|
|
31
|
+
| `src/scripts/hooks/replay_hook.ts` | re-dispatches through the runtime | Maintainer/fixture tool; its downstream concern spawn is hardened by `dispatch_hook` above. Exempt at this layer. |
|
|
32
|
+
|
|
33
|
+
Any NEW consumer-runtime spawn (a new hook that shells out, a new installed
|
|
34
|
+
runtime path) MUST be added to this table and route through `hardenedSpawnEnv`.
|
|
35
|
+
|
|
36
|
+
## Maintainer / CI / Install (exempt, with rationale)
|
|
37
|
+
|
|
38
|
+
The remaining spawn sites (benchmarks `bench_*`, `consumer_matrix`, the
|
|
39
|
+
installer `install.ts`, the fleet CLI, and the ~15 git/gh maintainer helpers
|
|
40
|
+
such as `check_trunk_drift`, `evidence_report`, `print_required_checks`,
|
|
41
|
+
`check_release_pr_shape`, `migration_status`, …) are Maintainer CLI, trusted CI,
|
|
42
|
+
or install-time. Their environment is the maintainer's own or GitHub Actions'
|
|
43
|
+
workflow-controlled env — not influenced by untrusted repo content the agent
|
|
44
|
+
read at runtime. They are exempt from the MUST rule. A maintainer/CI site moves
|
|
45
|
+
to the Consumer-Runtime bucket (and MUST harden) only if it starts running on an
|
|
46
|
+
end-user machine or ingesting untrusted fork content into its spawn env.
|
|
47
|
+
|
|
48
|
+
## What `hardenedSpawnEnv` scrubs
|
|
49
|
+
|
|
50
|
+
Deny-by-family (not an allowlist — the CLIs legitimately need arbitrary env):
|
|
51
|
+
dynamic loader (`LD_*`, `DYLD_*`, `GCONV_PATH`), git command hooks
|
|
52
|
+
(`GIT_*_COMMAND`, `GIT_EXTERNAL_DIFF`, `GIT_SSH_COMMAND`, `GIT_PAGER`, `PAGER`),
|
|
53
|
+
**git config-injection** (`GIT_CONFIG` and the whole `GIT_CONFIG_*` family —
|
|
54
|
+
`GIT_CONFIG_COUNT`/`_KEY_<n>`/`_VALUE_<n>`/`_GLOBAL`/`_SYSTEM`, the
|
|
55
|
+
`core.fsmonitor` RCE primitive), `GIT_ALTERNATE_OBJECT_DIRECTORIES`,
|
|
56
|
+
`HOSTALIASES`, runtime auto-exec hooks (`NODE_OPTIONS`, `BASH_ENV`, `ENV`,
|
|
57
|
+
`PYTHON*`, `PERL5*`, `RUBYOPT`), and `IFS`. Everything else is preserved.
|
|
58
|
+
|
|
59
|
+
## No lint (deliberate)
|
|
60
|
+
|
|
61
|
+
A CI lint forbidding raw spawn in runtime paths was proposed and **rejected**
|
|
62
|
+
(council 2026-07-21; recorded in ADR-123): it is net-new governance surface (a
|
|
63
|
+
CI gate + allowlist + exemption-adjudication + false-positive triage), which the
|
|
64
|
+
complexity-budget lock forbids ("must not become a new rule/linter/gate"). This
|
|
65
|
+
inventory doc is the self-enforcing substitute — its completeness claim is
|
|
66
|
+
checked by git-diff visibility at review time, not by a build gate.
|
|
67
|
+
|
|
68
|
+
## See also
|
|
69
|
+
|
|
70
|
+
- `docs/decisions/ADR-123-runtime-security-scope-and-spawn-hardening.md` — the runtime-security scope decision + the rejected-lint record.
|
|
71
|
+
- `docs/threat-model.md` row (g) — the subprocess-env-inheritance vector.
|
|
72
|
+
- `src/scripts/_lib/spawn_env.ts` — the helper.
|
package/docs/threat-model.md
CHANGED
|
@@ -16,7 +16,7 @@ and holds no user data. Threats are about **artifact integrity** and
|
|
|
16
16
|
| d | **Lethal-trifecta surface** — a skill combining private-data access + untrusted-content ingestion + external communication on one autonomous path enables confused-deputy / data-exfiltration attacks | Prompt-injected content inside a fetched doc instructs an agent to read a local secret and POST it to an attacker-controlled endpoint | `src/rules/lethal-trifecta-guard.md` (Iron Law: break one leg or gate egress behind human-in-the-loop); `src/rules/untrusted-input-defense.md` (untrusted content is data, never instructions; spotlighting); `lint_skill_frontmatter_safety.py` (flags over-broad tool grants) | These are authoring-time controls — no runtime *behavioural-enforcement* layer exists (input sanitization ≠ enforcement — see ADR-123) | Runtime behavioural enforcement stays out of scope for AC (`ADR-123-runtime-security-scope-and-spawn-hardening`): AC ships the rules, the consumer's tool-execution layer enforces them; the outbound content-scan guard is deferred with a `revisit-if`, not silently dropped. `lethal-trifecta-guard.md` and `untrusted-input-defense.md` are the canonical reference — do not re-describe here |
|
|
17
17
|
| e | **Malicious metadata / frontmatter injection** — a PR embeds hostile YAML in a skill's frontmatter (e.g. injecting a trigger keyword that causes a dangerous skill to fire in unintended contexts, or adding `permissionMode: bypassPermissions`) | PR contributor adds `permissionMode: bypassPermissions` or a wildcard `allowed_tools: ["*"]` entry to an existing skill's frontmatter; or crafts a trigger keyword to hijack routing | `lint_skill_frontmatter_safety.py` — HIGH-severity block on `bypassPermissions`, wildcard `allowed_tools`, unsafe `execution.type: automated` without safety floor; `lint_hidden_unicode.py` — catches invisible chars inside frontmatter YAML values; PR review gate; `scripts/validate_frontmatter.py` schema validation | Schema validation does not verify trigger-keyword semantic safety (a plausible keyword that causes over-broad firing is not caught) | Extend `validate_frontmatter.py` to flag trigger keywords that match security-sensitive path prefixes (e.g. a skill triggering on `"auth"` when it has `execution.type: automated`) |
|
|
18
18
|
| f | **Skill self-update — safety-floor rewrite** — an agent is social-engineered (via chat or a PR) into weakening a kernel rule, safety floor, or MCP/tool allowlist | A PR removes the Iron Law block from `non-destructive-by-default.md`; or a chat prompt instructs the agent to edit `security-sensitive-stop.md` to narrow its self-modification clause; or a PR modifies `scope-control` to remove the Hard Floor | `src/rules/security-sensitive-stop.md` — "self-modification via chat" clause: requests to weaken safety floors / kernel rules / MCP allowlists must route through `scope-control` gates; `src/rules/scope-control.md` — kernel-rule edits require own PR + ≥ 24 h soak; `dist/agent-src/` is read-only (source-of-truth rule); `scripts/check_condensation.py` detects Iron-Law section deletion or downgrade | No automated per-rule diff check that fires specifically when a kernel rule's Iron Law section is removed; relies on PR reviewer recognising the file class | Add a CI check (`scripts/check_kernel_rule_integrity.py` — P3+) that asserts Iron Law fenced-code blocks survive unchanged in all files listed in `docs/contracts/kernel-membership.md` |
|
|
19
|
-
| g | **Subprocess spawn-env inheritance** — AC's own transport spawns an external CLI (the AI-council provider CLIs; consumer-runtime hooks spawn `git`) with the full parent `process.env`, so an attacker-influenced env var in the parent becomes RCE when the child (or a `git` it invokes internally) runs | A poisoned `GIT_EXTERNAL_DIFF` / `core.pager` / `GIT_SSH_COMMAND`, a dynamic-loader `LD_PRELOAD` / `DYLD_INSERT_LIBRARIES` / `GCONV_PATH`, or a runtime hook `NODE_OPTIONS` / `BASH_ENV` / `PYTHONSTARTUP` present in the parent env executes attacker code inside the spawned process (CWE-426, CWE-88, CWE-427) | `src/scripts/_lib/spawn_env.ts::hardenedSpawnEnv()` scrubs the code-execution-injection env families (deny-by-family: loader `LD_*`/`DYLD_*`/`GCONV_PATH`, git `*_COMMAND`/`GIT_EXTERNAL_DIFF`/`GIT_SSH_COMMAND`/`GIT_PAGER`/`PAGER`, runtime hooks `NODE_OPTIONS`/`BASH_ENV`/`ENV`/`PYTHON*`/`PERL5*`/`RUBYOPT`, `IFS`) and preserves the rest; wired into `clients.ts::_runSubprocess`, `roadmap_progress_hook.ts`, `hot_context_hook.ts`; falsifiable regression test in `tests/scripts/ai_council/spawn_env.test.ts` (ADR-123
|
|
19
|
+
| g | **Subprocess spawn-env inheritance** — AC's own transport spawns an external CLI (the AI-council provider CLIs; consumer-runtime hooks spawn `git`) with the full parent `process.env`, so an attacker-influenced env var in the parent becomes RCE when the child (or a `git` it invokes internally) runs | A poisoned `GIT_EXTERNAL_DIFF` / `core.pager` / `GIT_SSH_COMMAND`, the `GIT_CONFIG_COUNT`/`_KEY_<n>`/`_VALUE_<n>` config-injection trio (sets `core.fsmonitor` → shell on every `git status`), a dynamic-loader `LD_PRELOAD` / `DYLD_INSERT_LIBRARIES` / `GCONV_PATH`, `GIT_ALTERNATE_OBJECT_DIRECTORIES` / `HOSTALIASES`, or a runtime hook `NODE_OPTIONS` / `BASH_ENV` / `PYTHONSTARTUP` present in the parent env executes attacker code inside the spawned process (CWE-426, CWE-88, CWE-427) | `src/scripts/_lib/spawn_env.ts::hardenedSpawnEnv()` scrubs the code-execution-injection env families (deny-by-family: loader `LD_*`/`DYLD_*`/`GCONV_PATH`, git `*_COMMAND` + the whole `GIT_CONFIG`/`GIT_CONFIG_*` family + `GIT_ALTERNATE_OBJECT_DIRECTORIES`/`HOSTALIASES`/`GIT_EXTERNAL_DIFF`/`GIT_SSH_COMMAND`/`GIT_PAGER`/`PAGER`, runtime hooks `NODE_OPTIONS`/`BASH_ENV`/`ENV`/`PYTHON*`/`PERL5*`/`RUBYOPT`, `IFS`) and preserves the rest; wired into ALL consumer-runtime spawns — `clients.ts::_runSubprocess`, `hooks/dispatch_hook.ts`, `roadmap_progress_hook.ts`, `hot_context_hook.ts`; falsifiable regression test in `tests/scripts/ai_council/spawn_env.test.ts` (ADR-123 + 2026-07-21 follow-up) | — (consumer-runtime surface fully hardened; maintainer/CI/install sites are env-controlled, not attacker-influenced) | Spawn sites classified in `docs/spawn-site-policy.md` (Consumer Runtime MUST harden / Maintainer / CI / install exempt with rationale); the deferred lint was rejected — the policy doc is the self-enforcing substitute |
|
|
20
20
|
|
|
21
21
|
## Review cadence
|
|
22
22
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@event4u/agent-config",
|
|
3
|
-
"version": "9.
|
|
4
|
-
"description": "Universal AI Agent OS — audited skills, governance rules, commands
|
|
3
|
+
"version": "9.7.0",
|
|
4
|
+
"description": "Universal AI Agent OS — audited skills, governance rules, commands and templates for AI coding tools (Claude Code, Cursor, Windsurf, Copilot).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
7
7
|
"type": "module",
|
package/src/agent-src/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Agent Infrastructure
|
|
2
2
|
|
|
3
3
|
> **⚠️ DO NOT edit files in `dist/agent-src/` or `.augment/` directly.**
|
|
4
|
-
> The source of truth is
|
|
5
|
-
> See
|
|
4
|
+
> The source of truth is `src/` (`src/skills/`, `src/rules/`, `src/agent-src/`). Edit there, then run `task sync`.
|
|
5
|
+
> See the `source-of-truth` rule and the `/condense` command for the full workflow.
|
|
6
6
|
|
|
7
7
|
This directory contains the shared agent infrastructure: skills, commands, rules, guidelines,
|
|
8
8
|
templates, and contexts that power the AI coding assistant across all projects.
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deterministic scorer for the adversarial-council residual-detection benchmark
|
|
3
|
+
* (road-to-adversarial-council-benchmark Phase 1).
|
|
4
|
+
*
|
|
5
|
+
* Pure + countable — never LLM-computed (the anti-lesson from ADR-122). Given a
|
|
6
|
+
* corpus item's ground truth and a reviewer's structured findings, decide
|
|
7
|
+
* whether the reviewer CAUGHT the planted defect (for a defect fixture) or
|
|
8
|
+
* raised a FALSE POSITIVE (for a clean control). The two-stage recalls and FP
|
|
9
|
+
* rates this produces feed `evaluateCouncilBench` (adversarial_council_gate.ts).
|
|
10
|
+
*
|
|
11
|
+
* Matching rule (deliberately NOT exact file:line — the scorer bug from the
|
|
12
|
+
* earlier defect-finding benchmark required an exact line token and mis-scored
|
|
13
|
+
* genuine catches that cited a nearby line): a finding CATCHES a planted defect
|
|
14
|
+
* iff it names one of the defect's file(s) by basename AND its category falls in
|
|
15
|
+
* the same normalized family as the planted defect. Line numbers are advisory,
|
|
16
|
+
* never required. This credits a real catch that localizes the right file +
|
|
17
|
+
* defect class, and denies credit for a scattershot "something's wrong here"
|
|
18
|
+
* with the wrong class.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/** Normalize a free-form category string to a coarse family. */
|
|
22
|
+
export function categoryFamily(raw: string): string {
|
|
23
|
+
const c = raw.toLowerCase().replace(/[^a-z]/g, '');
|
|
24
|
+
if (/(accesscontrol|authz|authorization|idor|bola|ownership|privilege|rbac)/.test(c)) return 'access-control';
|
|
25
|
+
if (/(auth|authentication|session|credential|login)/.test(c)) return 'auth';
|
|
26
|
+
if (/(ssrf|serverside)/.test(c)) return 'ssrf';
|
|
27
|
+
if (/(pathtraversal|traversal|directorytraversal|lfi)/.test(c)) return 'path-traversal';
|
|
28
|
+
// NB: no bare "rce" token — it substring-matches inside "resou[rce]leak".
|
|
29
|
+
if (/(injection|sqli|xss|commandinjection|deserial|remotecodeexec)/.test(c)) return 'injection';
|
|
30
|
+
if (/(crypto|cryptographic|timing|constanttime|hash|signature)/.test(c)) return 'crypto';
|
|
31
|
+
if (/(concurrency|race|atomic|deadlock|idempoten)/.test(c)) return 'concurrency';
|
|
32
|
+
if (/(resourceleak|leak|memory|handle|unsubscrib|cleanup)/.test(c)) return 'resource-leak';
|
|
33
|
+
if (/(dataintegrity|integrity|corrupt|consistency|stale)/.test(c)) return 'data-integrity';
|
|
34
|
+
if (/(correctness|logic|offbyone|boundary|edgecase|bug)/.test(c)) return 'correctness';
|
|
35
|
+
return 'other';
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface Finding {
|
|
39
|
+
/** File the finding points at (any path form; matched by basename). */
|
|
40
|
+
file: string;
|
|
41
|
+
/** Reviewer-supplied category (free text; normalized via categoryFamily). */
|
|
42
|
+
category: string;
|
|
43
|
+
/** Reviewer confidence, if given. Low-confidence findings can be excluded from FP counting. */
|
|
44
|
+
confidence?: 'high' | 'medium' | 'low';
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface GroundTruth {
|
|
48
|
+
id: string;
|
|
49
|
+
/** true = clean control (no defect); a finding here is a false positive. */
|
|
50
|
+
is_clean: boolean;
|
|
51
|
+
/** Basenames of the file(s) the planted defect lives in (empty for clean). */
|
|
52
|
+
defect_files: string[];
|
|
53
|
+
/** Planted defect category family (via categoryFamily); empty for clean. */
|
|
54
|
+
defect_category: string;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function basename(p: string): string {
|
|
58
|
+
return p.split(/[\\/]/).pop() ?? p;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Did the reviewer CATCH the planted defect? file-basename match on any defect
|
|
63
|
+
* file AND category-family match. Clean controls always return false (they have
|
|
64
|
+
* no defect to catch — use `isFalsePositive` for them).
|
|
65
|
+
*/
|
|
66
|
+
export function caughtDefect(truth: GroundTruth, findings: Finding[]): boolean {
|
|
67
|
+
if (truth.is_clean) return false;
|
|
68
|
+
const wantFiles = new Set(truth.defect_files.map(basename));
|
|
69
|
+
const wantFamily = truth.defect_category;
|
|
70
|
+
return findings.some(
|
|
71
|
+
(f) => wantFiles.has(basename(f.file)) && categoryFamily(f.category) === wantFamily,
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Did the reviewer raise a FALSE POSITIVE on a clean control? Any finding that
|
|
77
|
+
* points at the control file counts (a claimed defect where none exists).
|
|
78
|
+
* Low-confidence findings are excluded — a hedged "might check X" is not a FP
|
|
79
|
+
* claim. Non-clean fixtures always return false.
|
|
80
|
+
*/
|
|
81
|
+
export function isFalsePositive(truth: GroundTruth, findings: Finding[]): boolean {
|
|
82
|
+
if (!truth.is_clean) return false;
|
|
83
|
+
return findings.some((f) => (f.confidence ?? 'high') !== 'low');
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface StageResult {
|
|
87
|
+
/** Per-defect-fixture: id → caught?. Excludes clean controls. */
|
|
88
|
+
caught: Record<string, boolean>;
|
|
89
|
+
/** Per-clean-control: id → false-positive?. */
|
|
90
|
+
fp: Record<string, boolean>;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** Recall over a set of defect ids, given per-id caught flags. */
|
|
94
|
+
export function recall(caught: Record<string, boolean>): number {
|
|
95
|
+
const ids = Object.keys(caught);
|
|
96
|
+
if (ids.length === 0) return 0;
|
|
97
|
+
const hits = ids.filter((id) => caught[id]).length;
|
|
98
|
+
return hits / ids.length;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** FP rate over clean controls. */
|
|
102
|
+
export function fpRate(fp: Record<string, boolean>): number {
|
|
103
|
+
const ids = Object.keys(fp);
|
|
104
|
+
if (ids.length === 0) return 0;
|
|
105
|
+
return ids.filter((id) => fp[id]).length / ids.length;
|
|
106
|
+
}
|
|
@@ -14,6 +14,11 @@
|
|
|
14
14
|
* - git command-injection (CWE-88): GIT_EXTERNAL_DIFF, GIT_SSH,
|
|
15
15
|
* GIT_SSH_COMMAND, GIT_PROXY_COMMAND, any GIT_*_COMMAND, GIT_PAGER, PAGER —
|
|
16
16
|
* git runs these as shell commands (`core.pager` / external-diff RCE).
|
|
17
|
+
* - git config-injection (CWE-88): the GIT_CONFIG* family (GIT_CONFIG,
|
|
18
|
+
* GIT_CONFIG_GLOBAL/_SYSTEM, and inline GIT_CONFIG_COUNT / GIT_CONFIG_KEY_<n>
|
|
19
|
+
* / GIT_CONFIG_VALUE_<n>) sets ANY git config — `core.fsmonitor` runs shell
|
|
20
|
+
* on every `git status`; GIT_ALTERNATE_OBJECT_DIRECTORIES / HOSTALIASES
|
|
21
|
+
* redirect object stores / hostname resolution.
|
|
17
22
|
* - runtime auto-exec hooks: NODE_OPTIONS (`--require attacker.js`),
|
|
18
23
|
* BASH_ENV / ENV (sourced by non-interactive shells), PYTHONPATH /
|
|
19
24
|
* PYTHONSTARTUP / PYTHONINSPECT, PERL5OPT / PERL5LIB, RUBYOPT.
|
|
@@ -45,6 +50,13 @@ const DENY_EXACT: ReadonlySet<string> = new Set([
|
|
|
45
50
|
'GIT_PROXY_COMMAND',
|
|
46
51
|
'GIT_PAGER',
|
|
47
52
|
'PAGER',
|
|
53
|
+
// git config-injection: GIT_ALTERNATE_OBJECT_DIRECTORIES can point git at
|
|
54
|
+
// attacker-controlled object stores; the GIT_CONFIG* family is handled by
|
|
55
|
+
// prefix below (it is a general arbitrary-config-injection primitive).
|
|
56
|
+
'GIT_ALTERNATE_OBJECT_DIRECTORIES',
|
|
57
|
+
// resolver hijack: HOSTALIASES remaps hostnames via an attacker file,
|
|
58
|
+
// redirecting any network fetch the child performs (CWE-427-adjacent).
|
|
59
|
+
'HOSTALIASES',
|
|
48
60
|
// runtime auto-exec hooks
|
|
49
61
|
'NODE_OPTIONS',
|
|
50
62
|
'BASH_ENV',
|
|
@@ -61,14 +73,22 @@ const DENY_EXACT: ReadonlySet<string> = new Set([
|
|
|
61
73
|
|
|
62
74
|
/**
|
|
63
75
|
* Prefix families removed by pattern. `LD_` / `DYLD_` cover loader variants we
|
|
64
|
-
* did not enumerate; `GIT_*_COMMAND` covers every git config-command hook
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
76
|
+
* did not enumerate; `GIT_*_COMMAND` covers every git config-command hook; the
|
|
77
|
+
* `GIT_CONFIG` family (GIT_CONFIG, GIT_CONFIG_GLOBAL, GIT_CONFIG_SYSTEM, and the
|
|
78
|
+
* inline GIT_CONFIG_COUNT / GIT_CONFIG_KEY_<n> / GIT_CONFIG_VALUE_<n> trio) is a
|
|
79
|
+
* general arbitrary-config-injection primitive — an attacker can set ANY git
|
|
80
|
+
* config key, e.g. `core.fsmonitor` / `core.pager` / `core.sshCommand` /
|
|
81
|
+
* `core.hooksPath` / `alias.*`, all of which git executes as shell on ordinary
|
|
82
|
+
* operations (`git status` alone runs `core.fsmonitor`). The plain `GIT_*_COMMAND`
|
|
83
|
+
* check missed it (no `_COMMAND` suffix), so it is denied by its own prefix.
|
|
84
|
+
* (GIT_ASKPASS is intentionally NOT denied — it is a path, not a shell command,
|
|
85
|
+
* and legitimate credential helpers need it; the *_COMMAND family is the
|
|
86
|
+
* shell-executed one.)
|
|
68
87
|
*/
|
|
69
88
|
function isDeniedByFamily(name: string): boolean {
|
|
70
89
|
if (name.startsWith('LD_') || name.startsWith('DYLD_')) return true;
|
|
71
90
|
if (name.startsWith('GIT_') && name.endsWith('_COMMAND')) return true;
|
|
91
|
+
if (name === 'GIT_CONFIG' || name.startsWith('GIT_CONFIG_')) return true;
|
|
72
92
|
return false;
|
|
73
93
|
}
|
|
74
94
|
|