project-brain 0.22.3 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +7 -7
- package/templates/skills/brain-audit/SKILL.md +174 -8
- package/templates/skills/brain-audit/references/abuse.md +34 -24
- package/templates/skills/brain-audit/references/accessibility.md +41 -21
- package/templates/skills/brain-audit/references/ai.md +28 -18
- package/templates/skills/brain-audit/references/analytics.md +73 -0
- package/templates/skills/brain-audit/references/api.md +27 -17
- package/templates/skills/brain-audit/references/backend.md +24 -16
- package/templates/skills/brain-audit/references/complexity.md +30 -17
- package/templates/skills/brain-audit/references/concurrency.md +28 -19
- package/templates/skills/brain-audit/references/consistency.md +32 -24
- package/templates/skills/brain-audit/references/contract-drift.md +30 -19
- package/templates/skills/brain-audit/references/cost.md +35 -24
- package/templates/skills/brain-audit/references/cross-surface-parity.md +70 -0
- package/templates/skills/brain-audit/references/database.md +42 -24
- package/templates/skills/brain-audit/references/dependencies-licensing.md +34 -23
- package/templates/skills/brain-audit/references/design-system.md +99 -0
- package/templates/skills/brain-audit/references/devops.md +38 -24
- package/templates/skills/brain-audit/references/documentation.md +35 -23
- package/templates/skills/brain-audit/references/failure.md +33 -21
- package/templates/skills/brain-audit/references/feature-flags.md +87 -0
- package/templates/skills/brain-audit/references/flow-integrity.md +58 -33
- package/templates/skills/brain-audit/references/frontend.md +36 -19
- package/templates/skills/brain-audit/references/functional.md +38 -17
- package/templates/skills/brain-audit/references/future.md +32 -12
- package/templates/skills/brain-audit/references/goal.md +19 -12
- package/templates/skills/brain-audit/references/i18n.md +37 -23
- package/templates/skills/brain-audit/references/idempotency.md +76 -0
- package/templates/skills/brain-audit/references/infrastructure.md +31 -22
- package/templates/skills/brain-audit/references/mobile.md +32 -23
- package/templates/skills/brain-audit/references/multi-tenancy.md +74 -0
- package/templates/skills/brain-audit/references/numeric.md +70 -0
- package/templates/skills/brain-audit/references/observability.md +36 -21
- package/templates/skills/brain-audit/references/packaging.md +27 -19
- package/templates/skills/brain-audit/references/performance.md +48 -21
- package/templates/skills/brain-audit/references/privacy.md +39 -25
- package/templates/skills/brain-audit/references/product.md +31 -12
- package/templates/skills/brain-audit/references/prompt-spec-gap.md +25 -18
- package/templates/skills/brain-audit/references/reachability.md +28 -20
- package/templates/skills/brain-audit/references/repo-history.md +65 -0
- package/templates/skills/brain-audit/references/scalability.md +35 -22
- package/templates/skills/brain-audit/references/security.md +50 -33
- package/templates/skills/brain-audit/references/state-model.md +73 -0
- package/templates/skills/brain-audit/references/supply-chain.md +64 -0
- package/templates/skills/brain-audit/references/temporal.md +66 -0
- package/templates/skills/brain-audit/references/testing.md +49 -24
- package/templates/skills/brain-audit/references/tooling-baseline.md +77 -0
- package/templates/skills/brain-audit/references/type-safety.md +68 -0
- package/templates/skills/brain-audit/references/versioning-compatibility.md +33 -22
- package/templates/skills/brain-audit/references/visual-design.md +89 -0
- package/templates/skills/brain-audit/references/web-metadata.md +72 -0
package/README.md
CHANGED
|
@@ -197,7 +197,7 @@ Unlike the `/brain-*` commands above, these have no CLI equivalent. They are **h
|
|
|
197
197
|
|
|
198
198
|
`project-brain setup` installs them into each registered tool's global skills directory (`~/.claude/skills/`, `~/.codex/skills/`, or the shared `~/.agents/skills/`). Opt out with `project-brain setup --no-skills` (`--no-brain-audit` still works as an alias).
|
|
199
199
|
|
|
200
|
-
**Both are offered, not scheduled.** Nothing invokes them for you and nothing fires on commit — you decide when. `brain-audit` runs discovery, proposes an audit module set, and waits for you to confirm before loading anything:
|
|
200
|
+
**Both are offered, not scheduled.** Nothing invokes them for you and nothing fires on commit — you decide when. `brain-audit` runs discovery, proposes an audit module set, and waits for you to confirm before loading anything: 49 modules exist, and loading all of them every time is what makes an audit expensive. `brain-okf` proposes the type, title, and anchor and waits before creating a file, because whether an insight deserves a permanent home is your call, not the assistant's.
|
|
201
201
|
|
|
202
202
|
Setup never overwrites a skill directory it did not create. Ownership is proven per directory, so your own hand-written `brain-okf/` is left untouched — and reported — while `brain-audit/` upgrades beside it.
|
|
203
203
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "project-brain",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Local-first MCP server that gives AI tools semantic memory of your codebase.",
|
|
6
6
|
"author": "jcsoftdev",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@anthropic-ai/sdk": "^0.111.0",
|
|
40
40
|
"@clack/prompts": "^1.7.0",
|
|
41
|
-
"@lancedb/lancedb": "
|
|
41
|
+
"@lancedb/lancedb": "0.37.1",
|
|
42
42
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
43
43
|
"exceljs": "^4.4.0",
|
|
44
44
|
"mammoth": "^1.11.0",
|
|
@@ -49,11 +49,11 @@
|
|
|
49
49
|
"zod": "^4.4.3"
|
|
50
50
|
},
|
|
51
51
|
"optionalDependencies": {
|
|
52
|
-
"project-brain-darwin-arm64": "0.
|
|
53
|
-
"project-brain-linux-x64": "0.
|
|
54
|
-
"project-brain-linux-arm64": "0.
|
|
55
|
-
"project-brain-windows-x64": "0.
|
|
56
|
-
"project-brain-windows-arm64": "0.
|
|
52
|
+
"project-brain-darwin-arm64": "0.23.0",
|
|
53
|
+
"project-brain-linux-x64": "0.23.0",
|
|
54
|
+
"project-brain-linux-arm64": "0.23.0",
|
|
55
|
+
"project-brain-windows-x64": "0.23.0",
|
|
56
|
+
"project-brain-windows-arm64": "0.23.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@types/bun": "latest",
|
|
@@ -4,7 +4,7 @@ description: "Trigger: audit this project, comprehensive audit, full codebase au
|
|
|
4
4
|
license: Apache-2.0
|
|
5
5
|
metadata:
|
|
6
6
|
author: jcsoftdev
|
|
7
|
-
version: "2.
|
|
7
|
+
version: "2.2"
|
|
8
8
|
generator: project-brain
|
|
9
9
|
---
|
|
10
10
|
|
|
@@ -43,9 +43,124 @@ Do not apply when: the ask is scoped to one diff, PR, or file; or the project is
|
|
|
43
43
|
| Results look empty or stale | `check_health` (read `chunks`, not just success), then `sync_project` |
|
|
44
44
|
|
|
45
45
|
- `find_callers` returning empty means no **in-repo** caller. Before reporting dead code, rule out: public API surface, dynamic dispatch, reflection, string-keyed registries, framework-convention entry points. State which you ruled out.
|
|
46
|
-
- Every finding requires: Title, Category, Severity, Confidence (0-100%), Evidence (`file:line`), Business impact, Technical impact, Recommendation, Priority
|
|
46
|
+
- Every finding requires: Title, Category, Severity, **Evidence Tier**, Confidence (0-100%), Evidence (`file:line`), Business impact, Technical impact, Recommendation, Priority, **Refutation**. Never invent a finding.
|
|
47
|
+
- **No finding at Medium or above reaches the report without a refutation verdict.** Not refuted, not declined, not below threshold — one of those four, stated. A finding whose `Refutation` field is empty has not finished the pipeline.
|
|
47
48
|
- Severity vocabulary is exactly: Critical | High | Medium | Low | Info.
|
|
48
49
|
|
|
50
|
+
## Evidence Contract
|
|
51
|
+
|
|
52
|
+
The single most likely failure of this audit is not missing a defect — it is reporting one that is not there. A confident finding with nothing behind it is indistinguishable, to the reader, from a real one, and it costs them the afternoon that proves it false. Every finding therefore declares **how it was established**, and that declaration caps how severe it is allowed to be.
|
|
53
|
+
|
|
54
|
+
| Tier | Established by | Severity ceiling |
|
|
55
|
+
|---|---|---|
|
|
56
|
+
| `executed` | A command was run and its output read. Reserved — no module in this skill executes anything today. | Critical |
|
|
57
|
+
| `traced` | A structural proof from project-brain: `trace_path`, `find_callers`, `find_callees`, or `impact` showing the path exists, or provably does not. | Critical |
|
|
58
|
+
| `read` | A cited `file:line` whose content was actually read, quoted or paraphrased faithfully. | High |
|
|
59
|
+
| `inferred` | A pattern, a naming smell, or an absence with no probe run against it. | Medium |
|
|
60
|
+
|
|
61
|
+
- **An `inferred` finding can never exceed `Medium`**, no matter how severe it would be if true. Its severity is a function of what you proved, not of what you fear. If it deserves `Critical`, go and prove it — then it is `traced` and it earns the severity.
|
|
62
|
+
- A finding with no tier is not a finding. Drop it or promote it.
|
|
63
|
+
- Confidence is separate from tier: tier says *what kind* of evidence, confidence says *how strong*. A `read` finding with one ambiguous line is `read` at 40%.
|
|
64
|
+
|
|
65
|
+
**Falsification is part of the finding.** For every check that can produce a false positive, state what would refute it and confirm you ruled that out. `reachability.md` and `concurrency.md` already do this; the pattern is the standard, not their local quirk.
|
|
66
|
+
|
|
67
|
+
**"No findings" is a complete and valid result — when it is earned.** A module that ran its probes and found nothing reports clean, and that is the deliverable. Nothing here rewards volume, and a padded module is worse than an absent one: it buries the real findings among the invented ones. Never manufacture a finding to justify having run a module.
|
|
68
|
+
|
|
69
|
+
The counterweight, because this rule cuts both ways: **a clean result is only valid if the probes actually ran.** Not looking produces the same output as looking and finding nothing, and the two are indistinguishable in the report. So a module reporting clean states which probes it ran and what they returned. "No hardcoded colours — `search_code` for `#[0-9a-f]{3,8}` returned 4 hits, all inside the token file" is a clean result. "No issues found" is not a result at all.
|
|
70
|
+
|
|
71
|
+
This matters more than it looks. Measured precision for frontier models on security review runs 29-42%, so most raw findings are false — but the same research finds that **models miss far more than they invent**, and that a report with fewer findings reads as more accurate precisely when it is least accurate. That is the precision paradox: the audit that missed everything and the audit that found nothing look identical on the page. Suppressing a real finding is the failure this skill is worst at noticing in itself.
|
|
72
|
+
|
|
73
|
+
## Refutation
|
|
74
|
+
|
|
75
|
+
The Evidence Contract governs how a finding is established. This section governs whether it survives.
|
|
76
|
+
|
|
77
|
+
Falsification inside a check is self-falsification: performed by the agent that wants the finding to be true, in the context that produced it, moments after producing it. It is worth doing and it is not adversarial. Measured precision for frontier models on security review is 29-42%, so most raw findings are false, and a pipeline whose findings graduate by default inherits that number wholesale. Refute-or-Promote (arXiv 2604.19049) killed roughly 79% of 171 candidates before disclosure, 83% prospectively on a 30-candidate subset, by giving a separate agent one instruction: destroy this. That is the stage.
|
|
78
|
+
|
|
79
|
+
**This is not a quota.** Those numbers are an outcome on someone else's corpus, not a target for yours. A refuter that kills four in five because it was told four in five should die has replaced one bias with a worse one — and the worse one is invisible, because a wrongly killed finding leaves nothing on the page to argue with. Killing real findings compounds the failure this audit is already worst at: the same research finds false-negative bias exceeds false-positive bias in every model tested. Refutation trades recall for precision on purpose. The user is entitled to know which way the trade points, so the report says so.
|
|
80
|
+
|
|
81
|
+
### What gets refuted
|
|
82
|
+
|
|
83
|
+
Every finding at **Medium or above**, one refuter each. Low and Info are exempt on cost of error — a false Low costs a shrug, a false High costs an afternoon — and carry `not attempted (below threshold)` rather than passing silently. The threshold sits at Medium and not at High because `inferred` caps at Medium, so every speculative finding in the report lands exactly on the line, and speculative findings are the cheapest to kill and the likeliest to be false.
|
|
84
|
+
|
|
85
|
+
One refuter per finding. A second is launched only when the first returns `undetermined` on a Critical or High finding, and it is told which probes were already inconclusive so it does not repeat them. Never a third. Two refuters on identical briefs are not independent, and a panel is a design that only pays at a hundred findings.
|
|
86
|
+
|
|
87
|
+
### The mandate
|
|
88
|
+
|
|
89
|
+
The refuter is told to destroy the finding, and told that destruction is expensive. It may kill on exactly one of five grounds, and must name it:
|
|
90
|
+
|
|
91
|
+
| Ground | Requires |
|
|
92
|
+
|---|---|
|
|
93
|
+
| `MISQUOTE` | The cited location does not contain what the finding says it does. |
|
|
94
|
+
| `GUARD` | A check, constraint, schema, or type at a cited `file:line` makes the described failure impossible. |
|
|
95
|
+
| `UNREACHABLE` | A structural probe shows the path the finding depends on does not exist. Quote the probe result. |
|
|
96
|
+
| `IMPOSSIBLE` | The mechanism cannot occur in this language or runtime. Concretely; "unlikely" is not this ground. |
|
|
97
|
+
| `INTENDED` | The behaviour is deliberately enforced. Cite the enforcing code, not a comment describing it. |
|
|
98
|
+
|
|
99
|
+
A kill requires evidence at the tier the finding claims, or higher. **Failing to find support for a finding is not refuting it** — that is `unrefuted`, and it is a correct and complete answer. Every verdict, kills and survivals alike, lists the probes that were run; a verdict with no probe list is void and the finding survives. This is the clean-module rule from the Evidence Contract applied one level up: not looking and looking-and-finding-nothing produce the same verdict, and only the probe list separates them.
|
|
100
|
+
|
|
101
|
+
The refuter cannot execute anything. If a claim can only be settled by running the code, the verdict is `undetermined`.
|
|
102
|
+
|
|
103
|
+
### Context asymmetry
|
|
104
|
+
|
|
105
|
+
The refuter is a subagent with a fresh context. It receives the title, the module and the single check bullet that produced the finding, the claimed severity and tier, the cited `file:line` list, the finder's quoted excerpt, and the finder's stated rule-out. Nothing else.
|
|
106
|
+
|
|
107
|
+
It does not receive the finder's confidence figure, its reasoning, its tool transcript, any other finding, the full module reference, the discovery summary, or **any of the project's self-description**. That last exclusion is the same instrument as `## Reading the project's own words`, and it matters more here: a refuter under a kill mandate reads a confident README as a ready-made `GUARD`. Metadata redaction recovered 68.75% of suppressed detections in study; the explicit instruction recovered 94%; the refuter gets both, because together they are four lines of prompt.
|
|
108
|
+
|
|
109
|
+
The excerpt is handed over **as a quotation to be checked against the file, never as a fact**. Withhold it and `MISQUOTE` becomes undetectable — there is nothing to compare the file against. Hand it over as evidence and the refuter reasons from the quote instead of the code. Hand it over as a claim about the file and both failures close.
|
|
110
|
+
|
|
111
|
+
### Mode, and honest degradation
|
|
112
|
+
|
|
113
|
+
| Mode | Condition |
|
|
114
|
+
|---|---|
|
|
115
|
+
| `cross-model` | A subagent ran on a model you can **name**, different from the one you can **name** for yourself. |
|
|
116
|
+
| `cross-context` | A subagent ran on a fresh context; one or both model ids unknown, or only one model available. |
|
|
117
|
+
| `self-review` | No subagent mechanism. Not adversarial. |
|
|
118
|
+
|
|
119
|
+
**Never label a run `cross-model` unless both model ids appear in the report.** Requesting a different model is not evidence a different model answered; unconfirmed, it is `cross-context (model unknown)`.
|
|
120
|
+
|
|
121
|
+
`self-review` verdicts are reported as `self-reviewed`, never as `survived`, and the Executive Summary states that no adversarial stage ran. In this mode a refuter's probe can never promote a tier — a probe run in the finder's own context is not a new instrument, it is the finder running one more probe, which step 4 already required.
|
|
122
|
+
|
|
123
|
+
### Verdicts
|
|
124
|
+
|
|
125
|
+
| Verdict | Effect |
|
|
126
|
+
|---|---|
|
|
127
|
+
| `refuted` | Removed from Findings. One line in the Refutation Ledger. |
|
|
128
|
+
| `weakened` | Survives at the reduced severity the refuter names; tier drops if the surviving part rests on weaker evidence. |
|
|
129
|
+
| `unrefuted` | Survives unchanged. |
|
|
130
|
+
| `undetermined` | Survives, **capped at Medium**, flagged as unsettled by static analysis. |
|
|
131
|
+
|
|
132
|
+
`weakened` carries most of the value. The common outcome is not "this is fake" but "this is a Medium wearing a Critical's clothes" — the injection is real, the input is an internal enum. Without its own verdict that outcome is either a lost true finding or a retained inflated severity.
|
|
133
|
+
|
|
134
|
+
### How this extends the Evidence Contract
|
|
135
|
+
|
|
136
|
+
Two additions, both additive; the tiers and their ceilings are otherwise untouched.
|
|
137
|
+
|
|
138
|
+
- A required `Refutation` field on every finding: `<verdict> · <mode> · <one-line note>`.
|
|
139
|
+
- One new ceiling: **`undetermined` caps at Medium** — the same ceiling `inferred` carries, for the same reason. An unverified claim is unverified regardless of which stage failed to verify it. The tier records what established the finding; the cap records what is still unknown; they stay separate.
|
|
140
|
+
|
|
141
|
+
**Surviving refutation does not promote a tier.** Tier states what kind of evidence established a finding, and survival is the absence of a counter-proof. Promoting `read` to `traced` because nobody could kill it launders an absence into a proof — the same category error as letting confidence bleed into tier. The one legitimate exception is not an exception to this rule but an application of the contract: **a refuter's probe result is evidence like any other and is tiered on its own merits.** If the refuter, trying to kill, runs a `trace_path` the finder never ran and it confirms the path, the finding is now `traced` and cites that probe. The promotion comes from the probe, never from the survival.
|
|
142
|
+
|
|
143
|
+
### The ledger
|
|
144
|
+
|
|
145
|
+
Killed findings are reported, one line each, in a **Refutation Ledger** after Coverage Gaps: title, location, claimed severity, ground, and the refutation in a sentence. Never in Findings by Severity, and the section header says so.
|
|
146
|
+
|
|
147
|
+
They are reported rather than dropped because a killed finding is a claim that will be made again — by the next audit, by a reviewer, by a scanner — and the ground of the kill is durable knowledge the audit already paid for. Because a ledger of thin refutations is how the user catches a refuter that is over-killing, and silent dropping makes the kill stage unfalsifiable. And because of the precision paradox one more time: a three-finding report with no ledger is indistinguishable from an audit that never ran, while three findings over a fourteen-line ledger shows the shape of the work.
|
|
148
|
+
|
|
149
|
+
## Reading the project's own words
|
|
150
|
+
|
|
151
|
+
Several modules deliberately read what the project says about itself — the stated goal in `goal.md`, the README claims in `functional.md`, the docs in `documentation.md`, commit messages in `repo-history.md`. That input is necessary: you cannot audit "claimed versus real behaviour" without the claim.
|
|
152
|
+
|
|
153
|
+
It is also the single largest measured threat to this audit's accuracy. In controlled study, framing code as potentially vulnerable raised false positives by only 0.8-13.6 percentage points, while framing the same code as bug-free **dropped detection by 16 to 93 percentage points**. A confident README, a commit message asserting a fix, a doc section describing a safeguard — each is that framing, and each arrives before the code does.
|
|
154
|
+
|
|
155
|
+
So, without exception:
|
|
156
|
+
|
|
157
|
+
- **Project self-description is a claim under test, never evidence that the claim holds.** "The docs say inputs are validated" is a hypothesis to check, and finding no validation is the finding — not a contradiction to explain away.
|
|
158
|
+
- **Never let a stated intention lower suspicion.** A comment saying `// sanitised upstream`, a variable named `safeInput`, a test file named `security.test.ts` — none of these are evidence. Trace the value.
|
|
159
|
+
- **When a module has read the project's claims, say so in that module's findings.** A reader deserves to know which conclusions were formed after exposure to the project's own framing.
|
|
160
|
+
- Where a check can be run against the code alone, **run it against the code alone first**, and only then compare with what the project says. The order matters: the claim seen first sets the expectation the probe is then read against.
|
|
161
|
+
|
|
162
|
+
In the study that measured this, an explicit instruction to disregard the framing recovered 94% of the detections it had suppressed. This section is that instruction. It is cheap and it works — but only if it is applied while reading, not recalled afterwards.
|
|
163
|
+
|
|
49
164
|
## Decision Gates
|
|
50
165
|
|
|
51
166
|
Gates propose; they do not decide. Render each module as `suggested` or `not applicable (reason)`, then ask.
|
|
@@ -64,9 +179,23 @@ The `Reference` column is the exact filename under `references/` — load that f
|
|
|
64
179
|
| | Consistency | `consistency.md` |
|
|
65
180
|
| | Documentation | `documentation.md` |
|
|
66
181
|
| | Prompt/Spec Gap | `prompt-spec-gap.md` |
|
|
182
|
+
| Linter, formatter, type-checker, test-runner, or scanner config present **or conspicuously absent** | Tooling Baseline | `tooling-baseline.md` |
|
|
183
|
+
| Project is a git repository | Repo History | `repo-history.md` |
|
|
184
|
+
| Statically or gradually typed language | Type Safety | `type-safety.md` |
|
|
67
185
|
| Server framework or API routes present | Backend | `backend.md` |
|
|
68
186
|
| | API | `api.md` |
|
|
187
|
+
| Enumerated states, a status column, or a state library | State Model | `state-model.md` |
|
|
188
|
+
| Two surfaces in one repo, or shared types across them | Cross-Surface Parity | `cross-surface-parity.md` |
|
|
189
|
+
| Dates, schedules, expiry, or scheduling logic present | Temporal | `temporal.md` |
|
|
190
|
+
| Monetary, quantity, or unit-bearing fields present | Numeric & Money | `numeric.md` |
|
|
191
|
+
| Retries, webhooks, queues, or externally-triggered writes | Idempotency | `idempotency.md` |
|
|
192
|
+
| Tenant, organisation, or workspace scoping present | Multi-tenancy | `multi-tenancy.md` |
|
|
193
|
+
| Feature-flag SDK or flag registry present | Feature Flags | `feature-flags.md` |
|
|
194
|
+
| Serves HTML to a browser | Web Metadata | `web-metadata.md` |
|
|
195
|
+
| User-facing product — analytics SDK present **or conspicuously absent** | Product Analytics | `analytics.md` |
|
|
69
196
|
| UI framework present | Frontend | `frontend.md` |
|
|
197
|
+
| | Design System | `design-system.md` |
|
|
198
|
+
| | Visual Design | `visual-design.md` |
|
|
70
199
|
| | Accessibility | `accessibility.md` |
|
|
71
200
|
| Native mobile project | Mobile | `mobile.md` |
|
|
72
201
|
| Schema, migrations, or ORM present | Database | `database.md` |
|
|
@@ -84,12 +213,13 @@ The `Reference` column is the exact filename under `references/` — load that f
|
|
|
84
213
|
| Published package manifest or release workflow | Packaging | `packaging.md` |
|
|
85
214
|
| | Versioning & Compatibility | `versioning-compatibility.md` |
|
|
86
215
|
| Lockfile or dependency manifest present | Dependencies & Licensing | `dependencies-licensing.md` |
|
|
216
|
+
| | Supply Chain | `supply-chain.md` |
|
|
87
217
|
| LLM / AI SDK calls, or metered cloud usage | Cost | `cost.md` |
|
|
88
218
|
| Test files present **or conspicuously absent** | Testing | `testing.md` |
|
|
89
219
|
| Locale files or translation keys present | i18n | `i18n.md` |
|
|
90
220
|
| OpenAPI, GraphQL, protobuf, or shared types | Contract Drift | `contract-drift.md` |
|
|
91
221
|
|
|
92
|
-
The absence gates (`Observability`, `Testing`) fire in both directions on purpose: "this project has no tests at all" is a finding, not a reason to skip the module.
|
|
222
|
+
The absence gates (`Observability`, `Testing`, `Design System`, `Type Safety`, `Product Analytics`) fire in both directions on purpose: "this project has no tests at all" is a finding, not a reason to skip the module. The same holds for a UI with no declared token source — that is the module's headline finding, not a reason it cannot run.
|
|
93
223
|
|
|
94
224
|
### Establishing each signal
|
|
95
225
|
|
|
@@ -98,7 +228,8 @@ The absence gates (`Observability`, `Testing`) fire in both directions on purpos
|
|
|
98
228
|
| Signal | How to establish it |
|
|
99
229
|
|---|---|
|
|
100
230
|
| Server framework / API routes | `get_architecture` frameworks; else `search_code` the route-registration call |
|
|
101
|
-
| UI framework | `get_architecture` frameworks |
|
|
231
|
+
| UI framework | `get_architecture` frameworks; else `search_code` for a component file extension (`.tsx`, `.vue`, `.svelte`) or a stylesheet entry point — a project can render UI without a framework in the manifest |
|
|
232
|
+
| Styling system and token source | `search_code` for `tailwind.config`, `@theme`, `:root {`, `--color-`, `tokens.json`, a theme module, or the platform theme type — **absence fires the `Design System` gate rather than skipping it**, since "no declared design vocabulary" is the strongest finding that module can return |
|
|
102
233
|
| Native mobile project | `search_code` for `AndroidManifest.xml`, `Info.plist`, `pubspec.yaml`, `*.xcodeproj` |
|
|
103
234
|
| Schema / migrations / ORM | `search_code` for a migrations directory, `schema.sql`, or an ORM dependency |
|
|
104
235
|
| LLM / AI SDK calls | `search_code` the provider SDK import |
|
|
@@ -114,6 +245,18 @@ The absence gates (`Observability`, `Testing`) fire in both directions on purpos
|
|
|
114
245
|
| Locale files / translation keys | `search_code` for a locales directory or the translation function |
|
|
115
246
|
| OpenAPI / GraphQL / protobuf / shared types | `search_code` for `openapi`, `.graphql`, `.proto`, or a shared-types package |
|
|
116
247
|
| Hot path or measurable workload | `repo_map`'s top-ranked symbols, plus any loop over unbounded input |
|
|
248
|
+
| Tooling configuration | `search_code` for the tool config filenames of the detected stack — linter, formatter, type checker, test runner, pre-commit framework, scanner. **Absence fires the gate**: a project whose tooling checks nothing is one where every defect this audit finds was invisible to automation, and that changes which other modules are worth running |
|
|
249
|
+
| Git repository | a `.git` directory — the module reads history, so a shallow clone is `undetermined`, not `not applicable` |
|
|
250
|
+
| Statically or gradually typed language | `get_architecture` language, plus a type-checker config (`tsconfig.json`, `mypy.ini`, `pyrightconfig.json`, `go.mod`) — the module audits the *escape hatches* from that checker, so a language with no checker configured is itself the finding |
|
|
251
|
+
| Enumerated states / status column | `search_code` for an enum or union of state names, a `status`/`state` column in the schema, or a state-machine library import |
|
|
252
|
+
| Two surfaces in one repo | two of {client bundle, server entry point, mobile target} in one tree, or a shared-types package consumed by more than one |
|
|
253
|
+
| Dates, schedules, expiry | `search_code` for the date library import, `now()`, `Date(`, a cron expression, or an `expires_at`-shaped column |
|
|
254
|
+
| Monetary / unit-bearing fields | schema and type field names — price, amount, total, balance, fee, plus any field carrying a unit (bytes, ms, km, kg) |
|
|
255
|
+
| Retries, webhooks, externally-triggered writes | a retry helper, a webhook route, a queue consumer, or a payment SDK |
|
|
256
|
+
| Tenant / organisation scoping | a `tenant_id`/`org_id`/`workspace_id` column or an equivalent scoping parameter threaded through queries |
|
|
257
|
+
| Feature-flag SDK or registry | `search_code` the flag SDK import, or a flags/config module whose keys gate branches |
|
|
258
|
+
| Serves HTML | a template directory, an SSR framework, a static-site generator, or an `index.html` entry point |
|
|
259
|
+
| Analytics SDK | `search_code` the analytics or product-telemetry SDK import — **absence in a user-facing product fires the gate too** |
|
|
117
260
|
|
|
118
261
|
**A signal you cannot establish is `undetermined`, never `not applicable`.** Say which probe was inconclusive and let the user decide. Reporting an unestablished signal as not-applicable silently drops a module they may have needed, and they have no way to know it happened.
|
|
119
262
|
|
|
@@ -122,14 +265,37 @@ The absence gates (`Observability`, `Testing`) fire in both directions on purpos
|
|
|
122
265
|
1. Discovery — stack, architecture, feature map, via the routing table.
|
|
123
266
|
2. Apply gates → proposed module set with per-module rationale.
|
|
124
267
|
3. **Present the proposal and wait for confirmation.** Report the token implication of the chosen set.
|
|
125
|
-
4. For each confirmed module, read only its `references/<module>.md`, then verify against real code — project-brain first, `Read` only to confirm lines it points at.
|
|
126
|
-
5. Collect findings using the schema above.
|
|
268
|
+
4. For each confirmed module, read only its `references/<module>.md`, then verify against real code — project-brain first, `Read` only to confirm lines it points at. **Run the probe each check names.** A check whose probe was not run produces no finding, not an `inferred` one.
|
|
269
|
+
5. Collect findings using the schema above, each with its evidence tier and its ruled-out alternative. Leave `Refutation` empty; step 7 fills it.
|
|
270
|
+
6. **Present the Refutation Manifest and wait** — findings collected, how many are eligible at Medium or above, how many are left raw below threshold, how many refuters that means, and the resolved mode with model ids where they are known. Answers are `all`, `critical+high only`, or `none`. A user who replied `refute all` at step 3 has pre-authorised this; print the manifest as a notice and continue. `none` stamps every finding `declined by user` — it does not silently skip the stage.
|
|
271
|
+
7. Refute. One subagent per eligible finding, fresh context, the brief and nothing else. Escalate to a second refuter only on `undetermined` at Critical or High, telling it which probes were already inconclusive.
|
|
272
|
+
8. Apply the verdicts: drop `refuted` findings into the ledger, reduce `weakened` ones to the severity the refuter named, cap `undetermined` at Medium, and record the mode on every finding. Deduplicate here — the refuters could not, having each seen one finding.
|
|
273
|
+
9. Record every module's `Out of static reach` items that mattered — they become Coverage Gaps, not silent omissions.
|
|
127
274
|
|
|
128
275
|
## Output Contract
|
|
129
276
|
|
|
130
|
-
In this order: Executive Summary, Project Discovery, Architecture Summary, Feature Map, Modules Run (and why each was skipped), Findings by Severity, Wiring & Reachability Report, Coverage Gaps, Technical Debt, Security Risks, Missing Features, Architectural Risks, Recommendations, Quick Wins, Long-term Improvements.
|
|
277
|
+
In this order: Executive Summary, Project Discovery, Architecture Summary, Feature Map, Modules Run (and why each was skipped), Findings by Severity, Wiring & Reachability Report, Design System Health (only when `Design System` ran), Coverage Gaps, Refutation Ledger, Technical Debt, Security Risks, Missing Features, Architectural Risks, Recommendations, Quick Wins, Long-term Improvements.
|
|
278
|
+
|
|
279
|
+
Findings are grouped by severity, and within a severity, ordered by evidence tier — `traced` before `read` before `inferred`, with `undetermined` last inside each tier. A reader who stops after the first three findings should have stopped at the three best-proven ones, and the three that survived the hardest attempt to destroy them.
|
|
280
|
+
|
|
281
|
+
The Executive Summary carries one line naming the refutation mode, both model ids where they are known, how many findings were refuted, and how many were left raw below threshold. It qualifies every number underneath it, so it goes at the top and not in a footnote. In `self-review` mode it says plainly that no adversarial stage ran.
|
|
282
|
+
|
|
283
|
+
**Refutation Ledger** is the findings that were killed — one line each, and the header states they are not findings. It exists so the user can audit the refuter: a ledger of thin grounds means the kill stage is over-killing, and they can override it. Coverage Gaps is what the audit could not reach; the Ledger is what it reached and dismissed. Adjacent for a reason.
|
|
284
|
+
|
|
285
|
+
**Design System Health** is a table, not prose: one row per category — colour, spacing, radius, typography, shadow, z-index — with token references, hardcoded literals, and the adoption percentage. It is a tracked number the user can re-measure next quarter; a paragraph of impressions is not. Categories the project does not use are `n/a`, never 100%.
|
|
286
|
+
|
|
287
|
+
Never invent issues — every finding is backed by repo evidence. Visual quality has a hard static ceiling: the modules say what the code determines and list the rest under Coverage Gaps. An aesthetic verdict with no evidence behind it is the one failure mode this audit cannot recover from, because the user has no way to tell it apart from a real finding.
|
|
288
|
+
|
|
289
|
+
## SARIF Emission (optional)
|
|
290
|
+
|
|
291
|
+
Prose is the default and remains the default — most readers of this audit read the report themselves, and turning SARIF on does not change or replace a single line of the Output Contract above. SARIF is an additional, opt-in artefact for teams that want findings in code scanning: pass `--sarif <path>` (or the session equivalent) to also emit a SARIF 2.1.0 document alongside the prose report.
|
|
131
292
|
|
|
132
|
-
|
|
293
|
+
- One `rules[]` entry per **check** (the reference file's checklist item, not per module and not per finding instance), id `brain-audit/<module>/<check-slug>`.
|
|
294
|
+
- Severity maps Critical/High → `level: error`, Medium → `level: warning`, Low → `level: note`, Info → `level: none`. SARIF's four-value `level` cannot distinguish Critical from High; for security-relevant categories attach rule-level `properties["security-severity"]` (GitHub's own 0-10 banding) to recover the distinction — for everything else, the distinction survives only in `properties.brainAudit`, and that limitation is stated, not hidden.
|
|
295
|
+
- Evidence tier, confidence, refutation verdict and mode, category, severity, business impact, technical impact, recommendation, priority, and ruled-out alternatives travel verbatim in `result.properties.brainAudit` — the Evidence Contract is carried into SARIF, never re-derived or summarised.
|
|
296
|
+
- `partialFingerprints["brainAuditFingerprint/v1"]` hashes rule id + normalised file path + the finding's quoted evidence anchor or traced symbol name — never line number alone — so a re-run against unchanged code reproduces the same result identity and an unrelated line shift does not spuriously reopen a closed alert.
|
|
297
|
+
- **`inferred`-tier findings are excluded from SARIF emission by default.** A code-scanning UI presents every alert with equal authority, and an `inferred` finding is by definition an unproven hypothesis — that channel is the wrong place for it. A separate, explicit flag may include them, forced to `level: note` and a `-hypothesis`-suffixed rule id regardless of prose severity; this is not the default and is not recommended as a default team practice.
|
|
298
|
+
- Findings that were `refuted` never reach SARIF. The Refutation Ledger is prose; a killed finding is not an alert.
|
|
133
299
|
|
|
134
300
|
## References
|
|
135
301
|
|
|
@@ -6,48 +6,58 @@ Gate: auth, external input, or a network boundary was detected.
|
|
|
6
6
|
|
|
7
7
|
## Resource abuse
|
|
8
8
|
|
|
9
|
-
- [ ] Every endpoint that costs money or time has a rate limit. Absent limits on
|
|
10
|
-
- [ ] Rate limits are keyed on something the user cannot trivially rotate.
|
|
11
|
-
- [ ] Request and payload size are bounded before parsing, not after.
|
|
12
|
-
- [ ] Uploads are bounded in size, count, and total per account, and the type is verified from content rather than
|
|
13
|
-
- [ ] Anything that fans out — a single request causing N downstream calls — has a bound on N.
|
|
14
|
-
- [ ] Expensive queries reachable by an unauthenticated caller.
|
|
9
|
+
- [ ] Every endpoint that costs money or time has a rate limit. `search_code` for a rate-limit middleware (`express-rate-limit`, `slowapi`, `RateLimiter`, `@Throttle`, or the project's own), then list the routes it actually wraps against every expensive or billed route from `get_architecture`'s route table. The gap between the two lists is the finding — the mere absence of the word "rate limit" is not; a project can rate-limit at the gateway and never mention it in application code, so check for an upstream gateway config too before concluding there is none. CWE-770 Allocation of Resources Without Limits or Throttling, #25 in the 2025 CWE Top 25 — the CWE anchoring this whole section. Absent limits on a billed operation is `High` — cross-reference `cost.md`.
|
|
10
|
+
- [ ] Rate limits are keyed on something the user cannot trivially rotate. Read the limiter's key function: per-IP alone is weak (rotates behind CGNAT or a VPN); per-account or per-API-key is better.
|
|
11
|
+
- [ ] Request and payload size are bounded before parsing, not after. `search_code` the body-parser configuration (`bodyParser.json({limit:`, `express.json({limit:`, `client_max_body_size`, framework equivalent) and confirm the limit is wired into the middleware chain ahead of the route, not merely declared and unused.
|
|
12
|
+
- [ ] Uploads are bounded in size, count, and total per account, and the type is verified from file content rather than filename or declared MIME type. `find_symbol` the upload handler and read the validator: an extension or `Content-Type` header check alone is the finding; a check against magic bytes (file-type sniffing) rules it out — read which one is actually implemented before flagging. CWE-434 Unrestricted Upload of File with Dangerous Type, #12 in the 2025 CWE Top 25.
|
|
13
|
+
- [ ] Anything that fans out — a single request causing N downstream calls — has a bound on N. `find_callees` or `trace_path` from the handler: a loop over a user-supplied array (batch IDs, recipient lists, webhook targets) calling a downstream service once per item, with no cap on array length, is the finding.
|
|
14
|
+
- [ ] Expensive queries reachable by an unauthenticated caller. Cross-list unauthenticated routes (from the route table) against `repo_map`'s top-ranked symbols or any join-heavy/aggregate query `find_symbol` turns up on those routes.
|
|
15
15
|
|
|
16
16
|
## Input as a weapon
|
|
17
17
|
|
|
18
|
-
- [ ] Regexes applied to user input cannot backtrack catastrophically.
|
|
19
|
-
- [ ] Recursive processing of user input (nested JSON, deeply nested structures, zip, XML) has a depth limit.
|
|
20
|
-
- [ ] Decompression has an output-size limit, not only an input-size limit.
|
|
21
|
-
- [ ] Pagination and limit parameters are clamped.
|
|
22
|
-
- [ ] Numeric input is range-checked; negative and zero are handled where they change behaviour.
|
|
18
|
+
- [ ] Regexes applied to user input cannot backtrack catastrophically. `search_code` regex literals for nested-quantifier shapes (`(.*)+`, `(.+)+`, `(\w+)+`, or a group with a `+`/`*` quantifier itself quantified). Rule-out: trace the regex's input with `find_callers` — a pattern applied only to a trusted, internal, or fixed-length string is not user-reachable and is not the finding; confirm the input source before flagging.
|
|
19
|
+
- [ ] Recursive processing of user input (nested JSON, deeply nested structures, zip, XML) has a depth limit. `search_code` the parser's configuration for a `maxDepth`/`depthLimit` option; its absence in a JSON parser that accepts arbitrary client bodies is the finding.
|
|
20
|
+
- [ ] Decompression has an output-size limit, not only an input-size limit. `search_code` calls into `zlib`, `gunzip`, or archive-extraction libraries for a cap on decompressed output size — a zip bomb passes any input-size check trivially.
|
|
21
|
+
- [ ] Pagination and limit parameters are clamped server-side. `find_symbol` the list/pagination handler and read whether the `limit` value is clamped (`Math.min(limit, MAX)` or equivalent) before being used in the query — a limit merely validated as "is a number" still lets `?limit=1000000` through.
|
|
22
|
+
- [ ] Numeric input is range-checked; negative and zero are handled where they change behaviour. `search_code` the validation schema (`zod`, `joi`, `pydantic`, class-validator, or the project's own) for the field and check it declares a `min`/`max`, not just a type.
|
|
23
23
|
|
|
24
24
|
## Enumeration
|
|
25
25
|
|
|
26
|
-
- [ ] Identifiers are not sequential where enumerating them leaks the corpus size or lets a user walk other records.
|
|
27
|
-
- [ ] Existence is not disclosed by differential responses
|
|
28
|
-
- [ ] Bulk lookup endpoints are limited per call and per window.
|
|
29
|
-
- [ ] Public search cannot be used to enumerate private records by narrowing.
|
|
26
|
+
- [ ] Identifiers are not sequential where enumerating them leaks the corpus size or lets a user walk other records. `search_code` the schema for autoincrement primary keys, then trace whether that same ID is the one exposed in a URL or API response. Rule-out: an autoincrement PK used only internally, with a separate opaque public ID (UUID, slug) surfaced to clients, is not the finding — confirm which ID actually appears in the client-facing route before flagging. This is the enumeration half of BOLA (OWASP API Security Top 10:2023 API1, CWE-639) — `security.md`'s AuthZ section owns the missing-ownership-check half of the same defect; report the identifier choice here and the missing check there.
|
|
27
|
+
- [ ] Existence is not disclosed by differential responses. `find_symbol` the handler and read the literal "not found" and "not permitted" branches side by side — same status code, same body shape, or the finding names the exact difference.
|
|
28
|
+
- [ ] Bulk lookup endpoints are limited per call and per window. `find_symbol` the batch endpoint and check for a cap on the incoming ID array's length.
|
|
29
|
+
- [ ] Public search cannot be used to enumerate private records by narrowing filters. Read the search handler's filter set for combinations (e.g. narrowing by email domain plus name prefix) that converge on a single private record through repeated queries.
|
|
30
30
|
|
|
31
31
|
## Business-logic abuse
|
|
32
32
|
|
|
33
|
-
- [ ] Operations that grant value are idempotent or bounded — one coupon per account, one trial per user, one vote per poll. Cross-reference `concurrency.md`: the classic double-redeem is a
|
|
34
|
-
- [ ] Quotas and counters cannot be reset by the user
|
|
35
|
-
- [ ] Ordering assumptions cannot be violated — can a user reach step 3 without steps 1 and 2? `trace_path` from each entry point to the privileged step.
|
|
36
|
-
- [ ] Money, credits, and quantities reject negative values everywhere, including refunds and adjustments.
|
|
37
|
-
- [ ] State transitions are validated against the current state, not merely applied.
|
|
33
|
+
- [ ] Operations that grant value are idempotent or bounded — one coupon per account, one trial per user, one vote per poll. `find_symbol` the redeem/apply-coupon/vote handler and read whether the check-then-write is inside a transaction or backed by a unique constraint, versus a plain read-check-write with no such guard. Cross-reference `concurrency.md`: the classic double-redeem is a race, and this check only confirms the *logic* exists — the race itself is that module's finding.
|
|
34
|
+
- [ ] Quotas and counters cannot be reset by the user re-registering, changing an email, or deleting and recreating an account. `find_symbol` the registration/account handler and check whether the quota key is the mutable field being changed (email) rather than an immutable identifier issued at first creation.
|
|
35
|
+
- [ ] Ordering assumptions cannot be violated — can a user reach step 3 without steps 1 and 2? `trace_path` from each entry point to the privileged step; a path that reaches it without passing through the earlier steps' handlers is the finding.
|
|
36
|
+
- [ ] Money, credits, and quantities reject negative values everywhere, including refunds and adjustments. `search_code` the amount/quantity validation schema for a `min(0)`-equivalent constraint, and check the refund and adjustment handlers specifically — these are often left unguarded even when the primary charge path validates correctly, because they are added later and copy less carefully.
|
|
37
|
+
- [ ] State transitions are validated against the current state, not merely applied. `find_symbol` the transition function and read whether it checks the record's current state before writing the new one, or performs a blind assignment reachable from any state.
|
|
38
38
|
|
|
39
39
|
## Content abuse
|
|
40
40
|
|
|
41
|
-
- [ ] User-generated content is escaped at render, and stored content cannot break out at any consumer — including emails, exports, and logs.
|
|
42
|
-
- [ ] CSV/spreadsheet exports neutralise formula-leading characters.
|
|
43
|
-
- [ ] Filenames from users are sanitised before being used on disk or in a header.
|
|
44
|
-
- [ ] User-supplied URLs fetched by the server are validated against internal addresses.
|
|
41
|
+
- [ ] User-generated content is escaped at render, and stored content cannot break out at any consumer — including emails, exports, and logs. `search_code` the template engine's autoescape setting and any explicit bypass (`{% autoescape false %}`, `dangerouslySetInnerHTML`, `| safe`) applied to a field that stores user input.
|
|
42
|
+
- [ ] CSV/spreadsheet exports neutralise formula-leading characters. `find_symbol` the export function and read whether it prefixes cells starting with `=`, `+`, `-`, or `@` before writing them.
|
|
43
|
+
- [ ] Filenames from users are sanitised before being used on disk or in a header. `find_symbol` the upload handler and read whether the stored filename is the raw client-supplied string or a sanitised/generated one (hash, UUID, stripped path).
|
|
44
|
+
- [ ] User-supplied URLs fetched by the server are validated against internal and private addresses before the request is made. `search_code` for outbound HTTP calls (`fetch(`, `axios.get(`, `requests.get(`, `http.request(`) where the URL argument traces back to user input via `find_callers`, and check for an allowlist (preferred) or private-IP/link-local/loopback-range rejection ahead of the call — its absence on a server-side fetch of a user-supplied URL is the SSRF finding and is `Critical`. CWE-918, #22 in the 2025 CWE Top 25; SSRF is no longer its own OWASP Top 10 category — it was folded into A01:2025 Broken Access Control — cite CWE-918 or OWASP API Security Top 10:2023 API7 (SSRF) instead of "OWASP A10".
|
|
45
|
+
- [ ] Where the private-address check exists, it runs against the *resolved* IP immediately before the connection, not only against the hostname string at input-validation time. Read the validation call site and the fetch call site together — if a DNS lookup can occur between the two (the check validates the hostname, then a separate resolve happens inside the HTTP client), an attacker-controlled DNS record can rebind a passing hostname to a private address after the check runs. A validator that resolves A/AAAA records itself and checks those IPs, immediately before the same connection is made, rules this out.
|
|
46
|
+
|
|
47
|
+
## Out of static reach
|
|
48
|
+
|
|
49
|
+
- Real behaviour under load — whether a rate limit actually holds at the traffic the endpoint sees in production, versus merely being configured.
|
|
50
|
+
- Upstream WAF, CDN, or API-gateway rate limiting and payload-size enforcement that never appears in application source.
|
|
51
|
+
- Whether a third-party payment or coupon provider enforces idempotency independently of this codebase's own guard.
|
|
52
|
+
- Real-world timing differences for enumeration — network jitter can mask a gap that is clearly visible when reading the two code paths side by side, and can also expose one too small to see in source.
|
|
53
|
+
- Whether the business rules encoded here match the product's actual legal or ToS constraints (refund windows, promotional limits) — that is a policy document this module cannot read.
|
|
45
54
|
|
|
46
55
|
## Severity guidance
|
|
47
56
|
|
|
48
57
|
| Situation | Severity |
|
|
49
58
|
|---|---|
|
|
50
59
|
| Server fetches a user-supplied URL with no internal-address filter | Critical |
|
|
60
|
+
| Internal-address filter checks the hostname but not the resolved IP (DNS-rebinding gap) | High |
|
|
51
61
|
| No rate limit on an expensive or billed operation | High |
|
|
52
62
|
| Catastrophic backtracking reachable from user input | High |
|
|
53
63
|
| Unbounded request, payload, or decompression size | High |
|
|
@@ -4,47 +4,67 @@ Can everyone use it? Gate: a UI framework was detected. This module was document
|
|
|
4
4
|
|
|
5
5
|
Accessibility findings are unusually verifiable from source: most of them are the presence or absence of a specific attribute, and `search_code` finds them exactly.
|
|
6
6
|
|
|
7
|
+
This module owns the compliance line — the attribute, the ratio, the target size. `visual-design.md` owns the same territory as craft: emphasis, rhythm, state treatment. Where both would fire on one defect — colour as the sole carrier of meaning, missing reduced-motion handling — report it once, in whichever module is running, and cross-reference.
|
|
8
|
+
|
|
7
9
|
## Semantics
|
|
8
10
|
|
|
9
|
-
- [ ] Interactive things are interactive elements. `search_code` for `onClick` on `div` and `span` — each is a control keyboard and screen-reader users cannot reach.
|
|
10
|
-
- [ ] Headings form a real outline
|
|
11
|
-
- [ ] Landmarks exist
|
|
12
|
-
- [ ] Lists are lists, tables are tables with headers
|
|
11
|
+
- [ ] Interactive things are interactive elements. `search_code` for `onClick` on `div` and `span` — each is a control keyboard and screen-reader users cannot reach. Rule out: a `div` that also carries `role="button"`, `tabIndex="0"`, and a keydown handler is compensating correctly; the finding is the ones missing all three.
|
|
12
|
+
- [ ] Headings form a real outline. `search_code` for `<h1` across page/route entry components — more than one per page, or a jump from `<h2` to `<h4` with no `<h3`, is the defect. Rule out a decorative element that is *styled* like a heading but uses no heading tag at all — that is a different, lesser issue than a skipped level.
|
|
13
|
+
- [ ] Landmarks exist. `search_code` for `<main`, `<nav`, `<header`, `<footer`, or `role="main"`/`role="navigation"` — a layout with none of these forces screen-reader users to tab through the entire page instead of jumping to content.
|
|
14
|
+
- [ ] Lists are lists, tables are tables with headers. `search_code` a `.map()` rendering repeated `<div>` siblings — if the surrounding markup has no `<ul>`/`<ol>`, that is a list read as an unstructured block by assistive tech. Run the same sweep for a grid-of-`<div>`s standing in for `<table>`.
|
|
13
15
|
|
|
14
16
|
## Keyboard
|
|
15
17
|
|
|
16
|
-
- [ ] Every action reachable by mouse
|
|
17
|
-
- [ ] Focus is visible. `search_code` for `outline: none` and `outline: 0` — each needs a replacement indicator.
|
|
18
|
-
- [ ] Focus order follows visual order.
|
|
19
|
-
- [ ] Modals trap focus while open and restore it to the trigger on close.
|
|
20
|
-
- [ ] Nothing is a keyboard trap —
|
|
18
|
+
- [ ] Every action reachable by mouse has a keyboard path. Cross-reference the `onClick`-on-non-interactive-element list from Semantics above — each is a candidate action with no keyboard path unless it also carries a keydown handler and `tabIndex`. Confirming the walk end-to-end needs a running app; list the candidates here and put the actual walk under Out of static reach.
|
|
19
|
+
- [ ] Focus is visible. `search_code` for `outline: none` and `outline: 0` — each needs a replacement indicator. Rule out: check the same rule block for `box-shadow`, `outline-color`, or a `:focus-visible` override before reporting; a component that removes the default outline and defines its own ring is not a violation.
|
|
20
|
+
- [ ] Focus order follows visual order. `search_code` for `tabindex="1"` and above — positive values are a red flag. Rule out: if DOM order already matches visual order, a stray positive `tabindex` may be inert legacy code rather than an active reorder; read the surrounding markup before reporting it as live.
|
|
21
|
+
- [ ] Modals trap focus while open and restore it to the trigger on close. `find_symbol` the modal component and read its implementation — a focus-trap library import, or the native `<dialog>` element with `showModal()`, covers this; a hand-rolled modal with neither is a candidate. `search_code` for a `.focus()` call in its close handler to confirm restoration.
|
|
22
|
+
- [ ] Nothing is a keyboard trap. A hand-rolled focus trap (found above) is the usual source — read its escape path: does Escape, or Tab past the last element, hand focus back out? Flag a trap with no exit path by inspection; confirming no trap exists anywhere still needs a keyboard pass, which belongs under Out of static reach.
|
|
23
|
+
|
|
24
|
+
## Pointer targets
|
|
25
|
+
|
|
26
|
+
- [ ] Interactive targets meet **24×24 CSS px** — WCAG 2.2 SC 2.5.8, Level AA. `search_code` icon-button and control components and read their declared `width`/`height`/`padding` to compute the effective box. Five exceptions exist and each must be argued, not assumed: sufficient spacing around a smaller target, an equivalent control elsewhere on the page, an inline target within a sentence, a size fixed by the user agent, or a presentation that is essential.
|
|
27
|
+
- [ ] Where the project claims AAA, or ships to touch as a primary input, the bar is **44×44 CSS px** — SC 2.5.5, which has no spacing escape hatch. Apple's guidance is 44×44pt and Material's is 48×48dp, both stricter than AA. Compute the same box as above against this bar.
|
|
28
|
+
- [ ] Icon-only buttons and close affordances are the usual failures. `search_code` for icon-button components and read their padding — a 16px icon in a box with no padding is a 16px target.
|
|
29
|
+
- [ ] The hit area is extended with padding rather than by enlarging the visual box. Read the icon-button CSS found above: padding around a small icon passes; a small box with the icon filling it edge-to-edge is the failure — and enlarging the box for compliance with no design pass is itself a regression worth calling out.
|
|
30
|
+
- [ ] Adjacent small targets have spacing between them. `search_code` for the toolbar/action-group markup housing multiple icon buttons and read the `gap`/margin between siblings — targets under 24px sharing an edge with no gap is the failure; two 44px targets a few px apart is not, even though neither hits the exact spacing formula.
|
|
21
31
|
|
|
22
32
|
## Names and roles
|
|
23
33
|
|
|
24
|
-
- [ ] Every image has `alt`, and decorative images have `alt=""` rather than a filename.
|
|
25
|
-
- [ ] Icon-only buttons have an accessible name — `aria-label` or visually-hidden text
|
|
26
|
-
- [ ] Form inputs have associated `label` elements, not just placeholders.
|
|
27
|
-
- [ ] Required, invalid, and error states are conveyed programmatically
|
|
28
|
-
- [ ] `aria-*` attributes are valid for their element's role and are not contradicting native semantics.
|
|
34
|
+
- [ ] Every image has `alt`, and decorative images have `alt=""` rather than a filename. `search_code` for `<img`/`<Image` tags missing an `alt` attribute entirely — that is the unambiguous defect. Where `alt` is present, read whether it is a filename (`alt="IMG_2043.png"`) or an auto-generated slug — both fail the check for a different reason.
|
|
35
|
+
- [ ] Icon-only buttons have an accessible name — these are the single most common miss. `search_code` the icon-button components found under Pointer targets for `aria-label`, `aria-labelledby`, or visually-hidden text — a button whose only content is an SVG or icon component, with none of the three, is unnamed to every screen reader.
|
|
36
|
+
- [ ] Form inputs have associated `label` elements, not just placeholders. `search_code` for `<input` and check each against a `<label htmlFor="...">` pointing at its `id`, or `aria-labelledby` — an input with only a `placeholder` and neither of those fails, because the placeholder disappears the moment the user types.
|
|
37
|
+
- [ ] Required, invalid, and error states are conveyed programmatically. `search_code` the form's error-display logic and check whether the invalid input also sets `aria-invalid="true"` and `aria-describedby` pointing at the message — a red border and a paragraph with neither attribute is invisible to a screen reader.
|
|
38
|
+
- [ ] `aria-*` attributes are valid for their element's role and are not contradicting native semantics. `search_code` for `aria-hidden="true"` and read what it wraps — a focusable element inside an `aria-hidden` subtree is reachable by keyboard but invisible to assistive tech, which is worse than not hiding it at all.
|
|
29
39
|
|
|
30
40
|
## Perception
|
|
31
41
|
|
|
32
|
-
- [ ] Colour is never the only carrier of meaning — error states, status badges, chart series.
|
|
33
|
-
- [ ] Text contrast meets 4.5:1 (3:1 for large text). Extract the
|
|
34
|
-
- [ ] Content reflows at
|
|
35
|
-
- [ ] Motion respects `prefers-reduced-motion`. `search_code` for it — absence alongside animation is a finding.
|
|
42
|
+
- [ ] Colour is never the only carrier of meaning — error states, status badges, chart series. `search_code` the status-badge/error-text component and read whether an icon or text label ships alongside the colour class, or whether the colour class is the only differentiator between states.
|
|
43
|
+
- [ ] Text contrast meets 4.5:1 (3:1 for large text) **in every declared theme**, not only the default one. Extract the foreground/background pairs from each theme's token file (found via `design-system.md`'s token source) and compute the ratio per pair; do not eyeball it. Where `design-system.md` found a partially covered theme, that gap is a contrast gap too.
|
|
44
|
+
- [ ] Content reflows at narrow widths. `search_code` the page-level container styles for a fixed `width`/`min-width` in px with no responsive override — a hard floor above ~320px is a static signal reflow will fail. Confirming actual reflow at 320px and 200% zoom needs a browser and belongs under Out of static reach.
|
|
45
|
+
- [ ] Motion respects `prefers-reduced-motion`. `search_code` for it — its absence alongside animation is a finding.
|
|
36
46
|
|
|
37
47
|
## Dynamic content
|
|
38
48
|
|
|
39
|
-
- [ ] Async status changes are announced
|
|
40
|
-
- [ ] Client-side route changes move focus and update the document title.
|
|
41
|
-
- [ ] Auto-dismissing messages last long enough to be read, or are dismissible.
|
|
49
|
+
- [ ] Async status changes are announced. `search_code` for `aria-live` — if the loading/success/error states from `flow-integrity.md`'s triad render with no `aria-live` region anywhere in the tree, none of them are announced; they just silently change on screen.
|
|
50
|
+
- [ ] Client-side route changes move focus and update the document title. `search_code` the router's top-level layout or navigation listener for a `document.title =` assignment and a `.focus()` call triggered on route change — a single-page app with neither leaves a screen-reader user oriented on the previous page after every navigation.
|
|
51
|
+
- [ ] Auto-dismissing messages last long enough to be read, or are dismissible. `find_symbol` the toast/notification component and read its default duration and whether hover/focus pauses the timer — a fixed short timeout with no pause and no manual dismiss fails both ways.
|
|
52
|
+
|
|
53
|
+
## Out of static reach
|
|
54
|
+
|
|
55
|
+
- The keyboard walk itself, end to end, through a live app — source can only identify candidates for missing paths.
|
|
56
|
+
- Real screen-reader output — what NVDA, JAWS, or VoiceOver actually announces for a given markup pattern.
|
|
57
|
+
- Rendered contrast where colours composite — overlays, opacity, gradients (cross-reference `design-system.md`).
|
|
58
|
+
- Reflow behaviour at 320px and 200% zoom in an actual viewport.
|
|
59
|
+
- Whether an auto-dismiss duration feels sufficient to a real reader, as opposed to merely exceeding a numeric threshold.
|
|
42
60
|
|
|
43
61
|
## Severity guidance
|
|
44
62
|
|
|
45
63
|
| Situation | Severity |
|
|
46
64
|
|---|---|
|
|
47
65
|
| Action reachable only by mouse | High |
|
|
66
|
+
| Interactive target below 24×24 CSS px with no exception applying | High |
|
|
67
|
+
| Adjacent small targets with no spacing between them | Medium |
|
|
48
68
|
| Icon-only control with no accessible name | High |
|
|
49
69
|
| Form input with no label | High |
|
|
50
70
|
| Focus outline removed with no replacement | Medium |
|
|
@@ -4,38 +4,48 @@ LLM and AI SDK integration. Gate: calls to an AI/LLM SDK were detected.
|
|
|
4
4
|
|
|
5
5
|
Two modules pair with this one: `Cost` (the same gate fires it) and `Privacy` (what leaves the process in a prompt). Audit them together or cross-reference explicitly.
|
|
6
6
|
|
|
7
|
+
Model IDs, token limits, and pricing drift faster than this file can be kept current. Every check below verifies the code against its own declared configuration, never against a remembered model name, limit, or price — if a check would require knowing today's real numbers, it does not belong here.
|
|
8
|
+
|
|
7
9
|
## Prompt construction
|
|
8
10
|
|
|
9
|
-
- [ ] Prompts live in one place, not scattered as inline string literals across call sites. `search_code` a distinctive prompt phrase to find the duplicates.
|
|
10
|
-
- [ ] User input is clearly delimited from instructions.
|
|
11
|
-
- [ ] Input length is bounded before it reaches the model.
|
|
12
|
-
- [ ] Prompts are versioned or at least dated.
|
|
11
|
+
- [ ] Prompts live in one place, not scattered as inline string literals across call sites. `search_code` a distinctive prompt phrase to find the duplicates; more than one call site building the same prompt shape is the finding.
|
|
12
|
+
- [ ] User input is clearly delimited from instructions. `find_callees` on the prompt-construction function for a raw string concatenation of a user-supplied variable directly into the instruction text, with no delimiter — a tag, a separate message role, a fenced block. Concatenation with no delimiter is prompt injection — cross-reference `Abuse`.
|
|
13
|
+
- [ ] Input length is bounded before it reaches the model. `find_callees` on the prompt-construction function for a truncation/chunking call between the raw input and the model call; its absence is both an injection surface and an unbounded bill.
|
|
14
|
+
- [ ] Prompts are versioned or at least dated. `search_code` for a version/date marker near the prompt constant or file; its absence means a behaviour change can never be correlated with which prompt produced it.
|
|
13
15
|
|
|
14
16
|
## Model contract
|
|
15
17
|
|
|
16
|
-
- [ ] The model identifier is configurable, not hardcoded at each call site. `search_code` the model
|
|
17
|
-
- [ ] The code states which capabilities it depends on (tool use, structured output, context window).
|
|
18
|
-
- [ ] Token limits are respected explicitly: input is truncated or chunked with a stated strategy,
|
|
19
|
-
- [ ] Temperature and sampling are set deliberately where determinism matters.
|
|
18
|
+
- [ ] The model identifier is configurable, not hardcoded at each call site. `search_code` the model-name string literal and count the call sites — more than one occurrence means a future migration touches N places.
|
|
19
|
+
- [ ] The code states which capabilities it depends on (tool use, structured output, context window). `find_symbol` the call site's request options and confirm the dependency is declared there or in an adjacent comment, not assumed silently.
|
|
20
|
+
- [ ] Token limits are respected explicitly: input is truncated or chunked with a stated strategy. `find_callees` on the call site for a truncation/chunking step keyed to a declared limit, rather than a bare call left to fail at the API boundary.
|
|
21
|
+
- [ ] Temperature and sampling are set deliberately where determinism matters. `search_code` the call site's options object; an omitted temperature on a call whose output feeds a downstream parser is the finding — an unset value is provider-chosen, not a decision anyone made.
|
|
20
22
|
|
|
21
23
|
## Output handling
|
|
22
24
|
|
|
23
|
-
- [ ] **Model output is untrusted input.**
|
|
24
|
-
- [ ] Structured output is parsed defensively — malformed JSON is an expected case, not an exception.
|
|
25
|
-
- [ ] There is a defined behaviour for a refusal, an empty response, and a truncated response.
|
|
26
|
-
- [ ] Hallucination-sensitive outputs (file paths, symbol names, citations) are verified against reality before being acted on or shown.
|
|
25
|
+
- [ ] **Model output is untrusted input.** `find_callees` on the response-handling code for the output reaching `eval`, a shell command, a query, or a filesystem path with no validation in between. A model-generated path reaching `readFile` is `Critical`.
|
|
26
|
+
- [ ] Structured output is parsed defensively — malformed JSON is an expected case, not an exception. `find_callees` on the parse call for a surrounding try/catch or a result type distinguishing malformed output from a valid one; a bare parse call with no catch is the finding.
|
|
27
|
+
- [ ] There is a defined behaviour for a refusal, an empty response, and a truncated response. `find_symbol` the response handler and confirm each of the three cases has its own branch — a handler that only checks truthiness collapses all three into one path.
|
|
28
|
+
- [ ] Hallucination-sensitive outputs (file paths, symbol names, citations) are verified against reality before being acted on or shown. `find_callees` on the code consuming such output for a verification step (a filesystem check, a symbol lookup) before the value is used.
|
|
27
29
|
|
|
28
30
|
## Failure and degradation
|
|
29
31
|
|
|
30
|
-
- [ ] Every model call has a timeout and a bounded retry with backoff.
|
|
31
|
-
- [ ] Rate limits and quota errors are distinguished from real failures and handled differently.
|
|
32
|
-
- [ ] There is a degraded path when the provider is unavailable — a cheaper model, a cached answer, or an honest error.
|
|
33
|
-
- [ ] Streaming responses handle mid-stream disconnection without leaving partial state committed.
|
|
32
|
+
- [ ] Every model call has a timeout and a bounded retry with backoff. `find_symbol` the client construction/call site for a timeout option and a retry wrapper; either missing is `High`.
|
|
33
|
+
- [ ] Rate limits and quota errors are distinguished from real failures and handled differently. `find_callees` on the error handler for a status-code or error-type branch specific to rate-limit/quota, versus a single generic catch-all.
|
|
34
|
+
- [ ] There is a degraded path when the provider is unavailable — a cheaper model, a cached answer, or an honest error. `find_callees` on the call site's catch block for a fallback path; a bare rethrow with nothing downstream to handle it is silent failure, the worst option.
|
|
35
|
+
- [ ] Streaming responses handle mid-stream disconnection without leaving partial state committed. `find_callees` on the stream consumer for a cleanup/rollback path on stream error, not only on stream completion.
|
|
34
36
|
|
|
35
37
|
## Evaluation
|
|
36
38
|
|
|
37
|
-
- [ ] Some check exists that the AI feature still works — golden tests, snapshot comparisons, or a manual procedure that is written down.
|
|
38
|
-
- [ ] Non-determinism is handled in tests: either a fake client (assert the request, not the response) or tolerance-based assertions.
|
|
39
|
+
- [ ] Some check exists that the AI feature still works — golden tests, snapshot comparisons, or a manual procedure that is written down. `search_code` the test directory for a golden-file, snapshot, or fixture referencing the prompt/model call; its absence in a project with tests elsewhere is the finding.
|
|
40
|
+
- [ ] Non-determinism is handled in tests: either a fake client (assert the request, not the response) or tolerance-based assertions. Read the test found above — an assertion on exact model prose, rather than on the request sent or a tolerance/schema check on the response, is a flake generator.
|
|
41
|
+
|
|
42
|
+
## Out of static reach
|
|
43
|
+
|
|
44
|
+
- Actual model behaviour on adversarial input — whether a delimiter or guard genuinely resists injection can only be shown by running attacks against the live model.
|
|
45
|
+
- Real token counts and cost per call — these depend on the provider's tokenizer and current pricing, neither visible from source.
|
|
46
|
+
- Whether the declared timeout/retry values are well-tuned for the provider's real latency distribution.
|
|
47
|
+
- Actual output quality or hallucination rate — this requires running the eval suite, not reading it.
|
|
48
|
+
- Provider-side rate limits and quota — these live in the provider account, not the repository.
|
|
39
49
|
|
|
40
50
|
## Severity guidance
|
|
41
51
|
|