@ericrisco/rsc 4.0.5 → 4.1.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.
Files changed (200) hide show
  1. package/README.md +4 -4
  2. package/manifest.json +78 -84
  3. package/package.json +1 -1
  4. package/scripts/lib/default-skill-floor.js +5 -1
  5. package/scripts/lib/domains.js +1 -1
  6. package/scripts/lib/recommend.js +1 -1
  7. package/scripts/lib/retired-skills.js +4 -0
  8. package/scripts/skill-migration-brief.md +1 -1
  9. package/skills/accessibility/evals/README.md +1 -1
  10. package/skills/accessibility/evals/cases.yaml +1 -1
  11. package/skills/agent-safety/SKILL.md +2 -2
  12. package/skills/agent-safety/evals/README.md +1 -1
  13. package/skills/agent-safety/evals/cases.yaml +1 -1
  14. package/skills/analyze/evals/README.md +1 -1
  15. package/skills/analyze/evals/cases.yaml +2 -2
  16. package/skills/angular/SKILL.md +1 -1
  17. package/skills/api-connector-builder/SKILL.md +1 -1
  18. package/skills/api-design/SKILL.md +3 -3
  19. package/skills/api-design/evals/cases.yaml +1 -1
  20. package/skills/automation-strategy/SKILL.md +1 -1
  21. package/skills/automation-strategy/evals/README.md +1 -1
  22. package/skills/automation-strategy/evals/cases.yaml +2 -2
  23. package/skills/automation-strategy/references/orchestration-and-antipatterns.md +1 -1
  24. package/skills/aws-essentials/SKILL.md +3 -3
  25. package/skills/aws-essentials/evals/cases.yaml +2 -2
  26. package/skills/backups/SKILL.md +2 -2
  27. package/skills/backups/evals/cases.yaml +2 -2
  28. package/skills/bash-scripting/SKILL.md +1 -1
  29. package/skills/building-agents/SKILL.md +2 -2
  30. package/skills/building-agents/evals/cases.yaml +2 -2
  31. package/skills/chrome-extension/SKILL.md +1 -1
  32. package/skills/cloudflare/SKILL.md +1 -1
  33. package/skills/code-review/SKILL.md +2 -2
  34. package/skills/code-review/evals/cases.yaml +2 -2
  35. package/skills/compliance/SKILL.md +3 -3
  36. package/skills/compliance/evals/cases.yaml +1 -1
  37. package/skills/constitution/SKILL.md +2 -2
  38. package/skills/constitution/evals/README.md +2 -2
  39. package/skills/constitution/evals/cases.yaml +2 -2
  40. package/skills/constitution/references/constitution-template.md +1 -1
  41. package/skills/cpp/SKILL.md +2 -2
  42. package/skills/cpp/evals/README.md +1 -1
  43. package/skills/cpp/evals/cases.yaml +2 -2
  44. package/skills/csharp-dotnet/SKILL.md +3 -3
  45. package/skills/csharp-dotnet/evals/cases.yaml +1 -1
  46. package/skills/csharp-dotnet/references/aspnetcore.md +1 -1
  47. package/skills/data-policy/SKILL.md +2 -2
  48. package/skills/data-policy/evals/README.md +1 -1
  49. package/skills/data-policy/evals/cases.yaml +1 -1
  50. package/skills/debug/SKILL.md +1 -1
  51. package/skills/debug/evals/README.md +1 -1
  52. package/skills/decision-challenge/SKILL.md +2 -2
  53. package/skills/decision-challenge/evals/cases.yaml +1 -1
  54. package/skills/deployment/SKILL.md +2 -2
  55. package/skills/deployment/evals/README.md +1 -1
  56. package/skills/deployment/evals/cases.yaml +2 -2
  57. package/skills/django/SKILL.md +2 -2
  58. package/skills/django/evals/README.md +1 -1
  59. package/skills/django/evals/cases.yaml +1 -1
  60. package/skills/django/references/security.md +1 -1
  61. package/skills/docker/SKILL.md +3 -3
  62. package/skills/docker/evals/cases.yaml +1 -1
  63. package/skills/dynamodb/SKILL.md +2 -2
  64. package/skills/electron/SKILL.md +1 -1
  65. package/skills/electron/references/packaging-and-updates.md +1 -1
  66. package/skills/email-connector/SKILL.md +2 -2
  67. package/skills/email-deliverability/SKILL.md +1 -1
  68. package/skills/error-handling/SKILL.md +1 -1
  69. package/skills/expo/SKILL.md +2 -2
  70. package/skills/fastapi/SKILL.md +4 -4
  71. package/skills/fastapi/evals/README.md +2 -2
  72. package/skills/fastapi/evals/cases.yaml +2 -2
  73. package/skills/fastapi/references/security.md +2 -2
  74. package/skills/firebase/SKILL.md +1 -1
  75. package/skills/flutter/SKILL.md +1 -1
  76. package/skills/flutter/evals/cases.yaml +2 -2
  77. package/skills/fly-io/SKILL.md +1 -1
  78. package/skills/gamedev-multiplayer/SKILL.md +1 -1
  79. package/skills/gamedev-multiplayer/evals/README.md +1 -1
  80. package/skills/gamedev-multiplayer/evals/cases.yaml +2 -2
  81. package/skills/gamedev-shipping/SKILL.md +1 -1
  82. package/skills/gcp-essentials/SKILL.md +2 -2
  83. package/skills/gcp-essentials/evals/README.md +1 -1
  84. package/skills/gcp-essentials/evals/cases.yaml +2 -2
  85. package/skills/gdpr-privacy/SKILL.md +2 -2
  86. package/skills/gdpr-privacy/evals/cases.yaml +1 -1
  87. package/skills/github-actions/SKILL.md +2 -2
  88. package/skills/go/SKILL.md +4 -4
  89. package/skills/go/evals/README.md +1 -1
  90. package/skills/go/evals/cases.yaml +2 -2
  91. package/skills/google-workspace/SKILL.md +2 -2
  92. package/skills/hetzner/SKILL.md +1 -1
  93. package/skills/htmx/SKILL.md +4 -4
  94. package/skills/htmx/evals/cases.yaml +2 -2
  95. package/skills/implement/SKILL.md +1 -1
  96. package/skills/init/SKILL.md +2 -2
  97. package/skills/init/evals/cases.yaml +2 -2
  98. package/skills/init/references/discovery.md +1 -1
  99. package/skills/init/references/recommend-skills.md +5 -5
  100. package/skills/java/SKILL.md +3 -3
  101. package/skills/java/evals/README.md +1 -1
  102. package/skills/java/evals/cases.yaml +2 -2
  103. package/skills/laravel/SKILL.md +3 -3
  104. package/skills/laravel/evals/README.md +1 -1
  105. package/skills/laravel/evals/cases.yaml +1 -1
  106. package/skills/marketing/evals/README.md +1 -1
  107. package/skills/marketing/evals/cases.yaml +1 -1
  108. package/skills/mongodb/SKILL.md +2 -2
  109. package/skills/mongodb/evals/README.md +1 -1
  110. package/skills/mongodb/evals/cases.yaml +2 -2
  111. package/skills/nextjs/SKILL.md +3 -3
  112. package/skills/nextjs/evals/cases.yaml +2 -2
  113. package/skills/nextjs/references/security.md +2 -2
  114. package/skills/notion-connector/SKILL.md +3 -3
  115. package/skills/notion-connector/evals/README.md +1 -1
  116. package/skills/notion-connector/evals/cases.yaml +2 -2
  117. package/skills/php/SKILL.md +4 -4
  118. package/skills/php/evals/README.md +1 -1
  119. package/skills/php/evals/cases.yaml +1 -1
  120. package/skills/plan/evals/README.md +1 -1
  121. package/skills/postgresdb/SKILL.md +1 -1
  122. package/skills/postgresdb/evals/README.md +1 -1
  123. package/skills/postgresdb/evals/cases.yaml +2 -2
  124. package/skills/presentations/evals/README.md +1 -1
  125. package/skills/python/SKILL.md +3 -3
  126. package/skills/python/evals/README.md +1 -1
  127. package/skills/python/evals/cases.yaml +2 -2
  128. package/skills/rag/scripts/verify.sh +1 -1
  129. package/skills/review/SKILL.md +2 -2
  130. package/skills/review/evals/cases.yaml +3 -3
  131. package/skills/ruby/SKILL.md +1 -1
  132. package/skills/rust/SKILL.md +2 -2
  133. package/skills/rust/evals/README.md +1 -1
  134. package/skills/rust/evals/cases.yaml +2 -2
  135. package/skills/security-audit/SKILL.md +186 -0
  136. package/skills/security-audit/evals/cases.yaml +95 -0
  137. package/skills/security-audit/references/auditor-safety.md +69 -0
  138. package/skills/security-audit/references/classes/README.md +225 -0
  139. package/skills/security-audit/references/classes/ai-and-llm.md +247 -0
  140. package/skills/security-audit/references/classes/client-side.md +181 -0
  141. package/skills/security-audit/references/classes/cloud-and-deployment.md +167 -0
  142. package/skills/security-audit/references/classes/data-isolation.md +161 -0
  143. package/skills/security-audit/references/classes/desktop-mobile-ipc.md +167 -0
  144. package/skills/security-audit/references/classes/memory-and-binary.md +230 -0
  145. package/skills/security-audit/references/classes/protocols-and-messaging.md +151 -0
  146. package/skills/security-audit/references/classes/resource-exhaustion.md +141 -0
  147. package/skills/security-audit/references/classes/supply-chain.md +147 -0
  148. package/skills/security-audit/references/classes/web-and-auth.md +238 -0
  149. package/skills/security-audit/references/coverage-ledger.md +172 -0
  150. package/skills/security-audit/references/fixes-by-stack.md +972 -0
  151. package/skills/security-audit/references/fixing.md +200 -0
  152. package/skills/security-audit/references/hunting.md +146 -0
  153. package/skills/security-audit/references/isolated-execution.md +85 -0
  154. package/skills/security-audit/references/platforms.md +650 -0
  155. package/skills/security-audit/references/reconnaissance.md +73 -0
  156. package/skills/security-audit/references/resuming.md +55 -0
  157. package/skills/security-audit/references/scanners.md +347 -0
  158. package/skills/{secure-coding → security-audit}/references/secrets-and-supply-chain.md +78 -34
  159. package/skills/security-audit/references/secrets-discipline.md +173 -0
  160. package/skills/{secure-coding → security-audit}/references/threat-modeling.md +80 -32
  161. package/skills/security-audit/references/verification.md +118 -0
  162. package/skills/security-audit/schema/findings.schema.json +178 -0
  163. package/skills/security-audit/scripts/render-report.mjs +311 -0
  164. package/skills/security-audit/scripts/validate-findings.mjs +508 -0
  165. package/skills/skill-scout/scripts/verify.sh +1 -1
  166. package/skills/source-grounded-development/evals/cases.yaml +1 -1
  167. package/skills/specify/evals/README.md +1 -1
  168. package/skills/spring-boot/SKILL.md +3 -3
  169. package/skills/spring-boot/evals/README.md +1 -1
  170. package/skills/spring-boot/evals/cases.yaml +1 -1
  171. package/skills/spring-boot/references/security.md +1 -1
  172. package/skills/stripe/SKILL.md +2 -2
  173. package/skills/suggest/evals/cases.yaml +2 -2
  174. package/skills/supabase/SKILL.md +1 -1
  175. package/skills/tauri/SKILL.md +2 -2
  176. package/skills/testing-go/SKILL.md +1 -1
  177. package/skills/typescript/SKILL.md +2 -2
  178. package/skills/verify/SKILL.md +3 -3
  179. package/skills/verify/evals/README.md +2 -2
  180. package/skills/verify/evals/cases.yaml +2 -2
  181. package/skills/vue-nuxt/SKILL.md +2 -2
  182. package/skills/webhooks/SKILL.md +2 -2
  183. package/skills/wordpress/SKILL.md +2 -2
  184. package/skills/wordpress/evals/README.md +1 -1
  185. package/skills/wordpress/evals/cases.yaml +1 -1
  186. package/skills/worktrees/evals/README.md +1 -1
  187. package/targets/clone-bootstrap.mjs +1 -1
  188. package/targets/commands.js +1 -1
  189. package/skills/secure-coding/SKILL.md +0 -336
  190. package/skills/secure-coding/evals/README.md +0 -68
  191. package/skills/secure-coding/evals/cases.yaml +0 -55
  192. package/skills/secure-coding/references/authn-authz.md +0 -249
  193. package/skills/secure-coding/references/owasp-by-stack.md +0 -574
  194. package/skills/secure-coding/scripts/verify.sh +0 -208
  195. package/skills/security-scan/SKILL.md +0 -219
  196. package/skills/security-scan/evals/README.md +0 -14
  197. package/skills/security-scan/evals/cases.yaml +0 -50
  198. package/skills/security-scan/references/tools.md +0 -97
  199. package/skills/security-scan/references/triage.md +0 -92
  200. package/skills/security-scan/scripts/verify.sh +0 -108
