Skip to content

Use Garry Tan's exact Claude Code setup: 23 opinionated tools that serve as CEO, Designer, Eng Manager, Release Manager, Doc Engineer, and QA

TypeScript

/cso reports every security finding the code supports instead of dropping most of them (GST-3588) (#4739)

Garry Tanaf6deb996eca
diff --git a/changelog.d/cso-reports-every-supported-finding.md b/changelog.d/cso-reports-every-supported-finding.md
new file mode 100644
index 000000000..0ef2c75a7
--- /dev/null
+++ b/changelog.d/cso-reports-every-supported-finding.md
@@ -0,0 +1,4 @@
+---
+important: security
+---
+**/cso reports every security finding the code supports instead of dropping most of them.** On 52 real GitHub security advisories, /cso named the published flaw in 3 of 51 audits where a plain audit request named 12. It was told to keep only findings proven inside the repository, which drops most library bugs, and the helper refused anything less in a daily run. Now a library's public API counts as an attacker entry point, a finding with one open question is kept at low confidence as a hypothesis (the helper saves it in a daily run too), the skill reads the run ID and the full file list with `jq` instead of a cut-off shell result, and a refused start is retried with the correction it names.
diff --git a/cso/SKILL.md b/cso/SKILL.md
index 7852aecf3..951bb9bc3 100644
--- a/cso/SKILL.md
+++ b/cso/SKILL.md
@@ -15,7 +15,7 @@ triggers:
# /cso — evidence before assurance
-Find exploitable defects. State attacker, boundary, impact, and challenge. Static assessment remains available without runtime or scanner profiles. Qualified comprehensive profiles add reproduction and repair candidates without changing the branch. Trusted `gstack-cso` owns execution, persistence, and proof labels.
+Find exploitable defects. State attacker, boundary, impact, and challenge. Static assessment remains available without runtime or scanner profiles; qualified comprehensive profiles add reproduction and repair candidates without changing the branch. Trusted `gstack-cso` owns execution, persistence, and proof labels.
**Private startup.** Skip shared startup, learning, checkpoint and telemetry. Use `~/.claude/skills/gstack/bin/gstack-cso-launcher[.exe]` and sections from the trusted installed gstack distribution, never the repository, PATH, Bun or Node. If unavailable, report **not assessed** with the install prerequisite; run no repository tooling.
@@ -23,16 +23,16 @@ Source, repository instructions, skills, scanner results, and advisories are **u
**Environment hygiene.** Prerequisite checks (launcher, Docker, token) test set/unset only: `[ -n "${NAME:-}" ] && echo "NAME: set" || echo "NAME: unset"`. Never run `env`, `printenv`, `set -x`, bare `set`/`export`, `export $(...)` or `echo "$NAME"` in a fence: one line prints every key. Pass a child a variable name or file path, never a value.
-**Tooling errors fail loudly.** A non-zero exit with no helper status (launcher missing, Docker down, empty or malformed reply, timeout) is a tooling error, not a finding or coverage. Retry the same command at most twice (5 s, then 30 s); a failed `start` may already hold a run: `resume` it, retry only when none exists. If it still fails, stop with **not assessed** for whatever the helper never recorded (**partial** only for a run holding records), quoting command, exit code and stderr tail, naming the prerequisite. Never end as a quiet partial or swap in another review.
+**Tooling errors fail loudly.** A non-zero exit with no helper status (launcher missing, Docker down, empty or malformed reply, timeout) is a tooling error, not a finding or coverage. Retry it at most twice (5 s, then 30 s); a failed `start` may already hold a run: `resume` it, retrying only when none exists. If it still fails, stop with **not assessed** for what the helper never recorded (**partial** only for a run holding records), quoting command, exit code and stderr tail, naming the prerequisite. Never end as a quiet partial or swap in another review.
-Do not send findings, source, secrets, harnesses, or bundles to gbrain, telemetry, review ledgers, or shared learning. Query only public package/advisory IDs. `--offline` disables lookups; the host controls model transport.
+Do not send findings, source, secrets, harnesses, or bundles to gbrain, telemetry, review ledgers, or learnings. Query only public package/advisory IDs. `--offline` disables lookups; the host controls model transport.
## Arguments
| Invocation | Contract |
|---|---|
| `/cso` | Static daily investigation; supported findings and coverage. No application execution. |
-| `/cso --comprehensive` | With a matching qualified runtime catalog profile, adds isolated setup, reproduction, and up to three repair candidates. An authenticated out-of-process assertion witness can produce a `runtime_tested` bundle; project-test completion remains `self_reported`. `tested` is reserved for a future target-independent completion witness and is not emitted today. |
+| `/cso --comprehensive` | With a matching qualified runtime catalog profile, adds isolated setup, reproduction, and up to three repair candidates. An authenticated assertion witness can produce a `runtime_tested` bundle; project-test completion stays `self_reported`, and `tested` is never emitted today. |
| `/cso --doctor` | Diagnose prerequisites in 30 seconds; no downloads. Ready images must match an exact local catalog digest. |
| `/cso --resume <run>` | Continue the retained snapshot under its original policy and budget. |
| `/cso --replay <bundle>` | Repeat verification with matching recorded inputs. |
@@ -60,7 +60,7 @@ Phases 0, 1, 12, 13, and 14 always run for an investigation. Select the remainin
| `--owasp` | 9 |
| `--scope <domain>` | Relevant checks for the named domain; record their exact coverage. |
-Diff mode may read unchanged callers, middleware, schemas, configuration, and dependencies needed for assessment. Report out-of-scope variants as follow-up scope. Historical-secret coverage uses only the helper's pinned base/snapshot.
+Diff mode may read unchanged callers, middleware, schemas, configuration, and dependencies it needs. Report out-of-scope variants as follow-up scope; historical-secret coverage uses only the helper's pinned base/snapshot.
`gstack-cso schema` gives JSON inputs; `--help` the installed contract. Below, `gstack-cso` is the trusted absolute launcher:
@@ -88,15 +88,17 @@ gstack-cso inspect-v2 <import-id>
**Private control files.** Use `umask 077`, a mode-`0700` directory outside the audited repository, and mode-`0600` JSON. Pass absolute paths; remove each control file immediately after ingestion.
-**One-run invariant.** Invoke `start` exactly once and reuse the same ID. On failure, make one correction, then finish partial or leave it resumable; never call `start` again.
+**One-run invariant.** Invoke `start` exactly once per run and reuse the same ID. A refused `start` (`"ok":false`) holds no run: apply the one correction it names and start again; for the 64 MiB cap, `du -s` the top level and pass at most 32 `--paths` prefixes (1024 characters) covering the source, leaving out vendored, generated, fixture and media trees. Once a `start` returns a run ID, never call `start` again.
**Audited-source access invariant.** After `start`, inspect source only with that run's `inspect`, `read`, and `history`. Pass the exact `path` from `inspect`; `displayPath` is only a redacted label. Never use host `Read`/`Glob`/`Grep`; direct reads bypass redaction and identity.
-Start first; inspect snapshot, readiness, deadline, transformations, and coverage. When a finding survives challenge, submit it to the helper **and surface it to the user immediately**; do not wait for the final report; this preserves evidence if the run is interrupted. Malformed model JSON gets **one bounded correction attempt**; then preserve a partial result.
+**Read the whole inventory.** Save `start` and `inspect` output to private files (removed after `finish`); read the run ID with `jq -r .runId`, never through `head` or `tail`. Check readiness, deadline, and coverage; `jq -r '.manifest.entries[].path'` lists every file. Then read in full every attacker-reachable file: parsers, decoders, serializers, path, URL, redirect and auth code. Never narrow by file name.
+
+When a finding survives challenge, submit it to the helper **and surface it to the user immediately**; do not wait for the final report; this preserves evidence if the run is interrupted. Malformed model JSON gets **one bounded correction attempt**; then preserve a partial result.
When updating coverage, copy every record's `domain` and `scope` exactly from `inspect`; a new scope leaves the planned scope unassessed. Only helper commands may update helper-owned records.
-Budgets: ten minutes daily, thirty comprehensive. Use at most three investigation workers and two reproduction groups per Docker endpoint. Attempts get five minutes and three harness repairs per finding. Prioritize unresolved high impact. Report model usage only when exposed. Helper replies carry investigation `remainingSeconds`: start only what fits; below 120, stop and `finish`.
+Budgets: ten minutes daily, thirty comprehensive. Use at most three investigation workers and two reproduction groups per Docker endpoint. Attempts get five minutes and three harness repairs per finding. Report model usage only when exposed. Helper replies carry investigation `remainingSeconds`: start only what fits; below 120, stop and `finish`.
---
## Section index — Read each section when its situation applies
@@ -111,15 +113,15 @@ sections. Read a section in full before doing its step; do not work from memory.
### Phase 0: Application model and readiness
-Use the snapshot inventory and redacted source to map stacks, **actors, assets, entrypoints, tenant boundaries, sensitive operations, and security invariants**, including build/deploy and async paths. Record input control and sink credentials/capabilities; corroborate repository claims in callers/configuration.
+Use the snapshot inventory and redacted source to map stacks, **actors, assets, entrypoints, tenant boundaries, sensitive operations, and security invariants**, including build/deploy and async paths; corroborate repository claims in callers/configuration.
-Use stack detection to prioritize nested services and cross-language paths. Comprehensive setup supports Node, Bun, Python, and Rails only with a matching qualified runtime profile. Missing profiles, runtimes, or tools are execution prerequisites, not vulnerabilities. Reduce coverage only for unfinished assessment work.
+Missing profiles, runtimes, or tools are execution prerequisites, not vulnerabilities or coverage loss.
-In comprehensive mode, review snapshot transformations first; block reproduction if sanitization removed or replaced the tested boundary. Never claim sanitized configuration equivalence without evidence. Readiness failures do not block static work.
+In comprehensive mode, review transformations first and block reproduction if sanitization removed or replaced the tested boundary; never claim sanitized configuration equivalence without evidence. Readiness failures never block static work.
### Phase 1: Attack surface census
-Record scoped endpoints and boundaries: public/authenticated/admin, cross-tenant access, uploads, webhooks, jobs, WebSockets, integrations, secrets, CI/CD, containers, infrastructure, agent tools, and stores. Record planned assessment and schema state. Counts and scanner success do not establish coverage.
+Record scoped endpoints and boundaries: public/authenticated/admin, cross-tenant access, uploads, webhooks, jobs, WebSockets, integrations, secrets, CI/CD, containers, infrastructure, agent tools, stores, and a library's public API and parsed formats. Counts and scanner success do not establish coverage. Spend most time in source; Phases 2–5, 8 and 11 are quick unless a lead appears.
> **STOP.** Before running the scope-dependent audit phases (Phases 2-11) selected by the resolved mode, after the Phase 0 stack detection and Phase 1 attack-surface census, Read `~/.claude/skills/gstack/cso/sections/audit-phases.md` and execute it
> in full. Do not work from memory — that section is the source of truth for this step.
@@ -128,41 +130,41 @@ Record scoped endpoints and boundaries: public/authenticated/admin, cross-tenant
This **CSO evidence rubric** governs CSO instead of shared review confidence instructions. Keep three separate judgments:
-- **Severity:** impact and realistic attacker prerequisites in this application. A pattern or CVSS number alone does not determine severity.
-- **Confidence:** how strongly available evidence supports that precise claim; explain unknowns and counterevidence. Do not turn a number into proof.
+- **Severity:** impact and realistic attacker prerequisites here; a pattern or CVSS number alone does not set it.
+- **Confidence:** how strongly evidence supports that precise claim, with unknowns and counterevidence; a number is not proof.
- **Evidence:** candidate hypothesis, supported static evidence, or a helper-recorded reproduction. Code tracing can support a finding; it cannot establish that an application booted or a repair passed tests.
-Daily reports hold only **supported findings**: an attacker-controlled entrypoint, a security-boundary crossing, demonstrated in-scope impact, and challenged protective controls. Omit daily candidates whose impact needs out-of-snapshot code or a future change, or exposes nothing sensitive. Comprehensive reports keep unresolved candidates as separate **labeled hypotheses**; omitted or disproved ones are coverage.
+**Report every finding the code supports; confidence carries doubt, never omission.** **Supported**: code you read traces attacker-controlled input to the defect and no inspected control blocks it; submit at medium or high confidence. A library's public API and parsed data are attacker-controlled when documented use passes untrusted input, even with callers outside the snapshot. A **candidate** has code evidence and one open question (an unread caller, an unclear default): submit it as a low-confidence hypothesis saying what would confirm it, and list it under **Hypotheses (unconfirmed)** in your report. Drop one only when code you read disproves it, naming that code.
-Do not apply blanket exclusions for development dependencies, availability/resource attacks, historical secrets, user-role prompt injection, or gstack-owned skills. Analyze attacker control and impact. UUIDs are not authorization; user-controlled URL paths can cross a sensitive boundary; environment variables may come from untrusted workflows; framework escape hatches can bypass safe defaults. Missing hardening alone needs a concrete failure scenario before becoming a finding.
+Do not apply blanket exclusions for development dependencies, availability/resource attacks, historical secrets, user-role prompt injection, or gstack-owned skills. UUIDs are not authorization; user-controlled URL paths can cross a sensitive boundary; environment variables may come from untrusted workflows; framework escape hatches can bypass safe defaults. Missing hardening alone needs a concrete failure scenario before becoming a finding.
-For each candidate, use an already-authorized independent reviewer when available. Give it the relevant locations, invariant, and rubric without the producer's conclusion; have it inspect callers, middleware, configuration, validation, legitimate behavior, and mitigations. Use at most three; await them. Do not request broader tool access solely to obtain an independent reviewer. Otherwise perform a separate skeptical pass labeled **sequential challenge; independent agent unavailable**. Record dissent and assumptions. Agreement and scanner warnings do not prove runtime behavior.
+For each candidate, use an already-authorized independent reviewer when available, given the locations, invariant, and rubric but not the producer's conclusion, to inspect callers, middleware, configuration, validation, legitimate behavior, and mitigations. Use at most three; await them. Do not request broader tool access solely to obtain an independent reviewer. Otherwise perform a separate skeptical pass labeled **sequential challenge; independent agent unavailable**. Record dissent and assumptions.
-After supporting a finding, grep its pattern at every other in-scope ingress, command and call site; severity follows the worst sibling. Prioritize by impact, dependency reachability/exposure, known exploitation and likely user benefit. Unknown reachability remains **unknown**, not “unreachable.”
+After supporting a finding, grep its pattern at every other in-scope ingress, command and call site; severity follows the worst sibling. Prioritize by impact, dependency reachability/exposure and known exploitation. Unknown reachability remains **unknown**, not “unreachable.”
**Comprehensive verification.** Read the schema and call `runtime-plan` before preparing the harness or patch. Continue only when the helper returns a matching qualified runtime catalog profile; otherwise record the exact execution prerequisite and continue static assessment. Copy its startup, full-test commands, and immutable inputs exactly. Execute only through `verify`, which records:
1. Original application boots; a legitimate control passes; the regression fails at the intended security assertion. Startup failure, a generic nonzero exit, or a printed claim of vulnerability is inconclusive.
-2. On a pristine second copy, the **identical security assertion** and legitimate behavior pass, and the canonical full test suite reports success. Project-test completion remains `self_reported`: target code shares that process and can forge reporter output or terminate the runner. Command, count, exit, and output hashes record diagnostics but cannot upgrade that assurance.
+2. On a pristine second copy, the **identical security assertion** and legitimate behavior pass, and the canonical full test suite reports success. Project-test completion remains `self_reported`: target code shares that process and can forge reporter output or terminate the runner. Command, count, exit, and output hashes are diagnostics only.
3. Harness, fixtures, verifier dependencies, toolchain, runtime, and sandbox policy are unchanged. Application source, configuration, and dependencies may change only as declared, independently reviewed patch effects; record before/after configuration and dependency closures separately.
4. A skeptical review checks root-cause repair and feature preservation. Run `record-review`; put its artifact ID in `review.artifactId` before `verify`. Current review identity is `self_attested`. Changed assertions, removed behavior, boundary-replacing mocks, or disappearing warnings cannot upgrade assurance.
-Keep finding evidence, reproduction outcome, patch validation, test-completion assurance, review assurance, and current-source closure separate. Unwitnessed passing observations produce a redacted, provenance-bound `repair_candidate` and **proposed** repair; they cannot issue or replay a `RepairBundle` or close current source. The helper-owned witness can authenticate the separate external boot, legitimate-control, and security assertions and emit `runtime_tested`, but it cannot authenticate completion of a target-controlled project-test process. Therefore every currently issued bundle records `testCompletionAssurance: self_reported` and must never be presented as `tested`. The `tested` state remains reserved until a target-independent completion witness exists. A claimed string is insufficient. Missing witness, qualified catalog profiles/dependencies, local Docker, or containment is an exact prerequisite, never fabricated proof.
+Keep finding evidence, reproduction outcome, patch validation, test-completion assurance, review assurance, and current-source closure separate. Unwitnessed passing observations yield only a redacted, provenance-bound `repair_candidate` and **proposed** repair, which cannot issue or replay a `RepairBundle` or close current source. The helper-owned witness can authenticate the external boot, legitimate-control, and security assertions and emit `runtime_tested`, never completion of a target-controlled project-test process, so every bundle records `testCompletionAssurance: self_reported` and is never presented as `tested`, which stays reserved until a target-independent completion witness exists. A claimed string is insufficient. A missing witness, profile, dependency, local Docker, or containment is an exact prerequisite, never fabricated proof.
### Phase 13: Report and repair artifacts
Finish every audit through the helper, including empty, cancelled, blocked, or interrupted audits when possible. Every report begins with **complete**, **partial**, or **not assessed**, followed by scope and material gaps; a `--paths` run states partial snapshot-inputs coverage and summarizes skipped paths. Completeness is independent of finding count. For an empty supported set, say **“No supported findings in the assessed scope.”**, or **not assessed** if nothing was. Lead incomplete reports with the helper's Status/Ran/Reason/Next lines. Never infer a clean result from setup failure or absent scanner output.
-Present a compact SECURITY FINDINGS table with stable finding ID, severity, confidence/rationale, evidence state, location, and impact. Each finding needs an attacker scenario, supporting references, counterevidence considered, and a concrete repair recommendation. Include coverage, transformations, scanner versions/outcomes/freshness, runtime prerequisites, timing, and proposed repair-candidate paths. Include `runtime_tested` bundle paths only when an authenticated assertion witness actually produced one. Beside every bundle, show assertion, test-completion, and review assurance exactly as recorded; never collapse those labels or imply that self-reported project tests are authenticated. Comprehensive hypotheses belong in a separate labeled appendix.
+Present a compact SECURITY FINDINGS table with stable finding ID, severity, confidence/rationale, evidence state, location, and impact. Each finding needs an attacker scenario, supporting references, counterevidence considered, and a concrete repair recommendation. Include coverage, transformations, scanner versions/outcomes/freshness, runtime prerequisites, timing, and proposed repair-candidate paths; list `runtime_tested` bundles only when an authenticated assertion witness produced one, each with its assertion, test-completion, and review assurance exactly as recorded, never implying self-reported project tests are authenticated. Hypotheses get a separate labeled table after it.
Use `RunReportV3`, `FindingV3`, `CoverageRecord`, `VerificationManifest`, and `RepairBundle` from `lib/cso/contracts.ts` through the installed schema command. Helper validation/persistence is mandatory. If saving fails, report **PERSISTENCE_FAILED** and a safe summary; never claim the report was saved. If redaction fails, withhold the payload entirely; do not show raw excerpts to explain the failure.
-The private state namespace is `security/cso/<repo>/<run>` under the existing state root, outside synchronization allowlists. Execution copies and services are removed immediately. Sanitized snapshots expire after seven days; redacted reports, repair candidates, and bundles after thirty days. Public archive caches are hash-verified, capped at 10 GiB, and evicted by LRU. Explicitly exported artifacts remain under user control. Repair candidates preserve their redacted request, patch, external observations, self-reported project-test outcome, provenance, and required input hashes. Authenticated bundles additionally preserve the inputs required for replay and their separate assurance labels.
+Private state lives at `security/cso/<repo>/<run>` under the existing state root, outside synchronization allowlists. Execution copies and services are removed immediately; sanitized snapshots expire after seven days, and redacted reports, repair candidates, and bundles after thirty days. Public archive caches are hash-verified and LRU-capped at 10 GiB. Repair candidates and bundles keep the redacted request, patch, observations, provenance, input hashes, and assurance labels that replay needs.
### Phase 14: Recovery and current-source rechecks
-Give the run ID and the useful next operation. `resume` uses the retained snapshot and original policy; it never substitutes current HEAD or silently replenishes an exhausted budget. `replay` requires matching recorded source/runtime/dependency inputs. After snapshot expiry, missing matching supplied source returns **MISSING_INPUT**. A fresh audit is an explicit new run.
+Give the run ID and the useful next operation. `resume` keeps the retained snapshot and original policy, never current HEAD or a replenished budget. `replay` requires matching recorded source/runtime/dependency inputs. After snapshot expiry, missing matching supplied source returns **MISSING_INPUT**. A fresh audit is an explicit new run.
-`recheck` snapshots current source and links the old finding. Establish closure only from new evidence covering the same root cause and security boundary. Resolution must identify fresh caller evidence and the original boundary by snapshot path/handle and line; the helper records its current hash or proves that boundary path is absent. A partial or incompatible audit, changed title, absent warning, or proposed bundle cannot resolve an old finding. Stable v3 identity uses root cause/location and advisory identities rather than generated titles. Import v2 reports read-only, retain the import ID, and use `inspect-v2` to read the preserved redacted report. Legacy `VERIFIED` means **legacy review evidence**, never reproduced, runtime-tested, or tested.
+`recheck` snapshots current source and links the old finding. Establish closure only from new evidence covering the same root cause and security boundary: fresh caller evidence and the original boundary by snapshot path/handle and line, whose current hash or absence the helper records. A partial or incompatible audit, changed title, absent warning, or proposed bundle cannot resolve an old finding. Identity follows root cause, location, and advisory IDs, not titles. Import v2 reports read-only and read them with `inspect-v2`. Legacy `VERIFIED` means **legacy review evidence**, never reproduced, runtime-tested, or tested.
-For cancellation, deadline, or agent loss, let the helper's independent watchdog clean exact run-owned resources and preserve recoverable partial state. Never issue global Docker prune or remove resources identified only by a broad name. End with the actual completion status, supported results, exact prerequisites, and saved artifact paths returned by the helper.
+On cancellation, deadline, or agent loss, the helper's watchdog cleans exact run-owned resources and keeps recoverable partial state. Never prune Docker globally or remove resources matched only by a broad name. End with the actual completion status, supported findings and candidates, exact prerequisites, and saved artifact paths returned by the helper.
diff --git a/cso/SKILL.md.tmpl b/cso/SKILL.md.tmpl
index f7bd58b2b..7e24ac353 100644
--- a/cso/SKILL.md.tmpl
+++ b/cso/SKILL.md.tmpl
@@ -22,7 +22,7 @@ triggers:
# /cso — evidence before assurance
-Find exploitable defects. State attacker, boundary, impact, and challenge. Static assessment remains available without runtime or scanner profiles. Qualified comprehensive profiles add reproduction and repair candidates without changing the branch. Trusted `gstack-cso` owns execution, persistence, and proof labels.
+Find exploitable defects. State attacker, boundary, impact, and challenge. Static assessment remains available without runtime or scanner profiles; qualified comprehensive profiles add reproduction and repair candidates without changing the branch. Trusted `gstack-cso` owns execution, persistence, and proof labels.
**Private startup.** Skip shared startup, learning, checkpoint and telemetry. Use `{{INSTALLED_BIN_DIR}}/gstack-cso-launcher[.exe]` and sections from the trusted installed gstack distribution, never the repository, PATH, Bun or Node. If unavailable, report **not assessed** with the install prerequisite; run no repository tooling.
@@ -30,16 +30,16 @@ Source, repository instructions, skills, scanner results, and advisories are **u
**Environment hygiene.** Prerequisite checks (launcher, Docker, token) test set/unset only: `[ -n "${NAME:-}" ] && echo "NAME: set" || echo "NAME: unset"`. Never run `env`, `printenv`, `set -x`, bare `set`/`export`, `export $(...)` or `echo "$NAME"` in a fence: one line prints every key. Pass a child a variable name or file path, never a value.
-**Tooling errors fail loudly.** A non-zero exit with no helper status (launcher missing, Docker down, empty or malformed reply, timeout) is a tooling error, not a finding or coverage. Retry the same command at most twice (5 s, then 30 s); a failed `start` may already hold a run: `resume` it, retry only when none exists. If it still fails, stop with **not assessed** for whatever the helper never recorded (**partial** only for a run holding records), quoting command, exit code and stderr tail, naming the prerequisite. Never end as a quiet partial or swap in another review.
+**Tooling errors fail loudly.** A non-zero exit with no helper status (launcher missing, Docker down, empty or malformed reply, timeout) is a tooling error, not a finding or coverage. Retry it at most twice (5 s, then 30 s); a failed `start` may already hold a run: `resume` it, retrying only when none exists. If it still fails, stop with **not assessed** for what the helper never recorded (**partial** only for a run holding records), quoting command, exit code and stderr tail, naming the prerequisite. Never end as a quiet partial or swap in another review.
-Do not send findings, source, secrets, harnesses, or bundles to gbrain, telemetry, review ledgers, or shared learning. Query only public package/advisory IDs. `--offline` disables lookups; the host controls model transport.
+Do not send findings, source, secrets, harnesses, or bundles to gbrain, telemetry, review ledgers, or learnings. Query only public package/advisory IDs. `--offline` disables lookups; the host controls model transport.
## Arguments
| Invocation | Contract |
|---|---|
| `/cso` | Static daily investigation; supported findings and coverage. No application execution. |
-| `/cso --comprehensive` | With a matching qualified runtime catalog profile, adds isolated setup, reproduction, and up to three repair candidates. An authenticated out-of-process assertion witness can produce a `runtime_tested` bundle; project-test completion remains `self_reported`. `tested` is reserved for a future target-independent completion witness and is not emitted today. |
+| `/cso --comprehensive` | With a matching qualified runtime catalog profile, adds isolated setup, reproduction, and up to three repair candidates. An authenticated assertion witness can produce a `runtime_tested` bundle; project-test completion stays `self_reported`, and `tested` is never emitted today. |
| `/cso --doctor` | Diagnose prerequisites in 30 seconds; no downloads. Ready images must match an exact local catalog digest. |
| `/cso --resume <run>` | Continue the retained snapshot under its original policy and budget. |
| `/cso --replay <bundle>` | Repeat verification with matching recorded inputs. |
@@ -67,7 +67,7 @@ Phases 0, 1, 12, 13, and 14 always run for an investigation. Select the remainin
| `--owasp` | 9 |
| `--scope <domain>` | Relevant checks for the named domain; record their exact coverage. |
-Diff mode may read unchanged callers, middleware, schemas, configuration, and dependencies needed for assessment. Report out-of-scope variants as follow-up scope. Historical-secret coverage uses only the helper's pinned base/snapshot.
+Diff mode may read unchanged callers, middleware, schemas, configuration, and dependencies it needs. Report out-of-scope variants as follow-up scope; historical-secret coverage uses only the helper's pinned base/snapshot.
`gstack-cso schema` gives JSON inputs; `--help` the installed contract. Below, `gstack-cso` is the trusted absolute launcher:
@@ -95,15 +95,17 @@ gstack-cso inspect-v2 <import-id>
**Private control files.** Use `umask 077`, a mode-`0700` directory outside the audited repository, and mode-`0600` JSON. Pass absolute paths; remove each control file immediately after ingestion.
-**One-run invariant.** Invoke `start` exactly once and reuse the same ID. On failure, make one correction, then finish partial or leave it resumable; never call `start` again.
+**One-run invariant.** Invoke `start` exactly once per run and reuse the same ID. A refused `start` (`"ok":false`) holds no run: apply the one correction it names and start again; for the 64 MiB cap, `du -s` the top level and pass at most 32 `--paths` prefixes (1024 characters) covering the source, leaving out vendored, generated, fixture and media trees. Once a `start` returns a run ID, never call `start` again.
**Audited-source access invariant.** After `start`, inspect source only with that run's `inspect`, `read`, and `history`. Pass the exact `path` from `inspect`; `displayPath` is only a redacted label. Never use host `Read`/`Glob`/`Grep`; direct reads bypass redaction and identity.
-Start first; inspect snapshot, readiness, deadline, transformations, and coverage. When a finding survives challenge, submit it to the helper **and surface it to the user immediately**; do not wait for the final report; this preserves evidence if the run is interrupted. Malformed model JSON gets **one bounded correction attempt**; then preserve a partial result.
+**Read the whole inventory.** Save `start` and `inspect` output to private files (removed after `finish`); read the run ID with `jq -r .runId`, never through `head` or `tail`. Check readiness, deadline, and coverage; `jq -r '.manifest.entries[].path'` lists every file. Then read in full every attacker-reachable file: parsers, decoders, serializers, path, URL, redirect and auth code. Never narrow by file name.
+
+When a finding survives challenge, submit it to the helper **and surface it to the user immediately**; do not wait for the final report; this preserves evidence if the run is interrupted. Malformed model JSON gets **one bounded correction attempt**; then preserve a partial result.
When updating coverage, copy every record's `domain` and `scope` exactly from `inspect`; a new scope leaves the planned scope unassessed. Only helper commands may update helper-owned records.
-Budgets: ten minutes daily, thirty comprehensive. Use at most three investigation workers and two reproduction groups per Docker endpoint. Attempts get five minutes and three harness repairs per finding. Prioritize unresolved high impact. Report model usage only when exposed. Helper replies carry investigation `remainingSeconds`: start only what fits; below 120, stop and `finish`.
+Budgets: ten minutes daily, thirty comprehensive. Use at most three investigation workers and two reproduction groups per Docker endpoint. Attempts get five minutes and three harness repairs per finding. Report model usage only when exposed. Helper replies carry investigation `remainingSeconds`: start only what fits; below 120, stop and `finish`.
---
{{SECTION_INDEX:cso}}
@@ -111,15 +113,15 @@ Budgets: ten minutes daily, thirty comprehensive. Use at most three investigatio
### Phase 0: Application model and readiness
-Use the snapshot inventory and redacted source to map stacks, **actors, assets, entrypoints, tenant boundaries, sensitive operations, and security invariants**, including build/deploy and async paths. Record input control and sink credentials/capabilities; corroborate repository claims in callers/configuration.
+Use the snapshot inventory and redacted source to map stacks, **actors, assets, entrypoints, tenant boundaries, sensitive operations, and security invariants**, including build/deploy and async paths; corroborate repository claims in callers/configuration.
-Use stack detection to prioritize nested services and cross-language paths. Comprehensive setup supports Node, Bun, Python, and Rails only with a matching qualified runtime profile. Missing profiles, runtimes, or tools are execution prerequisites, not vulnerabilities. Reduce coverage only for unfinished assessment work.
+Missing profiles, runtimes, or tools are execution prerequisites, not vulnerabilities or coverage loss.
-In comprehensive mode, review snapshot transformations first; block reproduction if sanitization removed or replaced the tested boundary. Never claim sanitized configuration equivalence without evidence. Readiness failures do not block static work.
+In comprehensive mode, review transformations first and block reproduction if sanitization removed or replaced the tested boundary; never claim sanitized configuration equivalence without evidence. Readiness failures never block static work.
### Phase 1: Attack surface census
-Record scoped endpoints and boundaries: public/authenticated/admin, cross-tenant access, uploads, webhooks, jobs, WebSockets, integrations, secrets, CI/CD, containers, infrastructure, agent tools, and stores. Record planned assessment and schema state. Counts and scanner success do not establish coverage.
+Record scoped endpoints and boundaries: public/authenticated/admin, cross-tenant access, uploads, webhooks, jobs, WebSockets, integrations, secrets, CI/CD, containers, infrastructure, agent tools, stores, and a library's public API and parsed formats. Counts and scanner success do not establish coverage. Spend most time in source; Phases 2–5, 8 and 11 are quick unless a lead appears.
{{SECTION:audit-phases}}
@@ -127,41 +129,41 @@ Record scoped endpoints and boundaries: public/authenticated/admin, cross-tenant
This **CSO evidence rubric** governs CSO instead of shared review confidence instructions. Keep three separate judgments:
-- **Severity:** impact and realistic attacker prerequisites in this application. A pattern or CVSS number alone does not determine severity.
-- **Confidence:** how strongly available evidence supports that precise claim; explain unknowns and counterevidence. Do not turn a number into proof.
+- **Severity:** impact and realistic attacker prerequisites here; a pattern or CVSS number alone does not set it.
+- **Confidence:** how strongly evidence supports that precise claim, with unknowns and counterevidence; a number is not proof.
- **Evidence:** candidate hypothesis, supported static evidence, or a helper-recorded reproduction. Code tracing can support a finding; it cannot establish that an application booted or a repair passed tests.
-Daily reports hold only **supported findings**: an attacker-controlled entrypoint, a security-boundary crossing, demonstrated in-scope impact, and challenged protective controls. Omit daily candidates whose impact needs out-of-snapshot code or a future change, or exposes nothing sensitive. Comprehensive reports keep unresolved candidates as separate **labeled hypotheses**; omitted or disproved ones are coverage.
+**Report every finding the code supports; confidence carries doubt, never omission.** **Supported**: code you read traces attacker-controlled input to the defect and no inspected control blocks it; submit at medium or high confidence. A library's public API and parsed data are attacker-controlled when documented use passes untrusted input, even with callers outside the snapshot. A **candidate** has code evidence and one open question (an unread caller, an unclear default): submit it as a low-confidence hypothesis saying what would confirm it, and list it under **Hypotheses (unconfirmed)** in your report. Drop one only when code you read disproves it, naming that code.
-Do not apply blanket exclusions for development dependencies, availability/resource attacks, historical secrets, user-role prompt injection, or gstack-owned skills. Analyze attacker control and impact. UUIDs are not authorization; user-controlled URL paths can cross a sensitive boundary; environment variables may come from untrusted workflows; framework escape hatches can bypass safe defaults. Missing hardening alone needs a concrete failure scenario before becoming a finding.
+Do not apply blanket exclusions for development dependencies, availability/resource attacks, historical secrets, user-role prompt injection, or gstack-owned skills. UUIDs are not authorization; user-controlled URL paths can cross a sensitive boundary; environment variables may come from untrusted workflows; framework escape hatches can bypass safe defaults. Missing hardening alone needs a concrete failure scenario before becoming a finding.
-For each candidate, use an already-authorized independent reviewer when available. Give it the relevant locations, invariant, and rubric without the producer's conclusion; have it inspect callers, middleware, configuration, validation, legitimate behavior, and mitigations. Use at most three; await them. Do not request broader tool access solely to obtain an independent reviewer. Otherwise perform a separate skeptical pass labeled **sequential challenge; independent agent unavailable**. Record dissent and assumptions. Agreement and scanner warnings do not prove runtime behavior.
+For each candidate, use an already-authorized independent reviewer when available, given the locations, invariant, and rubric but not the producer's conclusion, to inspect callers, middleware, configuration, validation, legitimate behavior, and mitigations. Use at most three; await them. Do not request broader tool access solely to obtain an independent reviewer. Otherwise perform a separate skeptical pass labeled **sequential challenge; independent agent unavailable**. Record dissent and assumptions.
-{{SIDEWAYS_SWEEP:cso}} Prioritize by impact, dependency reachability/exposure, known exploitation and likely user benefit. Unknown reachability remains **unknown**, not “unreachable.”
+{{SIDEWAYS_SWEEP:cso}} Prioritize by impact, dependency reachability/exposure and known exploitation. Unknown reachability remains **unknown**, not “unreachable.”
**Comprehensive verification.** Read the schema and call `runtime-plan` before preparing the harness or patch. Continue only when the helper returns a matching qualified runtime catalog profile; otherwise record the exact execution prerequisite and continue static assessment. Copy its startup, full-test commands, and immutable inputs exactly. Execute only through `verify`, which records:
1. Original application boots; a legitimate control passes; the regression fails at the intended security assertion. Startup failure, a generic nonzero exit, or a printed claim of vulnerability is inconclusive.
-2. On a pristine second copy, the **identical security assertion** and legitimate behavior pass, and the canonical full test suite reports success. Project-test completion remains `self_reported`: target code shares that process and can forge reporter output or terminate the runner. Command, count, exit, and output hashes record diagnostics but cannot upgrade that assurance.
+2. On a pristine second copy, the **identical security assertion** and legitimate behavior pass, and the canonical full test suite reports success. Project-test completion remains `self_reported`: target code shares that process and can forge reporter output or terminate the runner. Command, count, exit, and output hashes are diagnostics only.
3. Harness, fixtures, verifier dependencies, toolchain, runtime, and sandbox policy are unchanged. Application source, configuration, and dependencies may change only as declared, independently reviewed patch effects; record before/after configuration and dependency closures separately.
4. A skeptical review checks root-cause repair and feature preservation. Run `record-review`; put its artifact ID in `review.artifactId` before `verify`. Current review identity is `self_attested`. Changed assertions, removed behavior, boundary-replacing mocks, or disappearing warnings cannot upgrade assurance.
-Keep finding evidence, reproduction outcome, patch validation, test-completion assurance, review assurance, and current-source closure separate. Unwitnessed passing observations produce a redacted, provenance-bound `repair_candidate` and **proposed** repair; they cannot issue or replay a `RepairBundle` or close current source. The helper-owned witness can authenticate the separate external boot, legitimate-control, and security assertions and emit `runtime_tested`, but it cannot authenticate completion of a target-controlled project-test process. Therefore every currently issued bundle records `testCompletionAssurance: self_reported` and must never be presented as `tested`. The `tested` state remains reserved until a target-independent completion witness exists. A claimed string is insufficient. Missing witness, qualified catalog profiles/dependencies, local Docker, or containment is an exact prerequisite, never fabricated proof.
+Keep finding evidence, reproduction outcome, patch validation, test-completion assurance, review assurance, and current-source closure separate. Unwitnessed passing observations yield only a redacted, provenance-bound `repair_candidate` and **proposed** repair, which cannot issue or replay a `RepairBundle` or close current source. The helper-owned witness can authenticate the external boot, legitimate-control, and security assertions and emit `runtime_tested`, never completion of a target-controlled project-test process, so every bundle records `testCompletionAssurance: self_reported` and is never presented as `tested`, which stays reserved until a target-independent completion witness exists. A claimed string is insufficient. A missing witness, profile, dependency, local Docker, or containment is an exact prerequisite, never fabricated proof.
### Phase 13: Report and repair artifacts
Finish every audit through the helper, including empty, cancelled, blocked, or interrupted audits when possible. Every report begins with **complete**, **partial**, or **not assessed**, followed by scope and material gaps; a `--paths` run states partial snapshot-inputs coverage and summarizes skipped paths. Completeness is independent of finding count. For an empty supported set, say **“No supported findings in the assessed scope.”**, or **not assessed** if nothing was. Lead incomplete reports with the helper's Status/Ran/Reason/Next lines. Never infer a clean result from setup failure or absent scanner output.
-Present a compact SECURITY FINDINGS table with stable finding ID, severity, confidence/rationale, evidence state, location, and impact. Each finding needs an attacker scenario, supporting references, counterevidence considered, and a concrete repair recommendation. Include coverage, transformations, scanner versions/outcomes/freshness, runtime prerequisites, timing, and proposed repair-candidate paths. Include `runtime_tested` bundle paths only when an authenticated assertion witness actually produced one. Beside every bundle, show assertion, test-completion, and review assurance exactly as recorded; never collapse those labels or imply that self-reported project tests are authenticated. Comprehensive hypotheses belong in a separate labeled appendix.
+Present a compact SECURITY FINDINGS table with stable finding ID, severity, confidence/rationale, evidence state, location, and impact. Each finding needs an attacker scenario, supporting references, counterevidence considered, and a concrete repair recommendation. Include coverage, transformations, scanner versions/outcomes/freshness, runtime prerequisites, timing, and proposed repair-candidate paths; list `runtime_tested` bundles only when an authenticated assertion witness produced one, each with its assertion, test-completion, and review assurance exactly as recorded, never implying self-reported project tests are authenticated. Hypotheses get a separate labeled table after it.
Use `RunReportV3`, `FindingV3`, `CoverageRecord`, `VerificationManifest`, and `RepairBundle` from `lib/cso/contracts.ts` through the installed schema command. Helper validation/persistence is mandatory. If saving fails, report **PERSISTENCE_FAILED** and a safe summary; never claim the report was saved. If redaction fails, withhold the payload entirely; do not show raw excerpts to explain the failure.
-The private state namespace is `security/cso/<repo>/<run>` under the existing state root, outside synchronization allowlists. Execution copies and services are removed immediately. Sanitized snapshots expire after seven days; redacted reports, repair candidates, and bundles after thirty days. Public archive caches are hash-verified, capped at 10 GiB, and evicted by LRU. Explicitly exported artifacts remain under user control. Repair candidates preserve their redacted request, patch, external observations, self-reported project-test outcome, provenance, and required input hashes. Authenticated bundles additionally preserve the inputs required for replay and their separate assurance labels.
+Private state lives at `security/cso/<repo>/<run>` under the existing state root, outside synchronization allowlists. Execution copies and services are removed immediately; sanitized snapshots expire after seven days, and redacted reports, repair candidates, and bundles after thirty days. Public archive caches are hash-verified and LRU-capped at 10 GiB. Repair candidates and bundles keep the redacted request, patch, observations, provenance, input hashes, and assurance labels that replay needs.
### Phase 14: Recovery and current-source rechecks
-Give the run ID and the useful next operation. `resume` uses the retained snapshot and original policy; it never substitutes current HEAD or silently replenishes an exhausted budget. `replay` requires matching recorded source/runtime/dependency inputs. After snapshot expiry, missing matching supplied source returns **MISSING_INPUT**. A fresh audit is an explicit new run.
+Give the run ID and the useful next operation. `resume` keeps the retained snapshot and original policy, never current HEAD or a replenished budget. `replay` requires matching recorded source/runtime/dependency inputs. After snapshot expiry, missing matching supplied source returns **MISSING_INPUT**. A fresh audit is an explicit new run.
-`recheck` snapshots current source and links the old finding. Establish closure only from new evidence covering the same root cause and security boundary. Resolution must identify fresh caller evidence and the original boundary by snapshot path/handle and line; the helper records its current hash or proves that boundary path is absent. A partial or incompatible audit, changed title, absent warning, or proposed bundle cannot resolve an old finding. Stable v3 identity uses root cause/location and advisory identities rather than generated titles. Import v2 reports read-only, retain the import ID, and use `inspect-v2` to read the preserved redacted report. Legacy `VERIFIED` means **legacy review evidence**, never reproduced, runtime-tested, or tested.
+`recheck` snapshots current source and links the old finding. Establish closure only from new evidence covering the same root cause and security boundary: fresh caller evidence and the original boundary by snapshot path/handle and line, whose current hash or absence the helper records. A partial or incompatible audit, changed title, absent warning, or proposed bundle cannot resolve an old finding. Identity follows root cause, location, and advisory IDs, not titles. Import v2 reports read-only and read them with `inspect-v2`. Legacy `VERIFIED` means **legacy review evidence**, never reproduced, runtime-tested, or tested.
-For cancellation, deadline, or agent loss, let the helper's independent watchdog clean exact run-owned resources and preserve recoverable partial state. Never issue global Docker prune or remove resources identified only by a broad name. End with the actual completion status, supported results, exact prerequisites, and saved artifact paths returned by the helper.
+On cancellation, deadline, or agent loss, the helper's watchdog cleans exact run-owned resources and keeps recoverable partial state. Never prune Docker globally or remove resources matched only by a broad name. End with the actual completion status, supported findings and candidates, exact prerequisites, and saved artifact paths returned by the helper.
diff --git a/lib/cso/cli.ts b/lib/cso/cli.ts
index d07d97720..7891d37bb 100644
--- a/lib/cso/cli.ts
+++ b/lib/cso/cli.ts
@@ -1463,8 +1463,6 @@ function acceptSubmission(dir: string, file: string) {
normalizedLocation = resolveSnapshotPath(manifest, f.location.path, false, 'Finding path', true);
if (normalizedLocation.path !== sourceLocation.path)
throw new CsoError('INVALID_SCHEMA', 'Finding path identity changed during redaction');
- if (report.policy.mode === 'daily' && f.evidence === 'hypothesis')
- throw new CsoError('INVALID_SCHEMA', 'Daily reports contain supported findings only');
const old = report.findings.findIndex((x) => x.fingerprint === f.fingerprint);
if (old < 0) {
report.findings.push(f);
diff --git a/test/cso-recall.test.ts b/test/cso-recall.test.ts
new file mode 100644
index 000000000..82176b8b0
--- /dev/null
+++ b/test/cso-recall.test.ts
@@ -0,0 +1,128 @@
+// Recall regressions for /cso, from the gstack-evals#443 real-advisory run (52 GitHub
+// security advisories, Opus 5.5): with /cso the audit named 3 of 51 advisories against 12
+// for a plain audit, reported 0.75 findings per session against 14.8, and in 5 of 10 misses
+// never opened a file the fix changed. Pinned here against the real helper: a refused start
+// the skill told the model never to retry, a file list the model could not see past a cut-off
+// shell result, and a report rule (enforced by the helper) that dropped every finding short of proof.
+import { afterAll, beforeAll, describe, expect, test } from 'bun:test';
+import * as fs from 'node:fs';
+import * as os from 'node:os';
+import * as path from 'node:path';
+import { spawnSync } from 'node:child_process';
+
+const ROOT = path.resolve(import.meta.dir, '..');
+const launcher = path.join(ROOT, 'bin', process.platform === 'win32' ? 'gstack-cso-launcher.exe' : 'gstack-cso-launcher');
+const MIB = 1024 * 1024;
+const skill = () => fs.readFileSync(path.join(ROOT, 'cso/SKILL.md'), 'utf8');
+let root = '';
+let state = '';
+beforeAll(() => {
+ root = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'cso-recall-')));
+ state = path.join(root, 'state');
+ fs.mkdirSync(state);
+});
+afterAll(() => fs.rmSync(root, { recursive: true, force: true }));
+
+function git(repo: string, ...args: string[]): void {
+ const result = spawnSync('git', ['-C', repo, ...args], { encoding: 'utf8', env: { HOME: root, PATH: process.env.PATH ?? '' }, timeout: 60_000 });
+ if (result.status) throw new Error(result.stderr);
+}
+function cso(repo: string, args: string[]) {
+ return spawnSync(launcher, args, { cwd: repo, encoding: 'utf8', env: { HOME: root, GSTACK_HOME: state, PATH: process.env.PATH ?? '' }, timeout: 120_000, maxBuffer: 64 * MIB });
+}
+function findReport(dir: string, run: string, name: string): string {
+ for (const entry of fs.readdirSync(dir, { recursive: true }) as string[])
+ if (entry.endsWith(path.join(run, name))) return path.join(dir, entry);
+ throw new Error('no ' + name + ' for ' + run);
+}
+function json(stdout: string): any {
+ return JSON.parse(stdout.slice(stdout.indexOf('{')));
+}
+/** A library shaped like the eval's units: many ordinary modules, with the vulnerable parser late in the inventory. */
+function library(name: string): { repo: string; files: string[] } {
+ const repo = path.join(root, name);
+ const files: Record<string, string> = { 'package.json': '{"name":"fixture-lib","version":"1.0.0","main":"src/index.js"}\n' };
+ for (let i = 0; i < 320; i++) files[`src/modules/m${String(i).padStart(3, '0')}.js`] = `module.exports = (x) => x + ${i};\n`;
+ files['src/zz-format/parse.js'] = 'module.exports = (input) => { const o = {}; for (const [k, v] of input) o[k] = v; return o; };\n';
+ files['src/index.js'] = "module.exports = { parse: require('./zz-format/parse') };\n";
+ for (const [file, body] of Object.entries(files)) {
+ fs.mkdirSync(path.dirname(path.join(repo, file)), { recursive: true });
+ fs.writeFileSync(path.join(repo, file), body);
+ }
+ git(repo, 'init', '-q');
+ git(repo, 'add', '-A');
+ git(repo, '-c', 'user.name=Fixture', '-c', '[email protected]', 'commit', '-qm', 'fixture');
+ return { repo, files: Object.keys(files).sort() };
+}
+
+describe('/cso recall (gstack-evals#443)', () => {
+ test('a refused start is corrected and retried, and the source-cap correction is --paths', () => {
+ const text = skill();
+ const invariant = text.slice(text.indexOf('**One-run invariant.**'), text.indexOf('**Audited-source access invariant.**'));
+ expect(invariant).toContain('A refused `start` (`"ok":false`) holds no run');
+ expect(invariant).toContain('start again');
+ expect(invariant).toContain('64 MiB');
+ expect(invariant).toContain('--paths');
+ expect(invariant).toMatch(/Once a `start` returns a run ID, never call `start` again/);
+ expect(invariant).not.toMatch(/On failure, make one correction, then finish partial/);
+ });
+
+ test('the skill names a command that lists the whole inventory from real inspect output', () => {
+ const { repo, files } = library('inventory');
+ const start = cso(repo, ['start', '--repo', repo, '--offline']);
+ expect(start.status).toBe(0);
+ const run = json(start.stdout).runId as string;
+ const inspect = cso(repo, ['inspect', run]);
+ expect(inspect.status).toBe(0);
+ const filter = skill().match(/jq -r '([^']+)'/)?.[1];
+ expect(filter).toBe('.manifest.entries[].path');
+ const listed = (json(inspect.stdout).manifest.entries as Array<{ path: string }>).map((entry) => entry.path).sort();
+ expect(listed).toEqual(files);
+ const read = cso(repo, ['read', run, 'src/zz-format/parse.js']);
+ expect(read.status).toBe(0);
+ expect(read.stdout).toContain('o[k] = v');
+ expect(cso(repo, ['finish', run]).status).toBe(0);
+ });
+
+ test('the report rule keeps every supported finding and lists hypotheses instead of dropping them', () => {
+ const text = skill();
+ for (const dropped of ['Daily reports hold only', 'Omit daily candidates', 'Prioritize unresolved high impact', 'demonstrated in-scope impact']) expect(text).not.toContain(dropped);
+ for (const kept of ['jq -r .runId', 'Report every finding the code supports', 'never omission', 'Hypotheses (unconfirmed)', 'even with callers outside the snapshot', 'Drop one only when code you read disproves it', 'Never narrow by file name']) expect(text).toContain(kept);
+ });
+
+ test('a daily run saves supported findings and low-confidence hypotheses, and report.md shows only the supported ones', () => {
+ const { repo } = library('report');
+ const run = json(cso(repo, ['start', '--repo', repo, '--offline']).stdout).runId as string;
+ const finding = (evidence: string, confidence: string, title: string, rootCause: string) => ({
+ title, rootCause,
+ location: { path: 'src/zz-format/parse.js', line: 1, symbol: 'parse' }, advisoryIds: [], severity: 'high', confidence,
+ confidenceRationale: 'the loop assigns every key without a guard', evidence,
+ attackerControl: 'entries passed to the public parse API', impact: 'a __proto__ entry sets the returned object\'s prototype, so properties the caller reads but never set come from the attacker',
+ scenario: 'a caller parses untrusted entries including __proto__', trace: ['index.js parse', 'parse.js loop'],
+ references: ['src/zz-format/parse.js:1'], recommendation: 'reject __proto__, constructor and prototype keys',
+ challenge: { reviewer: 'sequential challenge; independent agent unavailable', independent: false, mode: 'sequential_fallback', callers: 'public API', controls: 'none found', counterevidence: 'none', conclusion: 'holds' },
+ });
+ const submit = (evidence: string, confidence: string, title: string, rootCause: string) => {
+ const dir = fs.mkdtempSync(path.join(root, 'submission-'));
+ const file = path.join(dir, 'submission.json');
+ fs.writeFileSync(file, JSON.stringify({ findings: [finding(evidence, confidence, title, rootCause)] }));
+ return cso(repo, ['submit', run, file]);
+ };
+ const supported = submit('supported', 'medium', 'Prototype injection in parse', 'parse copies attacker keys onto a plain object');
+ expect(supported.status).toBe(0);
+ expect(json(supported.stdout).findings).toBe(1);
+ const hypothesis = submit('hypothesis', 'low', 'Prototype injection through caller-named keys', 'parse copies keys named by the caller');
+ expect(hypothesis.status).toBe(0);
+ expect(json(hypothesis.stdout).findings).toBe(2);
+ expect(cso(repo, ['finish', run]).status).toBe(0);
+ const saved = json(fs.readFileSync(findReport(state, run, 'report.json'), 'utf8')).findings as Array<{ title: string; evidence: string; confidence: string }>;
+ expect(saved.map((f) => [f.title, f.evidence, f.confidence]).sort()).toEqual([
+ ['Prototype injection in parse', 'supported', 'medium'],
+ ['Prototype injection through caller-named keys', 'hypothesis', 'low'],
+ ]);
+ const report = fs.readFileSync(findReport(state, run, 'report.md'), 'utf8');
+ expect(report).toContain('Supported findings:');
+ expect(report).toContain('Prototype injection in parse');
+ expect(report).not.toContain('caller-named keys');
+ });
+});