13 13 **Phase:** Phase 1: Detector Precision
15 +**Status:** Reconciled on 2026-08-10 against `extensions/leaks`; detector precision work shipped.
17 19 ##
Task 1: Wire Dedicated Property Tests 19 21 **Files:** `package.json`, `package-lock.json`, `mise.toml`, `extensions/leaks/vitest.fuzz.config.ts`, `extensions/leaks/__fuzz__/detectors.fuzz.test.ts`
21 -- [ ] Add these root dev dependencies:
23 +- [x] Add these root dev dependencies:
24 26 "@fast-check/vitest":
"^0.4.1",
25 27 "fast-check":
"^4.9.0" 28 -- [ ] Create `extensions/leaks/vitest.fuzz.config.ts`:
30 +- [x] Create `extensions/leaks/vitest.fuzz.config.ts`:
31 33 import { defineConfig }
from "vitest/config";
43 -- [ ] Add a smoke property using `test.prop({ text: fc.string() })` that calls `redactText` twice on fresh engines and expects equal changed/count/labels output.
45 +- [x] Add a smoke property using `test.prop({ text: fc.string() })` that calls `redactText` twice on fresh engines and expects equal changed/count/labels output.
45 -- [ ] Add a Mise `fuzz` task that runs Vitest through Node and enforces a hard 120-second process deadline with Node `spawnSync(..., { timeout: 120_000 })`; exit 124 on timeout.
47 +- [x] Add a Mise `fuzz` task that runs Vitest through Node and enforces a hard 120-second process deadline with Node `spawnSync(..., { timeout: 120_000 })`; exit 124 on timeout.
47 -- [ ] Define replay inputs `FC_SEED` and `FC_PATH` in the fuzz setup and pass them as `seed` and `path` to fast-check when set.
49 +- [x] Define replay inputs `FC_SEED` and `FC_PATH` in the fuzz setup and pass them as `seed` and `path` to fast-check when set.
49 -- [ ] Run `mise run lock && mise run fuzz`; expect PASS.
51 +- [x] Run `mise run lock && mise run fuzz`; expect PASS.
51 -- [ ] Commit `test(leaks): add dedicated property suite`.
53 +- [x] Commit `test(leaks): add dedicated property suite`.
53 55 ## Task 2: Establish The Precision Contract First
55 57 **Files:** `extensions/leaks/SPEC.md`
57 -- [ ] Replace “JWT decoding is out of scope” with exact JWT requirements: three strict Base64URL segments, decoded non-array JSON objects, nonempty string `alg`, nonempty strict signature.
59 +- [x] Replace “JWT decoding is out of scope” with exact JWT requirements: three strict Base64URL segments, decoded non-array JSON objects, nonempty string `alg`, nonempty strict signature.
59 -- [ ] Replace substring-sensitive names with separator-aware complete tokens.
61 +- [x] Replace substring-sensitive names with separator-aware complete tokens.
61 -- [ ] State that ambiguous assignments and context-only env names remain visible unless the value has a provider-specific shape or parsed secret component.
63 +- [x] State that ambiguous assignments and context-only env names remain visible unless the value has a provider-specific shape or parsed secret component.
63 -- [ ] Replace PuTTY-to-EOF behavior with exact `Private-Lines` consumption.
65 +- [x] Replace PuTTY-to-EOF behavior with exact `Private-Lines` consumption.
65 -- [ ] State Phase 1 still uses volatile HMAC12 mappings; durable V1 mappings remain Phase 2.
67 +- [x] State Phase 1 still uses volatile HMAC12 mappings; durable V1 mappings remain Phase 2.
67 -- [ ] Run `git diff --check -- extensions/leaks/SPEC.md`; expect no errors.
69 +- [x] Run `git diff --check -- extensions/leaks/SPEC.md`; expect no errors.
69 -- [ ] Commit `docs(leaks): specify precision-first detectors`.
71 +- [x] Commit `docs(leaks): specify precision-first detectors`.
71 73 ## Task 3: Parse Structured Candidates With Paired TDD
73 75 **Files:** `extensions/leaks/src/structures.ts`, `extensions/leaks/src/safety.ts`, `extensions/leaks/__tests__/structures.test.ts`, `extensions/leaks/__tests__/false-positives.test.ts`
75 -- [ ] Add JWT red/green cases:
77 +- [x] Add JWT red/green cases:
78 80 expect(findJwtSpans("agendaFlick.visibleArea.yPosition")).toEqual([]);
91 -- [ ] Implement strict Base64URL validation before `Buffer.from`:
93 +- [x] Implement strict Base64URL validation before `Buffer.from`:
94 96 function decodeJsonObject(segment: string) {
106 108 Catch parse/decode errors and return no span.
107 109 Require `typeof header.alg === "string" && header.alg.length > 0`.
109 -- [ ] Add query/cookie red/green cases:
111 +- [x] Add query/cookie red/green cases:
112 114 expect(
findSensitiveQuerySpans(
"?monkey=ordinary-value")).
toEqual([]);
120 -- [ ] Export one `isSensitiveName` helper from `safety.ts` that normalizes `-` to `_`, splits complete tokens, accepts explicit compound names such as `API_KEY` and `CLIENT_SECRET`, and never uses `includes`.
122 +- [x] Export one `isSensitiveName` helper from `safety.ts` that normalizes `-` to `_`, splits complete tokens, accepts explicit compound names such as `API_KEY` and `CLIENT_SECRET`, and never uses `includes`.
122 -- [ ] Scan URL candidates with a bounded regex, parse each with `new URL(candidate)`, and locate raw component spans by searching inside the unchanged candidate string; reject a candidate when a decoded value cannot be mapped uniquely to one raw source span.
124 +- [x] Scan URL candidates with a bounded regex, parse each with `new URL(candidate)`, and locate raw component spans by searching inside the unchanged candidate string; reject a candidate when a decoded value cannot be mapped uniquely to one raw source span.
124 -- [ ] Require strict Basic credentials with `/^[A-Za-z0-9+/]+={0,2}$/`, canonical Base64 re-encoding, and decoded `:`.
126 +- [x] Require strict Basic credentials with `/^[A-Za-z0-9+/]+={0,2}$/`, canonical Base64 re-encoding, and decoded `:`.
126 -- [ ] Parse cookies only from a complete `Cookie:` line and classify complete pair names with `isSensitiveName`.
128 +- [x] Parse cookies only from a complete `Cookie:` line and classify complete pair names with `isSensitiveName`.
128 -- [ ] Add assignment red/green cases for source constants, lower-camel references, type syntax, XML prose, provider-shaped config values, exact env-style values, transformed text, exact labels, and restoration.
130 +- [x] Add assignment red/green cases for source constants, lower-camel references, type syntax, XML prose, provider-shaped config values, exact env-style values, transformed text, exact labels, and restoration.
130 -- [ ] Replace broad assignment authority with line-anchored recognizers. Reject lines beginning with `const`, `let`, `var`, `function`, `class`, `type`, `interface`, or containing template/interpolation syntax. For JSON/YAML/TOML/XML-like forms, redact only `highConfidenceSecretShape(value)`; dotenv/env exact learning handles arbitrary opaque values.
132 +- [x] Replace broad assignment authority with line-anchored recognizers. Reject lines beginning with `const`, `let`, `var`, `function`, `class`, `type`, `interface`, or containing template/interpolation syntax. For JSON/YAML/TOML/XML-like forms, redact only `highConfidenceSecretShape(value)`; dotenv/env exact learning handles arbitrary opaque values.
132 -- [ ] Run `mise run test -- extensions/leaks/__tests__/structures.test.ts extensions/leaks/__tests__/false-positives.test.ts`; expect PASS.
134 +- [x] Run `mise run test -- extensions/leaks/__tests__/structures.test.ts extensions/leaks/__tests__/false-positives.test.ts`; expect PASS.
134 -- [ ] Commit `fix(leaks): parse structured secret candidates`.
136 +- [x] Commit `fix(leaks): parse structured secret candidates`.
136 138 ## Task 4: Bound Provider, Private-Key, And Environment Detection With Paired TDD
138 140 **Files:** `extensions/leaks/src/detectors.ts`, `extensions/leaks/src/dotenv.ts`, `extensions/leaks/__tests__/detectors.test.ts`, `extensions/leaks/__tests__/dotenv.test.ts`
140 -- [ ] For every provider rule, generate one deterministic valid control and three exact near misses: changed prefix, one-short length, and invalid alphabet. Assert exact zero or one span and exact label.
142 +- [x] For every provider rule, generate one deterministic valid control and three exact near misses: changed prefix, one-short length, and invalid alphabet. Assert exact zero or one span and exact label.
142 -- [ ] Replace the PuTTY regex with a line parser that finds `Private-Lines: N`, consumes exactly N subsequent Base64 lines, and ends before `Private-MAC`. Add a trailing sentinel assertion proving unrelated text remains unchanged after redaction/restoration.
144 +- [x] Replace the PuTTY regex with a line parser that finds `Private-Lines: N`, consumes exactly N subsequent Base64 lines, and ends before `Private-MAC`. Add a trailing sentinel assertion proving unrelated text remains unchanged after redaction/restoration.
144 -- [ ] Add env red/green cases:
146 +- [x] Add env red/green cases:
147 149 expect(learnEnvironmentValues({ GPG_KEY_ID: "0123456789abcdef" }).values)
159 161 Also cover `KEY`, `AUTH`, `SESSION`, `COOKIE`, `JWT`, `SEED`, public prefixes, and credentialed/uncredentialed URLs.
161 -- [ ] Split normalized env names into explicit high-precision, context-required, metadata-suffix, and public-prefix classes matching the spec table.
163 +- [x] Split normalized env names into explicit high-precision, context-required, metadata-suffix, and public-prefix classes matching the spec table.
163 -- [ ] Parse env URL values with `URL`; learn raw password and exact sensitive query values only. Do not learn the complete URL.
165 +- [x] Parse env URL values with `URL`; learn raw password and exact sensitive query values only. Do not learn the complete URL.
165 -- [ ] Run `mise run test -- extensions/leaks/__tests__/detectors.test.ts extensions/leaks/__tests__/dotenv.test.ts`; expect PASS.
167 +- [x] Run `mise run test -- extensions/leaks/__tests__/detectors.test.ts extensions/leaks/__tests__/dotenv.test.ts`; expect PASS.
167 -- [ ] Commit `fix(leaks): tighten provider and environment detection`.
169 +- [x] Commit `fix(leaks): tighten provider and environment detection`.
169 171 ##
Task 5: Fuzz Every Detector Family 171 173 **Files:** `extensions/leaks/__fuzz__/arbitraries.ts`, `extensions/leaks/__fuzz__/detectors.fuzz.test.ts`
173 -- [ ] Build semantic arbitraries without importing production regexes for provider tokens, valid/invalid JWTs, URLs, query names, headers, cookies, assignments, private keys, dotenv/env names, and custom regex rules.
175 +- [x] Build semantic arbitraries without importing production regexes for provider tokens, valid/invalid JWTs, URLs, query names, headers, cookies, assignments, private keys, dotenv/env names, and custom regex rules.
175 -- [ ] Every family must generate empty, boundary-length, Unicode-surrounded, punctuation, quoted, multiline, and oversized cases.
177 +- [x] Every family must generate empty, boundary-length, Unicode-surrounded, punctuation, quoted, multiline, and oversized cases.
177 -- [ ] Positive properties assert exact span/value/label, transformed text, unchanged surrounding bytes, and restore identity.
179 +- [x] Positive properties assert exact span/value/label, transformed text, unchanged surrounding bytes, and restore identity.
179 -- [ ] Negative properties mutate one semantic requirement and assert zero spans and unchanged text.
181 +- [x] Negative properties mutate one semantic requirement and assert zero spans and unchanged text.
181 -- [ ] Add custom-regex properties for zero/one/multiple captures, empty-match progress, unsafe-pattern rejection, span boundaries, and adversarial runtime.
183 +- [x] Add custom-regex properties for zero/one/multiple captures, empty-match progress, unsafe-pattern rejection, span boundaries, and adversarial runtime.
183 -- [ ] Add engine properties for idempotence, no source mutation, selected non-overlap, and preservation outside selected spans.
185 +- [x] Add engine properties for idempotence, no source mutation, selected non-overlap, and preservation outside selected spans.
185 -- [ ] Prove shrinking/replay by temporarily forcing a property failure, capture reported seed/path, rerun with `FC_SEED` and `FC_PATH`, then restore the assertion. No failing code is committed.
187 +- [x] Prove shrinking/replay by temporarily forcing a property failure, capture reported seed/path, rerun with `FC_SEED` and `FC_PATH`, then restore the assertion. No failing code is committed.
187 -- [ ] Run `mise run fuzz && mise run test -- extensions/leaks/__tests__`; expect PASS.
189 +- [x] Run `mise run fuzz && mise run test -- extensions/leaks/__tests__`; expect PASS.
189 -- [ ] Commit `test(leaks): fuzz every detector boundary`.
191 +- [x] Commit `test(leaks): fuzz every detector boundary`.
191 193 ##
Task 6: Phase Verification 193 195 **Files:** all Phase 1 files
195 -- [ ] Run `mise run fmt`.
197 +- [x] Run `mise run fmt`.
197 -- [ ] Run `mise run lint`.
199 +- [x] Run `mise run lint`.
199 -- [ ] Run `mise run test`.
201 +- [x] Run `mise run test`.
201 -- [ ] Run `mise run fuzz`; verify wall time is below two minutes.
203 +- [x] Run `mise run fuzz`; verify wall time is below two minutes.
203 -- [ ] Run `mise run check`.
205 +- [x] Run `mise run check`.
205 -- [ ] Inspect `git status --short` and preserve unrelated dirty files.
207 +- [x] Inspect `git status --short` and preserve unrelated dirty files.
207 -- [ ] Commit only any formatter changes belonging to Phase 1 as `style(leaks): format detector precision work`.
209 +- [x] Commit only any formatter changes belonging to Phase 1 as `style(leaks): format detector precision work`.
209 211 README and changelog remain Phase 3 scope.