@@ -0,0 +1,147 @@
1
+ # Supply chain and release classes
2
+
3
+ Load when: the repo pulls dependencies, accepts outside contributions into builds, runs CI,
4
+ produces, signs or promotes release artifacts, ships updates to installed software, or loads
5
+ plugins and extensions. Verdict rules: [`../verification.md`](../verification.md).
6
+
7
+ The question: between the source a maintainer reviewed and the thing a user finally runs, where can
8
+ someone with less trust swap, add or steer content? Bugs inside a local binary loader go to
9
+ `memory-and-binary.md`; runtime authority of deployed workloads goes to `cloud-and-deployment.md`.
10
+
11
+ For a large target, hunt in five passes: how dependencies resolve, how CI jobs are isolated, how
12
+ artifacts keep their identity, who may release, and how updaters and plugins are trusted.
13
+
14
+ ## Ground rules
15
+
16
+ - **"Old or unpinned package" is a lead, not a finding.** Say who can steer which version gets
17
+ picked, which build uses it, and what execution or release boundary that opens.
18
+ - **Integrity is a chain.** Source identity, then resolved inputs, then the build machine, then the
19
+ artifact digest, then test evidence, then signature or attestation, then promotion, then the
20
+ client that installs it. One weak link breaks it.
21
+ - **Treat CI files as authorisation code.** Per workflow: what triggers it, whose code executes,
22
+ which secrets and tokens it holds, what it can publish or modify.
23
+ - **A hash served next to the artifact it describes adds no trust.** Find the independent root of
24
+ trust and what the code does when verification fails.
25
+ - Control-flow failures visible in the repo, checked with a bounded local fixture, can be
26
+ `confirmed`. Branch protection, hosted runner setup, registry settings, signing services and
27
+ production promotion are usually not visible: `needs_validation`.
28
+ - Validate with a throwaway fixture repo, a fake credential marker, a local registry or config and a
29
+ namespace nobody ships from. Never publish to, or modify, a real release.
30
+
31
+ ## Dependencies and build inputs
32
+
33
+ ### `dependency-confusion`
34
+
35
+ The resolver can be led to a different namespace, registry, mirror, repo or source URL than the
36
+ one intended (public instead of private, fallback instead of primary). Look at: internal packages
37
+ with unscoped names, registry order in `.npmrc`, `pip.conf` or `settings.xml`,
38
+ `--extra-index-url`, whether lockfiles and checksums are enforced, secondary build files,
39
+ platform-specific resolution, and how a fresh install differs from an update.
40
+
41
+ ### `mutable-build-input`
42
+
43
+ The build consumes something that can change after review: a branch or tag ref, a submodule not
44
+ pinned to a commit, a tool downloaded at build time, `curl | sh`, a remote include, a CI action
45
+ referenced by tag instead of SHA (`uses: org/action@main`), a base image without a digest
46
+ (`:latest`). To be a finding, someone with less trust must be able to change it and the change
47
+ must reach trusted output. A reproducible build is not the same as an authentic one.
48
+
49
+ ### `codegen-provenance`
50
+
51
+ Generated or vendored content ships without the review and integrity checks normal source gets:
52
+ code generated from schemas, vendored tarballs, generated API clients, translation files, sample
53
+ code in docs, binary blobs. Regenerate locally, diff against the committed copy, and find who
54
+ controls the generator and its input.
55
+
56
+ ### `build-context-leak`
57
+
58
+ The package or image picks up things it should not (secrets, local config, `.git`, test fixtures,
59
+ developer leftovers) because the build context and ignore rules cover more than the release needs.
60
+ Look at `COPY . .` with a thin `.dockerignore`, the `files` field in `package.json`,
61
+ `MANIFEST.in`. Report only when the shipped artifact exposes a working credential, private data or
62
+ privileged config.
63
+
64
+ ## CI and automation
65
+
66
+ ### `privileged-workflow-untrusted-code`
67
+
68
+ Contributor-controlled code (from a fork, a pull request, an issue comment, a bot dependency bump,
69
+ an external webhook) runs where protected secrets, write tokens, deploy rights or a trusted runner
70
+ are available. Look at `pull_request_target` or `workflow_run` jobs that check out the PR head,
71
+ self-hosted runners on public repos, approval gates, environment protection, `permissions:`
72
+ blocks. Do not assume host defaults that the source does not state.
73
+
74
+ ### `workflow-injection`
75
+
76
+ Text an outsider controls (branch or tag name, commit message, issue or PR title and body,
77
+ artifact name, matrix entry, output of an earlier step) is spliced into a shell line, an
78
+ expression, a path or a privileged input without being canonicalised. Classic sign:
79
+ `${{ github.event.* }}` inside `run:`; also untrusted writes to `GITHUB_ENV` or `GITHUB_OUTPUT`.
80
+
81
+ ### `ci-cache-poisoning`
82
+
83
+ A job with less trust writes to a cache, an uploaded artifact, a shared workspace or a step output,
84
+ and a job with more trust later restores it and runs or ships it. Check cache key scopes, who
85
+ produced each artifact, whether its digest is pinned, retention, and promotion steps that look
86
+ things up by a name that can change.
87
+
88
+ ### `ci-token-overreach`
89
+
90
+ A job gets more permission than the task needs (wider scope, other repos or environments, longer
91
+ lifetime) and untrusted input picks which resource is affected. Typical: default write-all tokens,
92
+ long-lived cloud keys stored as secrets instead of short-lived federation. Lack of least privilege
93
+ by itself is hardening; a finding needs a privileged action someone can actually reach.
94
+
95
+ ## Release and update
96
+
97
+ ### `artifact-substitution`
98
+
99
+ Testing, review, signing and publishing each refer to something mutable (a tag, a file name, a
100
+ channel, an artifact id) instead of one fixed digest, so what was tested is not provably what
101
+ shipped. Inspect every copy, repack, multi-arch manifest merge and provenance step from build to
102
+ release.
103
+
104
+ ### `release-signing-policy`
105
+
106
+ Releases or signatures are accepted even though they come from the wrong repository, workflow,
107
+ branch, environment, key role or signer threshold. Read the identity claims inside attestations
108
+ and check the consumer enforces them; "the signature verifies" is not enough. Where policy demands
109
+ it, expired, rotated or revoked keys must cause rejection.
110
+
111
+ ### `update-rollback`
112
+
113
+ The updater checks the payload bytes but not the metadata around them: version, product, platform,
114
+ channel, install path, expiry, protection against rollback. Or it pairs metadata and payload from
115
+ two different signed releases. Also check that install is atomic and recovery is safe. Calling a
116
+ signature API without binding it to policy is an incomplete check.
117
+
118
+ ### `plugin-trust-expansion`
119
+
120
+ A plugin or extension ends up with more host authority than it declared, one publisher can take
121
+ over another publisher's identity, or install and update hooks (`postinstall`, activation scripts)
122
+ run before authenticity and permissions are checked. Deliberately installing arbitrary plugins for
123
+ the same user is not a privilege boundary.
124
+
125
+ ## Moves that work across this file
126
+
127
+ - Start from a released digest or an installed update and walk backwards to every input behind it:
128
+ sources, generated files, credentials, build machines, caches, test results, approvals.
129
+ - Lay untrusted and protected workflow triggers next to each other. Mark every persisted channel
130
+ between them (cache, artifact, output, workspace) and demand a fixed identity and a trusted
131
+ producer for each.
132
+ - Exercise failure: a revoked key, a broken download, a missing attestation, a release that only
133
+ exists for some platforms, a rollback, the registry being down. How the system fails is part of
134
+ release integrity.
135
+
136
+ ## Proof checklist
137
+
138
+ 1. Name the actor with less trust, the thing they control (source, cache, artifact, metadata), the
139
+ trusted job or updater that consumes it, and the outcome: something published without
140
+ authorisation, code added to the product, a secret disclosed or privileged execution.
141
+ 2. Show where artifact identity breaks: a mutable name or an unpinned digest that a real consumer
142
+ then uses.
143
+ 3. Look up the defaults of the package manager, code host, registry and signing tool at the pinned
144
+ versions. Hosted controls you cannot see mean `needs_validation`.
145
+ 4. `confirmed` only with the whole handoff visible in source and a meaningful result. Otherwise
146
+ `needs_validation`, naming the branch, runner, registry, signing or deployment fact the owner
147
+ must check. See [`../verification.md`](../verification.md).
@@ -0,0 +1,238 @@
1
+ # Web protocol and authentication classes
2
+
3
+ Load when: HTTP parsing, caching or identity is where trust is decided. APIs and web apps, custom
4
+ HTTP servers, gateways, CDNs and reverse proxies, plus anything that issues or checks identity:
5
+ cookie sessions and CSRF defences, JWT, OAuth/OIDC, SAML, passkeys, MFA, recovery, account
6
+ linking, API keys, mTLS. Verdict rules: [`../verification.md`](../verification.md).
7
+
8
+ Core `broken-access-control` asks whether a principal may do something. This file asks something
9
+ else: can the HTTP or identity layer be fooled about **which** principal, request, token or
10
+ assurance level an operation belongs to?
11
+
12
+ Hunt a big target in slices: request framing and caching, browser sessions, federated login,
13
+ strong authentication and recovery, machine credentials. A single app server behind a managed
14
+ proxy you cannot see offers little framing surface you can confirm from source; a proxy, gateway
15
+ or home-grown parser offers a lot.
16
+
17
+ ## Ground rules
18
+
19
+ - **Framing and cache bugs need two parties that disagree.** Name both components and the exact
20
+ value each one ends up with after normalising the same bytes or key.
21
+ - **Every credential has a verification line and a list of bindings.** Find where its signature
22
+ or secret is checked, then check each binding its role requires: who issued it, who it is for
23
+ (audience, client, RP, origin), which session and principal, which resource, what assurance,
24
+ when it expires, whether it is single use.
25
+ - **Request metadata is a trust decision.** `Host`, `Forwarded` and `X-Forwarded-*`, `Origin`,
26
+ `Referer`, redirect destinations, callback `state`, and any URL built from the request: follow
27
+ each to the identity or response it shapes.
28
+ - **A missing control alone is a note.** No header, no cookie flag, no MFA prompt, no rate limit:
29
+ none is a finding by itself. A finding needs the server accepting something invalid, impact on
30
+ another principal, a drop in assurance, or a credential leaking.
31
+ - **Much of this lives outside the repo.** Proxy chains, CDN cache keys, IdP settings, certificate
32
+ trust, how browsers treat cookies, secrets, the auth mode in production. When the verdict hangs
33
+ on one of these, write `needs_validation` with that fact; do not assert it.
34
+ - **Check defaults at the pinned version** of the framework and library. If you cannot establish
35
+ version or config, use `needs_validation`. Never trade an unverified critical claim for a
36
+ "confirmed" lower severity.
37
+
38
+ ## HTTP framing and caching
39
+
40
+ ### `request-smuggling`
41
+
42
+ Two HTTP processors in a chain split the same byte stream into requests at different points. Look
43
+ at: more than one `Content-Length`, `Transfer-Encoding` parsing, HTTP/2 or HTTP/3 traffic
44
+ downgraded to HTTP/1.1, case and whitespace handling of header names, hop-by-hop headers, bare CR
45
+ or LF handling in custom parsers. Proof: feed the same local fixture to both parsers and show
46
+ where each thinks request one ends and request two begins.
47
+
48
+ ### `cache-poisoning`
49
+
50
+ A request input changes the cached body or a security header, yet the cache key ignores it.
51
+ Compare how the key is built with every input that varies the response: forwarded host or scheme,
52
+ selected cookies, query normalisation, language or device headers, logged-in state. Proof: the
53
+ unkeyed input, the altered response, and a second user served that response.
54
+
55
+ ### `cache-deception`
56
+
57
+ The cache files a private dynamic page under rules for public static files (`/account/profile.css`
58
+ served by the profile route), or stores a response whose identity inputs are missing from cache
59
+ policy. Compare edge rules by extension or path with how the app router normalises suffixes and
60
+ path parameters, and with the `Cache-Control` sent on authenticated routes.
61
+
62
+ ### `host-header-trust`
63
+
64
+ Client-supplied host or proxy headers decide something sensitive: links in password-reset emails,
65
+ absolute URLs, tenant routing, callback targets, cache keys, or the client IP an allowlist or rate
66
+ limit relies on. Look at `request.host`, `X-Forwarded-Host`, `X-Forwarded-For`, trust-proxy
67
+ settings. Proof: who can send the header, and evidence that the trusted ingress does not remove a
68
+ client copy.
69
+
70
+ ### `header-injection`
71
+
72
+ Outside data is written into `Location`, `Set-Cookie`, a CSP or another response header with
73
+ control characters or unsafe normalisation. First check that the framework does not already reject
74
+ CR/LF; then show a response header change that matters for security.
75
+
76
+ ## Browser sessions
77
+
78
+ ### `csrf`
79
+
80
+ **What it is.** A cross-site page makes the victim's browser send ambient credentials (cookies,
81
+ HTTP auth, client certificates) to an endpoint that changes state, and the server takes it: no
82
+ working anti-CSRF token, no same-site binding, no strict check of `Origin` or `Referer`.
83
+
84
+ **Where to look.** Inventory every mutation that authenticates by cookie: HTML forms, JSON-looking
85
+ endpoints that also parse `text/plain` or form bodies, multipart uploads, `_method` overrides, GET
86
+ handlers that change data, old route versions. `SameSite` helps only for the cookies and browser
87
+ contexts it is really applied to. Login CSRF and cross-site subresource loads need their own look.
88
+
89
+ **How to prove.** The ambient credential, the mutating route, the cross-site request shape the
90
+ server accepts, the cookie policy actually in force, and the missing check.
91
+
92
+ **Not a finding.** Read-only routes, and routes that need a bearer token browsers never attach on
93
+ their own.
94
+
95
+ ### `session-fixation`
96
+
97
+ The session id does not change at login, account switch, MFA completion, impersonation start or
98
+ any privilege change; or it keeps working after logout, password change, revocation or account
99
+ suspension. Cover server-side sessions, refresh tokens, signed cookies, open WebSockets, cached
100
+ copies and fallback endpoints. Proof: an id from before the transition still works after it.
101
+
102
+ ### `cookie-scope-transport`
103
+
104
+ A sensitive cookie is scoped too widely (`Domain`, `Path`), can travel over plain HTTP, or is
105
+ shadowed by a same-named cookie that another component reads first. Missing `HttpOnly`, `Secure`
106
+ or `SameSite` is a hardening note on its own. It is a finding when a realistic weaker origin,
107
+ network attacker or browser path can read, plant or overwrite the credential.
108
+
109
+ ## Federated identity
110
+
111
+ Decide the role first. Redirect URI allowlists and code issuance are the authorisation server's
112
+ job, not a client's. Verification and binding bugs belong to whatever component consumes the token
113
+ or assertion.
114
+
115
+ ### `jwt-verification`
116
+
117
+ **Order of checks.** Is the signature verified at all? Is the algorithm fixed by the server rather
118
+ than read from the token (`alg: none`, RS256/HS256 confusion)? Is the key source fixed? Then the
119
+ claims: `exp`, `nbf`, `aud`, `iss`. Treat `kid`, `jku` and `x5u` as attacker-chosen key pointers.
120
+ Look for strange or duplicate header handling and any path that decodes without verifying
121
+ (`jwt.decode(..., verify=False)`, `jsonwebtoken.decode`).
122
+
123
+ **Key point.** A token minted by a trusted issuer for a different service must be rejected here.
124
+ A missing `aud` check is the usual cause.
125
+
126
+ ### `oauth-binding`
127
+
128
+ If the target is the authorisation server: `redirect_uri` must match exactly and belong to the
129
+ client. In every role: `state` tied to the user's session; PKCE and the code bound together where
130
+ they apply; the ID token's signature, issuer, audience and `nonce` checked; with several providers,
131
+ the callback tied to the provider the user actually picked. Compare the first callback with retry,
132
+ mobile or deep-link and account-linking callbacks.
133
+
134
+ ### `saml-assertion-binding`
135
+
136
+ The element whose signature was checked must be the same element the code reads identity from
137
+ (signature wrapping). Look at unsigned or fallback branches, XML parser hardening (no external
138
+ entities), canonicalisation differences, and freshness and binding: validity window, audience,
139
+ recipient, `InResponseTo`, replay cache.
140
+
141
+ ## MFA, passkeys and account changes
142
+
143
+ ### `mfa-downgrade`
144
+
145
+ Someone holding only the first factor can enroll, swap or remove the second factor, mint recovery
146
+ codes, mark a device as trusted, or use a fallback login, without the fresh authentication policy
147
+ requires. Also check that removed or stale factors stop authorising sessions.
148
+
149
+ ### `step-up-bypass`
150
+
151
+ A passed challenge raises the assurance of the wrong thing (another session, account, tenant,
152
+ action or request), or some route never asks for it. The challenge should be bound to the
153
+ principal, the current session, the target assurance level, the specific operation or resource
154
+ where policy says so, a deadline, and one-time use. Compare the web UI with the API, batch jobs,
155
+ recovery and flows resumed after an interruption.
156
+
157
+ ### `webauthn-verification`
158
+
159
+ Registration must tie the challenge, RP ID, expected origin, credential, user handle, algorithm
160
+ and any required user verification to the session that began it. Login must check challenge, RP ID
161
+ and origin, that the credential belongs to the account, the signature, and presence or
162
+ verification when required. Watch discoverable-credential login that maps a `userHandle` to an
163
+ account, and linking flows. The signature counter matters only if the product treats a counter
164
+ going backwards as a sign of cloning.
165
+
166
+ ### `account-linking`
167
+
168
+ Attaching a new email, phone, passkey, device, IdP or external account should need: an active
169
+ authenticated session, proof that the person controls the new identifier, any step-up policy
170
+ demands, and callback state tied to the account that started the link. Inspect unlink and relink,
171
+ invite acceptance, and "same verified email, so merge accounts" logic for tenant or identifier
172
+ collisions.
173
+
174
+ ### `account-recovery`
175
+
176
+ Recovery tends to be the weakest way in. Check reset tokens for randomness, binding to the user
177
+ and purpose, expiry, single use, rate accounting, a trustworthy URL inside the email (see
178
+ `host-header-trust`), and that older tokens and live sessions die when it succeeds. Also cover
179
+ support or admin-assisted recovery, backup codes, moving to a new device, and changing email or
180
+ phone. Replies that differ only in revealing that an already-public account exists are not a
181
+ finding.
182
+
183
+ For linking and recovery, draw the account graph before and after the change. Each new edge
184
+ should say: who is acting now, how they proved the new identity, what assurance was required,
185
+ which session or callback it is tied to, and what gets revoked.
186
+
187
+ ## API keys and mTLS
188
+
189
+ ### `api-key-scope`
190
+
191
+ A key works across more tenants, environments, resources or actions than its stored record allows,
192
+ or request parameters can override what the key is bound to. Read the key lookup (prefix-only
193
+ compare versus the full secret), whether publishable and secret keys can be confused, how scope is checked, what happens on rotation, how long revocation stays cached, and what bulk endpoints allow.
194
+
195
+ ### `api-key-exposure`
196
+
197
+ Keys show up where someone with less trust can read them: frontend bundles (`NEXT_PUBLIC_*`,
198
+ `VITE_*`), query strings, redirect URLs, logs, error pages, build output, API responses. Something
199
+ merely called a key may be a public identifier; establish its type and what it unlocks before
200
+ calling it a leak.
201
+
202
+ ### `mtls-identity-confusion`
203
+
204
+ The service believes certificate identity headers (`X-Client-Cert`, `X-SSL-Client-*`) from any
205
+ peer; or the chain validates but subject text the attacker influences maps to the wrong account
206
+ (naive CN parsing); or it accepts a cert from the wrong trust domain, with the wrong EKU, audience
207
+ or validity rules. When a proxy terminates mTLS, confirm only that proxy can reach the backend, it
208
+ discards incoming identity headers, and the backend ties the cleaned identity to the request.
209
+
210
+ ### `cert-lifecycle-fallback`
211
+
212
+ A certificate that is missing, expired, revoked or failed to renew makes the service quietly fall
213
+ back to bearer-only or anonymous access, or pooled long-lived connections keep their authority
214
+ after revocation. A fail-open branch you can read in the repo can be `confirmed`; when the answer
215
+ depends on deployed revocation data, it is `needs_validation`.
216
+
217
+ ## Moves that work across this file
218
+
219
+ - Follow each credential and challenge through its whole life: issued, stored, sent, consumed,
220
+ refreshed, revoked. Do it for the happy path and again for errors, retries, migrations, legacy
221
+ routes and account switching.
222
+ - List every way into one identity and every path that reaches one sensitive action. The
223
+ effective policy is whichever parallel route is weakest, whatever the main UI does.
224
+ - Lay out how the parser, proxy, router, cache and app each normalise a request. Validate by
225
+ feeding identical, bounded fixtures to each locally, never by sending traffic to a live
226
+ deployment.
227
+
228
+ ## Proof checklist
229
+
230
+ 1. Framing and cache: both components, where their parse or key diverges, and the impact across
231
+ requests, across users or on a private response, demonstrated with local fixtures.
232
+ 2. Tokens, MFA, passkeys, linking, recovery, API keys, mTLS: the verification line and the binding
233
+ it lacks (principal, session, resource, origin, audience, action or assurance), plus evidence
234
+ the server accepts the bad credential or transition.
235
+ 3. CSRF: ambient credential, route, accepted cross-site shape, cookie policy, missing check.
236
+ 4. `confirmed` only with a full source trace and an observed unauthorised identity, state change or
237
+ disclosure. Otherwise `needs_validation`, naming the missing fact and the safe check that
238
+ settles it. See [`../verification.md`](../verification.md).
@@ -0,0 +1,172 @@
1
+ # Coverage ledger
2
+
3
+ The ledger is the audit's only coverage claim and its saved state: one row per unit of work, updated after every unit. It decides what hunters get, what the report may say was reviewed, and where a cut run resumes.
4
+
5
+ ## Why a ledger
6
+
7
+ A sentence like "auth was reviewed" proves nothing. Neither does an agent count or the architecture note. Coverage exists only where a unit records who reviewed which paths, which checks ran, and what came out. Anything without that record is `not_reviewed`, and the report says so.
8
+
9
+ No single pass exhausts a target. The ledger makes the gaps visible so the next run can pick them up.
10
+
11
+ ## Units
12
+
13
+ A unit is one combination of **surface × boundary × area × class**:
14
+
15
+ | Dimension | Meaning | Canonical reference (example) |
16
+ |---|---|---|
17
+ | surface | Where lower-trust input enters; `code` or `platform` | `src/router.ts#POST /users/:id`, `platform:supabase#storage.buckets` |
18
+ | boundary | The control that must hold | `src/authz.ts#requireOwner` |
19
+ | area | Subsystem or package | `packages/api` |
20
+ | class | Attack class section | `classes/access-control.md#Object-level authorization` |
21
+
22
+ Each dimension carries a human label and a stable canonical reference taken from source: a repository path plus the exported name, a route or message name declared in code, the function that enforces a boundary, a package path, the exact heading of a class section. Use the same reference for the same object across runs even if its label changes. Never derive a reference by lower-casing or slugging the label.
23
+
24
+ **Unit id.** Percent-encode each canonical reference (keep only `A-Z a-z 0-9 - . _ ~`, every other byte becomes uppercase `%HH`), then join surface, boundary, area and class with `::`. In `deep` runs append the lifecycle mode (install, upgrade, migration, rollback, recovery) when it matters. Leave out of the id anything that changes between runs: line numbers, wave, agent, verdict, severity. References must be NFC text with no control or invisible characters and no surrounding spaces.
25
+
26
+ Sort units by id before every assignment. Two units with the same id are an error; if their other fields differ, it is an identity collision. Stop and fix the references; never merge or overwrite.
27
+
28
+ Granularity follows the profile: `quick` collapses the area dimension to the fixed reference `profile/quick/all-areas`; `standard` uses one unit per area; `deep` adds lifecycle modes.
29
+
30
+ ## `ledger.json`
31
+
32
+ Lives in the audit directory next to `findings.json`. The coordinator is its only writer. Shape:
33
+
34
+ ```json
35
+ {
36
+ "run": { "id": "...", "profile": "standard", "scope": ["..."],
37
+ "source": { "head": "<commit>", "dirty": false, "tree_hash": "<sha256>" },
38
+ "budget": { "limit": 60, "spent": 0, "reserved": { "critics": 2, "verification": 12 } },
39
+ "wave": 1 },
40
+ "units": [{
41
+ "id": "...", "surface": "code", "area": "packages/api",
42
+ "boundary": "...", "class": "...", "refs": { "surface": "...", "boundary": "...", "area": "...", "class": "..." },
43
+ "starting_paths": ["packages/api/src/users.ts"],
44
+ "class_sections": ["classes/access-control.md#Object-level authorization"],
45
+ "excluded_sections": [{ "section": "...", "reason": "source fact that excludes it" }],
46
+ "prior": "new|same_source_done|changed_source|prior_needs_validation|prior_not_reviewed|prior_blocked|none",
47
+ "priority": 1,
48
+ "status": "pending",
49
+ "owner": null, "attempt": 1, "requeued_shallow": false,
50
+ "reviewed_paths": [], "checks": [], "findings": [], "reason": null,
51
+ "hardening": [], "attempts": []
52
+ }],
53
+ "candidates": [{ "id": "...", "units": ["..."], "state": "awaiting_verification|verifying|decided", "verifier": null }]
54
+ }
55
+ ```
56
+
57
+ `checks[]` entries: `{ "agent": "...", "reviewed_paths": [...], "invariant": "...", "method": "source|isolated", "result": "...", "artifact": "evidence/<agent>/<file>" | null }`. A source check has `artifact: null`. An isolated check points at a file promoted into `evidence/` under the rules in [isolated execution](isolated-execution.md); scratch paths are never evidence. The unit's `reviewed_paths` is exactly the union of its checks' paths.
58
+
59
+ ## Statuses
60
+
61
+ | Status | owner | reviewed_paths / checks | findings | reason |
62
+ |---|---|---|---|---|
63
+ | `pending` | null | empty | empty | null |
64
+ | `in_progress` | agent id | empty | empty | null |
65
+ | `done` | agent id | both non-empty | candidate ids, or empty if nothing survived | null |
66
+ | `blocked` | agent id | both non-empty (partial, owned) | empty | the exact blocker |
67
+ | `not_reviewed` | null | empty | empty | why: `out_of_scope`, `budget`, `profile`, `not_applicable` plus a sentence |
68
+
69
+ Agent ids are lower-case, match `^[a-z0-9][a-z0-9_-]{0,63}$`, and are never a Windows device name (`con`, `prn`, `aux`, `nul`, `com1`–`com9`, `lpt1`–`lpt9`).
70
+
71
+ A unit becomes `done` only from a hunter's structured result naming the paths it read and the checks it made. Partial evidence never hides inside `not_reviewed`; partial work is `blocked` with its blocker.
72
+
73
+ When a run ends, the coordinator copies each unit into `findings.json` → `coverage.units[]` as `{id, surface, area, boundary, class, status, reason, findings}`. Any unit still `pending` or `in_progress` at that moment is written as `not_reviewed` with the reason, and the run is `partial`.
74
+
75
+ ### Re-opening a unit
76
+
77
+ When a critic re-opens a `done` or `blocked` unit, push its current live fields (`attempt`, `status`, `owner`, `reviewed_paths`, `checks`, `findings`, `reason`) plus the critic's source-backed reason into `attempts[]`, unchanged. Increment `attempt`, clear the live fields, set `pending`. The next hunter is a new agent. Never copy an archived attempt's checks or evidence into the live fields.
78
+
79
+ ## Claiming coverage honestly
80
+
81
+ - **Complete** coverage needs every in-scope unit `done` with evidence, every detected platform `reviewed`, and a clean final critic pass (below). Only then may `run.status` be `complete`. A run with no units and no platforms reviewed nothing and is never complete; `validate-findings.mjs` refuses all of these.
82
+ - **Partial** is the honest answer for everything else: a `blocked` or `not_reviewed` unit (its `reason` says why), a platform not reviewed, `quick` profile, scoped run, budget stop, interrupted run not yet resumed, unverified candidates, a mandatory critic that could not run. Set `run.status: "partial"` and a `partial_reason` that names the cause in one line (`quick profile`, `budget exhausted before wave 3`, `scoped to packages/billing`, `4 candidates not verified`).
83
+ - The report's coverage section is derived from the ledger counts, never written freehand.
84
+ - A unit closed without paths and checks is a critic target, not coverage.
85
+
86
+ ## Critics and extra waves
87
+
88
+ After every hunter wave, a fresh read-only **post-wave critic** receives `architecture.md`, the full ledger (including class sections per unit), the current candidate ids and states, and the prior-run gap list. It hunts for coverage gaps, not vulnerabilities:
89
+
90
+ - entry points the ledger never mapped;
91
+ - parallel paths to the same effect nobody checked (batch, legacy, retry, admin, import, migration);
92
+ - lifecycle modes missing;
93
+ - selected class sections with no unit, and exclusions whose reason does not hold;
94
+ - units marked `done` without real paths and checks, or with checks that do not test the stated invariant;
95
+ - prior `needs_validation`, `not_reviewed` or changed-source items no unit covers.
96
+
97
+ It returns JSON only:
98
+
99
+ ```json
100
+ { "missing_units": [{ "surface": "...", "boundary": "...", "area": "...", "class": "...",
101
+ "starting_paths": ["..."], "class_sections": ["..."],
102
+ "excluded_sections": [{ "section": "...", "reason": "..." }],
103
+ "reason": "source-backed gap" }],
104
+ "reopen": ["unit id"],
105
+ "resolved_prior": ["finding id"],
106
+ "clean": false }
107
+ ```
108
+
109
+ The coordinator drops proposals outside scope or outside the isolation rules, computes ids, deduplicates, re-opens legitimate units as described above, validates, and queues a new wave. `clean` is the critic's opinion; the coordinator's loop decides.
110
+
111
+ When a post-wave critic yields nothing accepted and no unit is `pending`, a **second, different** fresh critic does a **final clean pass**. Coverage is complete only if that one also yields nothing. If it finds work, run another wave, post-wave critic and final clean pass.
112
+
113
+ In `quick`, there is one wave and one critic, and no follow-up wave: accepted missing units and re-opens are recorded `not_reviewed` with reason `profile: quick, critic found after the only wave`.
114
+
115
+ ## Profiles and default budgets
116
+
117
+ Pick the profile from the request; otherwise propose one from target size and stakes. Default: `standard`. The budget counts **agent invocations across all phases** (recon, hunters including shallow re-queues, critics, verifiers). These are defaults, not ceilings: the owner can raise or lower them, and the run records the value used in `ledger.json` → `run.budget.limit` and in the report.
118
+
119
+ | | `quick` | `standard` | `deep` |
120
+ |---|---|---|---|
121
+ | Use for | small targets, re-runs, a first look | ordinary audit | high stakes, large or multi-service targets |
122
+ | Unit grain | surface × boundary × class (areas collapsed) | per area | per area and lifecycle mode |
123
+ | Recon agents | 3 (R1, R2+R4 merged, R3) | 4–5 | up to 8 |
124
+ | Hunter waves | exactly 1 | up to 3 | up to 6, until clean |
125
+ | Critics | 1 post-wave, no final clean | 1 per wave + 1 final clean | 1 per wave + 1 final clean |
126
+ | Verifiers per candidate | 1 (candidate and final checks merged) | 2 (separate fresh agents) | 2, plus an independent second hunter pass on units carried from a same-source prior run |
127
+ | **Default budget** | **25** | **70** | **180** |
128
+
129
+ Profiles change breadth and redundancy. They never lower the evidence bar: the candidate gate, the isolation rules, `needs_validation` discipline, `scripts/validate-findings.mjs`, and independent verification of every `confirmed` finding apply in every profile.
130
+
131
+ ### Spending the budget
132
+
133
+ 1. **Check before recon.** The budget must at least cover baseline recon, the critics the profile requires, and one verifier. If it cannot, launch nothing; ask once for a bigger budget, narrower scope or lighter profile. If the answer does not change, write a `partial` run with reason `budget cannot fund recon and reserves` and report that no pass ran.
134
+ 2. **Reserve before each wave**: the post-wave critic, the final-clean critic (`standard`/`deep`), and verification (per-candidate verifiers × expected candidates; when unsure, 30% of what remains after critics). Hunters never spend reserved invocations.
135
+ 3. **Assign by priority** until the wave's allowance is used:
136
+ 1. lowest-trust or unauthenticated entry points first;
137
+ 2. boundaries guarding the most valuable things (credentials, other tenants' data, code execution, release and signing authority);
138
+ 3. prior-run gaps, revalidations and changed source before same-source repeats;
139
+ 4. classes that tend to produce confirmed findings for this kind of target before speculative ones;
140
+ 5. ties broken by unit id, so runs are repeatable.
141
+ Record the ordering reason in the ledger.
142
+ 4. **Units the budget cannot reach** become `not_reviewed` with reason `budget`. Critic-proposed units join the same ranked queue; they do not extend the budget.
143
+ 5. **Too many candidates** for the verification reserve: stop hunting, verify in id order while budget lasts, leave the rest as `awaiting_verification` in `ledger.json` → `candidates[]`. They never enter `findings.json`. Run is `partial` with reason `N candidates not verified`, and the report lists their ids and units.
144
+ 6. Never exceed an owner-set budget silently. If it binds, say where.
145
+
146
+ Before wave 1, update the estimate: units seeded, hunters implied, critic and verification reserves, and whether the budget covers the plan. If it clearly does not, propose a tighter scope or lighter profile instead of thinning the evidence.
147
+
148
+ ## Scoped runs
149
+
150
+ A scoped run covers only part of the target: some paths, one area, one class file, or the diff between two commits. Seed units only for in-scope surfaces. Surfaces discovered outside scope are still recorded, as `not_reviewed` with reason `out_of_scope`, so a later full run turns them into work. Critics report out-of-scope gaps too; they are recorded, not assigned. A scoped run is always `partial` and says what it left out.
151
+
152
+ ## Prior runs are additive
153
+
154
+ Read every earlier `findings.json` and `ledger.json` for the same target before seeding. Compare relevant current source against each prior record and unit; a commit hash alone does not prove a path unchanged.
155
+
156
+ | Prior state | This run |
157
+ |---|---|
158
+ | `confirmed`, source unchanged | Carry the finding with the same id into the candidate queue, link it to a `pending` unit with `prior: same_source_done`, tell hunters to skip only that root cause, and send it through current verification. Its first verifier becomes the unit owner |
159
+ | `confirmed`, source changed | New `pending` revalidation unit with `prior: changed_source`. Hunters are **not** told to skip it. It stays confirmed only if current verification re-establishes it |
160
+ | `needs_validation` | Current work. Carry the record only after its trace is checked against current source; it keeps its missing fact until new evidence resolves it |
161
+ | `not_reviewed`, `blocked`, changed-source units | Current `pending` work, ranked high |
162
+ | `done`, source unchanged | Stays visible; may lower priority; a critic decides whether it needs another pass (`deep` always gives it one) |
163
+ | `rejected`, unchanged | Suppresses only that exact claim, never the unit. Changed evidence reopens it |
164
+ | `quick` or scoped prior run | Contributes its recorded evidence and gaps only, never an implied "the rest was fine" |
165
+
166
+ When no prior run exists, the report says so.
167
+
168
+ ## Validation
169
+
170
+ After every update to `ledger.json`, the coordinator checks it against the status table above (unique sorted ids, owner and evidence rules per status, unit paths equal to the union of check paths, every artifact under `evidence/`). An invalid ledger drives no further assignment.
171
+
172
+ Whenever `findings.json` is written (after each verification batch and before rendering), run `node scripts/validate-findings.mjs <audit-dir>`. It checks that cited files and lines exist, evidence files exist inside the audit directory, units and findings reference each other correctly, and no secret is visible. Fix every error before assigning more work or claiming coverage. A passing validator proves structure and consistency, not that the findings are true.