Skip to content

docs(#980): public threat model with OWASP agentic mapping and SECURITY.md - #1035

Merged
admarble merged 7 commits into
mainfrom
feature/980-docs-ci-trust-public-threat-model-with-owasp-agent
Sep 10, 2026
Merged

admarble merged 7 commits into
mainfrom
feature/980-docs-ci-trust-public-threat-model-with-owasp-agent

Conversation

@admarble

@admarble admarble commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The P0 slice of #980: sequant's trust posture becomes a public, mechanically-verified surface.

  • SECURITY.md (new) — reporting channel, response windows a single maintainer can actually meet, supported-versions table, and an explicit scope boundary naming the owning layer for out-of-scope classes.
  • docs/THREAT-MODEL.md (new) — the untrusted-input surfaces phase agents read, and a defenses table where every row names its enforcer (path, § skill anchor, settings key, or guard message) and classifies itself deterministic (holds even if the model is fully compromised) vs model-dependent, each with its residual risk. Plus the OWASP Agentic Top 10 (2026) mapping (ASI01–ASI10) and a ## Residual risks section that states what is not defended.
  • src/lib/__tests__/security-docs.test.ts (new) — the CI gate. Every citation must resolve on disk; the guard count is recomputed from templates/hooks/pre-tool.sh rather than typed; immunity claims are banned outright.
  • One README line and one ### Security CHANGELOG bullet.

The discipline is #943's applied to security: every claim names its enforcing mechanism, and anything unenforced is stated as a residual risk rather than implied away.

What this gate does not prove

Nothing in CI can check that a Class cell is correct. A control mislabelled deterministic passes every assertion in the gate and is a public misstatement — the failure PLAN D8 names. Re-deriving each Class from its enforcer is a review obligation (Derived AC-8), not a test. Two Classes were set deliberately against the issue's own wording and want scrutiny:

  • The human merge gate is model-dependent, not deterministic. gh api repos/:owner/:repo/branches/main/protection → 404 "Branch not protected", and no HOOK_BLOCKED guard covers gh pr merge. The issue motivation calls it "a hard human merge gate"; on the tree as it stands it is a convention. Enabling branch protection with a required review moves it to deterministic and changes one cell.
  • The count is 16, not 18 (and the raw line count is 17). The motivation text says "18 HOOK_BLOCKED guards"; 17 is the raw occurrence count (grep -c 'HOOK_BLOCKED:' templates/hooks/pre-tool.sh) and 16 is distinct. AC-4 exists so this can never drift again — the doc's <!-- guards:count --> slot is compared against a recomputation from source.

AC verification

AC Description Status Evidence
AC-1 SECURITY.md sections + README link ✅ SECURITY.md; gate -t "AC-1"
AC-2 Defenses table, citations resolve, Class ∈ {deterministic, model-dependent} ✅ docs/THREAT-MODEL.md:65-85; gate -t "AC-2"
AC-3 OWASP Agentic Top 10 mapping, 10 rows, source URL ✅ docs/THREAT-MODEL.md:95-118; gate -t "AC-3"
AC-4 Guard count computed, not typed ✅ <!-- guards:count -->16; gate -t "AC-4" recomputes from templates/hooks/pre-tool.sh
AC-5 No immunity claims ✅ gate -t "AC-5"
AC-6 Exactly one README line linking both ✅ grep -c "SECURITY.md" README.md → 1; grep -c "THREAT-MODEL.md" README.md → 1 (both on README.md:393)
AC-7 Suite green ✅ npm run build ✅, npm run lint ✅, npm test — see below
AC-8 (derived) Each Class re-derived from its enforcer, not accepted as written ✅ Merge gate demoted to model-dependent on measured evidence (no branch protection, no hook guard)
AC-9 (derived) Enforcers cite path + stable anchor, not :LINE ✅ Every row cites a path plus a guard message, symbol, or § anchor; zero bare :LINE references
AC-10 (derived) Banned-phrase list widened ✅ Gate also bans bulletproof, unbreakable, eliminates prompt injection, 100% safe

Mutation verification

Mutation-verified: AC-1 — deleted the entire contact span (both lines between the security-contact markers) in SECURITY.md; src/lib/__tests__/security-docs.test.ts > names a non-empty contact channel inside the reporting section failed; restored.

Mutation-verified: AC-2 — repointed the first defenses-table Enforcer path templates/hooks/pre-tool.sh at templates/hooks/no-such-hook.sh; src/lib/__tests__/security-docs.test.ts > cites at least one on-disk path in every Enforcer cell failed; restored.

Mutation-verified: AC-3 — blanked the disposition cell of the ASI07 row in the owasp-delimited table; src/lib/__tests__/security-docs.test.ts > gives every category a non-empty disposition failed; restored.

Mutation-verified: AC-4 — changed the doc's guards:count slot from the computed 16 to 18; src/lib/__tests__/security-docs.test.ts > matches the number in the doc's <!-- guards:count --> slot failed; restored.

slot"} -->

Mutation-verified: AC-5 — inserted 'Sequant is injection-proof.' under ## Residual risks in docs/THREAT-MODEL.md; src/lib/__tests__/security-docs.test.ts > docs/THREAT-MODEL.md makes no immunity claim failed; restored.

Test plan

  • npm run build — passes
  • npm run lint — passes (eslint, --max-warnings 0)
  • npx vitest run src/lib/__tests__/security-docs.test.ts — 35 passed
  • AC-6 literal greps — 1 and 1
  • All five mutation probes above fire on exactly their own AC and restore clean
  • npm test (full suite) — 3 failed | 6233 passed | 1 expected fail | 4 skipped (6241), all 3 pre-existing (settled below)

Known state: 3 pre-existing failures, settled against base

The first full-suite run on this branch showed 6 failures across 4 files. Three of them, all in scripts/qa/tautology-detector-cli.test.ts, were caused by this branch and are fixed in d42083cc. That test runs the advisory tautology detector against the branch's own changed test files, and the new gate file — which asserts on document text and calls no production function, by design — read as 100% tautological and tripped the CLI's blocking exit. The file now carries a @tautology-skip pragma stating the reason and citing the mutation evidence above, matching the existing precedent in src/lib/workflow/non-chain-skip-guard.test.ts and src/lib/workflow/run-state.test.ts. Those 6 tests now pass.

The remaining 3 are pre-existing and unrelated, settled per the house method — same worktree, base commit, same command:

Failing test Branch d42083cc Base 988559f2
src/commands/__tests__/prompt-wait.test.ts › returns 0 and prints the reply when one arrives within the window ❌ ❌
src/lib/workflow/batch-executor.test.ts › withActivityHook (#543) › returns the input config unchanged when onProgress is undefined ❌ ❌
__tests__/integration/relay-hook.integration.test.ts › AC-7 › does NOT render when SEQUANT_RELAY is unset ❌ ❌

Reproduced deterministically in isolation on both refs (3 failed | 102 passed each), so they are not ordering flakes. git checkout --detach origin/main in this worktree, same three files, identical result. This branch touches two new documents, one README line, one CHANGELOG bullet and one new test file; none of the three failing suites import any of them.

AC-7 reading: the suite is green with respect to this change — no failure on this branch is attributable to it, and the one failure it did introduce is fixed. It is not green in absolute terms. Worth filing the three separately rather than letting them ride under this PR.

Follow-ups this PR does not carry

Per the D5 split, this node is P0 only: the recurring injection eval is #1024, OpenSSF Scorecard is #1025, and npm provenance + the README "Security model" section are gated at #1026 / applied in #1028.

Two items need a maintainer action outside this PR:

  1. GitHub private vulnerability reporting is currently disabled (gh api repos/:owner/:repo/private-vulnerability-reporting → {"enabled":false}). SECURITY.md names it as the primary channel, so the advisory link is live prose pointing at a switched-off feature until it is enabled in repo settings. AC-1's gate only checks the contact line is non-empty — it cannot check the channel answers.
  2. Branch protection on main is off. Turning it on with a required review promotes the merge gate from model-dependent to deterministic.

Closes #980

Second-pass QA (AC_MET_BUT_NOT_A_PLUS) — what changed and what is left to the owner

  • Fixed: the ASI01 row counted the human merge gate inside the "deterministic bound"; it is a human decision with no branch protection behind it (as Residual risks already said). Reworded.
  • Fixed: the injection eval row was classed deterministic; it is evidence on manual dispatch, not runtime containment. Now model-dependent with the residual risk stated.
  • Owner action, not code: SECURITY.md names GitHub private vulnerability reporting as the primary channel and it is disabled on the repository (gh api repos/sequant-io/sequant/private-vulnerability-reporting → enabled: false). Enable it in Settings → Code security, or run gh api -X PUT repos/sequant-io/sequant/private-vulnerability-reporting. Left untouched on purpose: a repo setting is the owner's call.
  • Declined for now: computing the supported-versions table from package.json would couple every minor release to a SECURITY.md edit; worth deciding with the /release skill in view (release+docs(trust): provenance decision applied; Security-model section in README and marketplace copy, banned-phrase gated (#980 P2) #1028 territory), not here.
  • Noted: branch protection with a required review would promote the merge gate to deterministic in exactly one cell.

admarble and others added 7 commits September 10, 2026 08:36
… evidence

The file asserts on the text of SECURITY.md, THREAT-MODEL.md and README.md;
there is no production function to call, by design. Without the pragma the
advisory detector reads the whole file as 100% tautological and
scripts/qa/tautology-detector-cli.test.ts (which runs the CLI against the
branch's own changed test files) exits 1, failing npm test.

Entire-Checkpoint: 204e10f911e3
…e; the injection eval is evidence, not containment

Second-pass QA (AC_MET_BUT_NOT_A_PLUS) notes: the ASI01 row listed the
human merge gate inside the deterministic bound, contradicting the
Residual risks section; the manually dispatched eval was classed
deterministic alongside runtime hook refusals. Both cells corrected;
the citation gate still passes (35/35).

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_0147heJNRw8wBBujPGMqxDpR
Entire-Checkpoint: a606392f4b70
…anded on main

AC-4's gate caught exactly the drift it exists for: merging main brought
the seventeenth distinct HOOK_BLOCKED refusal (#1032, PR #1034) and the
computed count no longer matched the typed slot.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_0147heJNRw8wBBujPGMqxDpR
Entire-Checkpoint: 5070c7c3df27
@admarble
admarble merged commit adf1eef into main Sep 10, 2026
6 checks passed
@admarble
admarble deleted the feature/980-docs-ci-trust-public-threat-model-with-owasp-agent branch September 10, 2026 22:45
admarble added a commit that referenced this pull request Oct 16, 2026
… <!-- on render

QA round 2: the (?!<!--) guard dropped markers whose values hold an HTML comment, including PR #1035's AC-4 marker. Temper on the marker opener instead, and escape <!-- in rendered values so they round-trip. Corpus of 150 PR bodies vs main: 8 gain markers, 0 lose.

Entire-Checkpoint: efad8e95472e
admarble added a commit that referenced this pull request Oct 16, 2026
…1465)

* fix(#1305): mutation marker round-trips braces and -->

Entire-Checkpoint: 3ead1a2cdfed

* fix(#1305): escape only --> on render and keep multi-line markers parsing

QA (AC_NOT_MET): escaping every > rewrote each rendered marker's failedTest separators and broke the #1297 state-summary test; the single-line regex dropped markers whose JSON spans lines, which the issue's Non-Goal keeps parsing. Escape only the > of a --> inside a value, and match lazily to the first } --> without crossing another <!--.

Entire-Checkpoint: 3da69c1f546e

* fix(#1305): stop only at the next SEQUANT_MUTATION marker, and escape <!-- on render

QA round 2: the (?!<!--) guard dropped markers whose values hold an HTML comment, including PR #1035's AC-4 marker. Temper on the marker opener instead, and escape <!-- in rendered values so they round-trip. Corpus of 150 PR bodies vs main: 8 gain markers, 0 lose.

Entire-Checkpoint: efad8e95472e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs+ci(trust): public threat model with OWASP agentic mapping, SECURITY.md, recurring injection eval, and supply-chain trust signals

1 participant