1 +#
Leaks Spec Implementation Plan 3 +> **For agentic workers:** REQUIRED SUB-SKILL: Use /skill:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
5 +**Goal:** Rebuild `extensions/leaks` so provider-bound text is redacted per `extensions/leaks/SPEC.md`, local Pi behavior is restored when placeholders round-trip exactly, and every validation batch V0-V9 has executable evidence.
7 +**Architecture:** Replace prototype internals with a small redaction engine plus Pi hook adapter.
8 +State is in-memory only: settings, warning counters, learned exact values, placeholder maps, recent safe labels, and provider redaction counters.
9 +Provider payload redaction is authoritative; context redaction is opportunistic; tool args and finalized assistant messages restore placeholders locally.
11 +**Tech Stack:** TypeScript ESM, Node 22 built-ins, Pi extension API from `@earendil-works/pi-coding-agent`, Vitest, repo tasks via `mise`.
15 +**Phase:** Single-plan implementation.
17 +**Plan Location:** `extensions/leaks/PLAN.md`.
23 +| Spec section | Planned tasks |
24 +| ----------------------------- | ------------------------- |
25 +| Authority | Tasks 0, 14 |
26 +| Mission | Tasks 1, 10, 11 |
27 +| Core requirements | Tasks 1, 2, 9, 10, 12, 13 |
28 +| Core model | Tasks 2, 3, 9 |
29 +| Pi integration strategy | Tasks 10, 11 |
30 +| Settings | Task 4 |
31 +| Built-in detection | Task 7 |
32 +| Dotenv and environment values | Tasks 5, 6 |
33 +| False positives | Tasks 6, 8 |
34 +| UX and commands | Task 11 |
35 +| Validation ledger | Tasks 0, 12, 14 |
36 +| Non-goals | Tasks 1, 14 |
40 +- Create `extensions/leaks/src/types.ts`.
41 + Owns public internal types: settings, warnings, spans, labels, status, redaction result.
42 +- Create `extensions/leaks/src/safety.ts`.
43 + Owns safe text helpers, label sanitization, weak-value classification, placeholder detection.
44 +- Create `extensions/leaks/src/settings.ts`.
45 + Owns Pi settings loading, custom regex validation, regex compilation warnings.
46 +- Create `extensions/leaks/src/placeholders.ts`.
47 + Owns HMAC placeholder creation, collision suffixing, caps, restore mapping, no persistence.
48 +- Create `extensions/leaks/src/structures.ts`.
49 + Owns URL, query-param, header, cookie, and assignment component parsing.
50 +- Create `extensions/leaks/src/dotenv.ts`.
51 + Owns fixed dotenv discovery, dotenv parsing, process env learning, env key collapse to `ENV_KEY`.
52 +- Create `extensions/leaks/src/detectors.ts`.
53 + Owns built-in detector definitions and positive/negative detector classes.
54 +- Create `extensions/leaks/src/selector.ts`.
55 + Owns span merge, priority ordering, smallest-span overlap selection, existing-placeholder exclusion.
56 +- Create `extensions/leaks/src/engine.ts`.
57 + Owns redaction orchestration, deep traversal, failure-open handling, stats, status state.
58 +- Create `extensions/leaks/src/pi.ts`.
59 + Owns Pi hook wiring and `/leaks` command handling.
60 +- Replace `extensions/leaks/index.ts`.
61 + Export Pi extension factory and `__test` internals from the new modules.
62 +- Replace `extensions/leaks/__tests__/unit.test.ts`.
63 + Keep only high-signal core engine tests or delegate to new focused test files.
64 +- Replace `extensions/leaks/__tests__/harness.test.ts`.
65 + Test actual Pi hook behavior through the existing harness.
66 +- Create focused tests under `extensions/leaks/__tests__/`: `settings.test.ts`, `placeholders.test.ts`, `structures.test.ts`, `dotenv.test.ts`, `detectors.test.ts`, `selector.test.ts`, `ux.test.ts`, `performance.test.ts`, `ledger.test.ts`.
67 +- Replace `extensions/leaks/README.md`.
68 + Document behavior, threat model, settings, commands, limitations, and no secret values.
70 +##
Invariants For All Tasks 72 +- Never print secret values in tests, expected output, README examples, notifications, logs, status, or diagnostics.
73 +- Test fixture secret strings may exist in source tests only as controlled fixture inputs; assertions must check absence from output.
74 +- Mappings stay in memory only; do not call `pi.appendEntry`.
76 +- Do not implement rejected settings: `enabled`, `keywords`, `exclude`, `secretFiles`.
77 +- Use `mise run test -- <path>` for tests.
78 +- Use `mise run lint` and `mise run ci` only through `mise`.
80 +###
Task 0: Validation Ledger Baseline 84 +- Create: `extensions/leaks/__tests__/ledger.test.ts`
85 +- Modify: `extensions/leaks/SPEC.md` only if the spec itself is contradictory and user approves first.
87 +- [ ] **Step 1: Write a ledger coverage test**
89 +Create `extensions/leaks/__tests__/ledger.test.ts` with this structure so V0 scope and authority are executable instead of narrative-only:
92 +import { readFileSync }
from "node:fs";
93 +import path
from "node:path";
94 +import { describe, expect, it }
from "vitest";
96 +const specPath
= path.
resolve(
import.
meta.dirname,
"../SPEC.md");
97 +const spec
= readFileSync(specPath,
"utf8");
99 +const expectedHeadings
= [
102 + "Core requirements",
104 + "Pi integration strategy",
106 + "Built-in detection",
107 + "Dotenv and environment values",
110 + "Validation ledger",
116 + "V1 provider boundary",
120 + "V5 learned values",
121 + "V6 component parsers",
122 + "V7 false positives",
124 + "V9 performance/failure",
127 +const sectionBatchMap
= new Map<
string,
string[]>([
128 + [
"Authority", [
"V0 scope"]],
129 + [
"Mission", [
"V0 scope",
"V1 provider boundary"]],
131 + "Core requirements",
132 + [
"V1 provider boundary",
"V8 UX",
"V9 performance/failure"],
134 + [
"Core model", [
"V2 placeholders"]],
135 + [
"Pi integration strategy", [
"V1 provider boundary"]],
136 + [
"Settings", [
"V3 settings",
"V9 performance/failure"]],
137 + [
"Built-in detection", [
"V4 built-ins"]],
139 + "Dotenv and environment values",
140 + [
"V5 learned values",
"V6 component parsers",
"V7 false positives"],
142 + [
"False positives", [
"V6 component parsers",
"V7 false positives"]],
143 + [
"UX and commands", [
"V8 UX"]],
144 + [
"Validation ledger", [
"V0 scope"]],
145 + [
"Non-goals", [
"V0 scope"]],
148 +const normativeMarker
= 149 + /\b(must|must not|should|do not|never|only|requires?|required|accepted|planned|rejected|out of scope|non-goals?|always|at worst|when|on)\b/i;
151 +function sections() {
152 + const result
: Array<{ name
: string; body
: string }>
= [];
153 + const matches
= [
...spec.
matchAll(
/^## (.+)$/gm)];
154 + for (
let index
= 0; index
< matches.
length; index
++) {
155 + const match
= matches[index];
156 + const next
= matches[index
+ 1];
158 + name:
String(match[
1]),
159 + body: spec.
slice(match.
index! + match[
0].
length, next?.
index),
165 +function normativeSentences(body
: string) {
167 + .
replace(
/```[\s\S]*?```/g,
"")
168 + .
split(
/(?<=[.!?])\s+|\n+-\s+/g)
169 + .
map((line)
=> line.
trim())
170 + .
filter((line)
=> normativeMarker.
test(line));
173 +describe(
"leaks spec validation ledger", ()
=> {
174 + it(
"keeps the spec section map stable", ()
=> {
175 + const headings
= sections().
map((section)
=> section.
name);
176 + expect(headings).
toEqual(expectedHeadings);
179 + it(
"records every validation batch in the ledger and evidence table", ()
=> {
180 + for (
const batch
of batches) {
181 + expect(spec).
toContain(
`| ${batch}`);
185 + it(
"maps every normative sentence to at least one validation batch", ()
=> {
186 + const misses
= sections().
flatMap((section)
=> {
187 + const mappedBatches
= sectionBatchMap.
get(section.
name)
?? [];
188 + return normativeSentences(section.
body)
189 + .
filter(()
=> mappedBatches.
length === 0)
190 + .
map((sentence)
=> ({ section: section.
name, sentence }));
192 + expect(misses).
toEqual([]);
195 + it(
"keeps V0 authority and scope requirements explicit", ()
=> {
196 + expect(spec).
toContain(
"This spec is the source of truth");
197 + expect(spec).
toContain(
"current implementation is a prototype/reference");
198 + expect(spec).
toContain(
"Implementation must be fresh and spec-shaped");
199 + expect(spec).
toContain(
"Avoid creating `extensions/leaks-ref`");
200 + expect(spec).
toContain(
"Non-goals");
205 +Use regexes over headings and table rows; never parse or print secret fixture values.
207 +- [ ] **Step 2: Run ledger test and verify current baseline**
209 +Run: `mise run test -- extensions/leaks/__tests__/ledger.test.ts`
210 +Expected: PASS, because the current spec already records V0-V9 evidence.
212 +- [ ] **Step 3: Commit ledger baseline**
217 +git add extensions/leaks/__tests__/ledger.test.ts
218 +git commit -m
"test(leaks): lock spec validation ledger" 221 +###
Task 1: Fresh Engine Shell And Public Types 225 +- Create: `extensions/leaks/src/types.ts`
226 +- Create: `extensions/leaks/src/safety.ts`
227 +- Create: `extensions/leaks/src/engine.ts`
228 +- Replace: `extensions/leaks/index.ts`
229 +- Test: `extensions/leaks/__tests__/unit.test.ts`
231 +- [ ] **Step 1: Replace unit test with engine shell tests**
233 +Replace obsolete setting tests for rejected `enabled`, `keywords`, `exclude`, and `secretFiles` with tests that assert:
235 +- default engine is active
236 +- non-text values pass through unchanged
237 +- images and binary-looking objects are not inspected as special media
238 +- detector exceptions fail open and add one warning
239 +- secret values never appear in warning text
241 +Required test names:
243 +- `creates active engine with empty volatile state`
244 +- `does not implement rejected compatibility settings`
245 +- `fails open when a detector throws`
246 +- `keeps warning text secret-free`
248 +- [ ] **Step 2: Run shell tests and verify failure**
250 +Run: `mise run test -- extensions/leaks/__tests__/unit.test.ts`
251 +Expected: FAIL with missing exports from `__test` or missing modules.
253 +- [ ] **Step 3: Implement types and safety helpers**
255 +In `src/types.ts`, define exported types for:
257 +- `LeaksSettings` with only `regex: CustomRegexInput[]`
258 +- `CustomRegexInput` with `pattern?: unknown`, `label?: unknown`, and index signature for unsupported fields
259 +- `WarningRecord` with `code`, `message`, `severity`
260 +- `SpanLabel` with `tag`, `priority`, `source`
261 +- `SecretSpan` with `start`, `end`, `value`, `labels`, `kind`, `confidence`, `wholeSpan`
262 +- `RedactionResult` with `text`, `count`, `labels`, `placeholders`
263 +- `EngineStats` with all `/leaks status` counts required by the spec
265 +In `src/safety.ts`, implement:
267 +- `isPlainObject(value: unknown): value is Record<string, unknown>`
268 +- `sanitizeTag(raw: string): string`
269 +- `isExistingPlaceholder(text: string): boolean`
270 +- `maskDiagnostic(input: string): string` returning only safe metadata such as counts and labels
271 +- `isWeakValue(value: string): boolean` for booleans, nullish words, plain numbers, short strings, ordinary hostnames, ordinary URLs without credentials, references, UUIDs, and filesystem-ish paths
273 +- [ ] **Step 4: Implement minimal engine shell**
275 +In `src/engine.ts`, implement `LeaksEngine` with constructor accepting settings and env, `reload(cwd)`, `redactText(text, origin)`, `redactDeep(value, origin)`, `restoreText(text)`, `restoreDeep(value)`, `clear()`, and `stats()`.
276 +For this task, return input unchanged unless a provided test detector throws; on throw, add one warning and return original input.
278 +- [ ] **Step 5: Replace `index.ts` with new exports**
280 +`index.ts` must default-export the Pi extension from `src/pi.ts` after Task 10 exists.
281 +Until Task 10, export a no-op default factory that registers no hooks and export `__test` with `LeaksEngine`, helpers, and type-level constants.
283 +- [ ] **Step 6: Run shell tests and verify pass**
285 +Run: `mise run test -- extensions/leaks/__tests__/unit.test.ts`
288 +- [ ] **Step 7: Commit engine shell**
293 +git add extensions/leaks/index.ts extensions/leaks/src/types.ts extensions/leaks/src/safety.ts extensions/leaks/src/engine.ts extensions/leaks/__tests__/unit.test.ts
294 +git commit -m
"refactor(leaks): add spec-shaped engine shell" 297 +###
Task 2: Placeholder Store 301 +- Create: `extensions/leaks/src/placeholders.ts`
302 +- Create: `extensions/leaks/__tests__/placeholders.test.ts`
303 +- Modify: `extensions/leaks/src/engine.ts`
304 +- Modify: `extensions/leaks/index.ts`
306 +- [ ] **Step 1: Write placeholder tests**
310 +- placeholder format `__LEAK_<TAG>[_<TAG>...]_<HMAC12>[_N]__`
311 +- HMAC12 lowercase hex length
312 +- random per-store key makes same value produce different HMACs across stores
313 +- same value remains stable inside one store
314 +- tags freeze after first mapping
315 +- semantic priority orders tags as dotenv/env, structure, custom regex, built-in, generic
316 +- max 6 tags per placeholder
317 +- max 64 chars per sanitized tag
318 +- collision suffix `_2` when HMAC collision is forced by injectable digest function
320 +- overflow creates non-restorable placeholders and warns once
321 +- restore lookup replaces only exact placeholders
323 +- [ ] **Step 2: Run placeholder tests and verify failure**
325 +Run: `mise run test -- extensions/leaks/__tests__/placeholders.test.ts`
326 +Expected: FAIL with missing `PlaceholderStore`.
328 +- [ ] **Step 3: Implement `PlaceholderStore`**
330 +`PlaceholderStore` must use `node:crypto` `randomBytes(32)` and `createHmac("sha256", key)` by default.
331 +Expose constructor injection for test digest only.
332 +Store `secret -> placeholder` and `placeholder -> secret` maps.
333 +Reject persistence by keeping every map private to the store instance.
334 +Expose `create(value, labels)`, `restore(text)`, `clear()`, and `stats()`.
336 +- [ ] **Step 4: Wire engine to placeholder store**
338 +`LeaksEngine.redactText` must call the store for selected spans.
339 +`restoreText` and `restoreDeep` must use the store.
340 +`clear()` must clear mappings and counters that spec allows to reset.
342 +- [ ] **Step 5: Run placeholder tests and engine tests**
344 +Run: `mise run test -- extensions/leaks/__tests__/placeholders.test.ts extensions/leaks/__tests__/unit.test.ts`
347 +- [ ] **Step 6: Commit placeholder store**
352 +git add extensions/leaks/src/placeholders.ts extensions/leaks/src/engine.ts extensions/leaks/index.ts extensions/leaks/__tests__/placeholders.test.ts
353 +git commit -m
"feat(leaks): add volatile placeholder store" 356 +###
Task 3: Span Selector 360 +- Create: `extensions/leaks/src/selector.ts`
361 +- Create: `extensions/leaks/__tests__/selector.test.ts`
362 +- Modify: `extensions/leaks/src/engine.ts`
363 +- Modify: `extensions/leaks/index.ts`
365 +- [ ] **Step 1: Write selector tests**
369 +- identical spans merge labels before placeholder creation
370 +- component parser span wins over enclosing exact learned value
371 +- exact learned value wins over generic regex
372 +- smallest secret-bearing span wins for non-identical overlaps
373 +- private key block keeps whole span over smaller generic matches
374 +- JWT keeps whole span over smaller component-looking matches
375 +- existing placeholders are not redacted again
376 +- adjacent spans replace correctly without index drift
378 +- [ ] **Step 2: Run selector tests and verify failure**
380 +Run: `mise run test -- extensions/leaks/__tests__/selector.test.ts`
381 +Expected: FAIL with missing `selectSecretSpans`.
383 +- [ ] **Step 3: Implement selector**
385 +Implement `selectSecretSpans(text, spans)` in `src/selector.ts`.
386 +Sort by start, end, confidence, priority, and span length.
387 +First remove spans inside existing placeholders.
388 +Merge identical ranges by combined label list.
389 +For overlaps, choose by forced whole-span kinds (`private-key`, `jwt`), then component, then exact, then custom, then built-in, then generic, then shorter length.
390 +Return non-overlapping spans sorted descending by `start` for safe replacement.
392 +- [ ] **Step 4: Wire selector into engine**
394 +`LeaksEngine.redactText` must collect candidate spans from enabled detectors, pass them to the selector, create placeholders once per selected span, and replace from right to left.
396 +- [ ] **Step 5: Run selector tests and placeholder tests**
398 +Run: `mise run test -- extensions/leaks/__tests__/selector.test.ts extensions/leaks/__tests__/placeholders.test.ts`
401 +- [ ] **Step 6: Commit selector**
406 +git add extensions/leaks/src/selector.ts extensions/leaks/src/engine.ts extensions/leaks/index.ts extensions/leaks/__tests__/selector.test.ts
407 +git commit -m
"feat(leaks): select secret spans by confidence" 410 +###
Task 4: Settings And Custom Regex 414 +- Create: `extensions/leaks/src/settings.ts`
415 +- Create: `extensions/leaks/__tests__/settings.test.ts`
416 +- Modify: `extensions/leaks/src/engine.ts`
417 +- Modify: `extensions/leaks/index.ts`
419 +- [ ] **Step 1: Write settings tests**
423 +- only `leaks.regex` is accepted
424 +- unsupported fields on regex entries warn and are ignored
425 +- `flags` warns and is ignored
426 +- pattern length 512 accepted
427 +- pattern length 513 rejected
428 +- label `[A-Z0-9_]{1,64}` accepted
429 +- missing label loads with `CUSTOM_REGEX` warning
430 +- invalid label falls back to `CUSTOM_REGEX` warning
431 +- invalid regex syntax rejected with warning
432 +- zero captures redacts full match
433 +- one capture redacts group 1
434 +- multiple captures redact group 1 and warn
435 +- unsafe regex rejection: backreference, lookaround, nested quantifier, quantified alternation, empty alternative, dot-star catchall
436 +- warning text never includes secret fixture values
438 +- [ ] **Step 2: Run settings tests and verify failure**
440 +Run: `mise run test -- extensions/leaks/__tests__/settings.test.ts`
441 +Expected: FAIL with missing settings compiler.
443 +- [ ] **Step 3: Implement settings loader and compiler**
447 +- `loadLeaksSettings(raw: unknown): LoadedSettings`
448 +- `compileCustomRegex(settings: LoadedSettings): CompiledCustomRule[]`
449 +- `countCaptures(pattern: string): number`
450 +- `isUnsafeRegex(pattern: string): boolean`
452 +Use `d` regex flag internally for match indices and `g` for iteration.
453 +Do not accept user-provided flags.
454 +Warnings must use safe codes and no raw secret value text.
456 +- [ ] **Step 4: Wire custom regex into engine**
458 +Engine reload must compile custom regex once.
459 +Custom regex spans must use source `custom` and label from sanitized `CUSTOM_REGEX` or valid user label.
461 +- [ ] **Step 5: Run settings and selector tests**
463 +Run: `mise run test -- extensions/leaks/__tests__/settings.test.ts extensions/leaks/__tests__/selector.test.ts`
466 +- [ ] **Step 6: Commit settings**
471 +git add extensions/leaks/src/settings.ts extensions/leaks/src/engine.ts extensions/leaks/index.ts extensions/leaks/__tests__/settings.test.ts
472 +git commit -m
"feat(leaks): compile safe custom regex settings" 475 +###
Task 5: Dotenv And Process Environment Learning 479 +- Create: `extensions/leaks/src/dotenv.ts`
480 +- Create: `extensions/leaks/__tests__/dotenv.test.ts`
481 +- Modify: `extensions/leaks/src/engine.ts`
482 +- Modify: `extensions/leaks/index.ts`
484 +- [ ] **Step 1: Write dotenv/env tests**
488 +- only `.env`, `.env.local`, and `.env.*.local` are discovered in cwd
489 +- no recursive discovery
490 +- `export KEY=value` parses
491 +- single quotes, double quotes, and inline comments parse correctly
492 +- sensitive key plus non-weak value learns exact value
493 +- weak/common values are ignored
494 +- public prefixes suppress key-name sensitivity only
495 +- high-confidence secret shapes under public prefixes still redact
496 +- process env uses same classifier
497 +- process env labels collapse to `ENV_KEY`
498 +- status never reports env var names or values
499 +- learned exact value cap 8192 stops learning and warns once
501 +- [ ] **Step 2: Run dotenv tests and verify failure**
503 +Run: `mise run test -- extensions/leaks/__tests__/dotenv.test.ts`
504 +Expected: FAIL with missing dotenv learner.
506 +- [ ] **Step 3: Implement dotenv parser and learner**
508 +Implement fixed file discovery with `node:fs` and `node:path` only.
509 +Implement `parseDotenv(text)` with shell-compatible enough parsing for one-line assignments.
510 +Implement sensitive-key matching that is case-insensitive, treats `_` and `-` as equivalent, and allows numeric suffixes.
511 +Implement public-prefix suppression for `PUBLIC_`, `NEXT_PUBLIC_`, and `VITE_`.
512 +Implement exact value cap 8192 and warning-once behavior.
514 +- [ ] **Step 4: Wire learning into engine reload**
516 +`LeaksEngine.reload(cwd, rawSettings, env)` must load fixed dotenv files and process env.
517 +Learned values must produce exact-value spans with dotenv key tag or `ENV_KEY` tag.
518 +Credentialed URLs must be delegated to Task 6 component parsing before whole-value learning.
520 +- [ ] **Step 5: Run dotenv and placeholder tests**
522 +Run: `mise run test -- extensions/leaks/__tests__/dotenv.test.ts extensions/leaks/__tests__/placeholders.test.ts`
525 +- [ ] **Step 6: Commit dotenv/env learning**
530 +git add extensions/leaks/src/dotenv.ts extensions/leaks/src/engine.ts extensions/leaks/index.ts extensions/leaks/__tests__/dotenv.test.ts
531 +git commit -m
"feat(leaks): learn dotenv and env secret values" 534 +###
Task 6: Structured Component Parsers 538 +- Create: `extensions/leaks/src/structures.ts`
539 +- Create: `extensions/leaks/__tests__/structures.test.ts`
540 +- Modify: `extensions/leaks/src/dotenv.ts`
541 +- Modify: `extensions/leaks/src/engine.ts`
542 +- Modify: `extensions/leaks/index.ts`
544 +- [ ] **Step 1: Write structure parser tests**
548 +- credentialed URL password redacts while username, host, db name, and scheme remain visible
549 +- sensitive query parameter value redacts while parameter name remains visible
550 +- URL without credentials is not secret even for `DATABASE_URL`, `REDIS_URL`, or `MONGO_URL`
551 +- `Authorization: Bearer <value>` redacts token only
552 +- `Authorization: Basic <value>` redacts credential only
553 +- `X-API-Key: <value>` redacts value only
554 +- `Cookie: session=<value>; theme=dark` redacts sensitive cookie only
555 +- assignments in env, properties, YAML, JSON, TOML, INI, HCL, XML-ish, and shell-ish text redact value only
556 +- shell command containing a header redacts the header value without redacting whole command
557 +- JWTs remain whole-token spans
558 +- private keys remain whole logical secret spans
560 +- [ ] **Step 2: Run structure tests and verify failure**
562 +Run: `mise run test -- extensions/leaks/__tests__/structures.test.ts`
563 +Expected: FAIL with missing structure parsers.
565 +- [ ] **Step 3: Implement component parsers**
567 +Implement functions that return `SecretSpan[]` with source `structure`:
569 +- `findCredentialedUrlSpans(text)`
570 +- `findSensitiveQuerySpans(text)`
571 +- `findHeaderSpans(text)`
572 +- `findCookieSpans(text)`
573 +- `findAssignmentSpans(text)`
575 +Use `URL` where full URL parsing succeeds.
576 +For text fragments and shell snippets, use bounded regexes with match indices.
577 +Never return a whole shell command span.
579 +- [ ] **Step 4: Wire component parsers before exact learned values**
581 +Engine span collection order must add component spans before exact learned values.
582 +Dotenv/env URL values must learn parsed secret components instead of whole URL when parsing succeeds.
584 +- [ ] **Step 5: Run structure, dotenv, and selector tests**
586 +Run: `mise run test -- extensions/leaks/__tests__/structures.test.ts extensions/leaks/__tests__/dotenv.test.ts extensions/leaks/__tests__/selector.test.ts`
589 +- [ ] **Step 6: Commit structures**
594 +git add extensions/leaks/src/structures.ts extensions/leaks/src/dotenv.ts extensions/leaks/src/engine.ts extensions/leaks/index.ts extensions/leaks/__tests__/structures.test.ts
595 +git commit -m
"feat(leaks): redact secret structure components" 598 +###
Task 7: Built-In Detectors 602 +- Create: `extensions/leaks/src/detectors.ts`
603 +- Create: `extensions/leaks/__tests__/detectors.test.ts`
604 +- Modify: `extensions/leaks/src/engine.ts`
605 +- Modify: `extensions/leaks/index.ts`
607 +- [ ] **Step 1: Write detector corpus tests**
609 +Create positive controls for all minimum families:
611 +- AI provider keys with distinctive prefixes or key context
612 +- VCS and package-manager tokens
613 +- cloud access keys and credential-like IDs
614 +- payment, messaging, webhook, and mail service tokens
615 +- auth, OAuth, JWT, cookie, and session secrets
616 +- database and cache credentialed connection strings
617 +- private key material: PEM, OpenSSH, PGP private, encrypted cosign, PuTTY PPK private section, age secret key, minisign secret key
618 +- generic sensitive-key assignments including every key name listed in spec
620 +Create negative controls for:
622 +- arbitrary account IDs
628 +- broad opaque keys named `lineage` and `value`
630 +- public certificates
632 +- [ ] **Step 2: Run detector tests and verify failure**
634 +Run: `mise run test -- extensions/leaks/__tests__/detectors.test.ts`
635 +Expected: FAIL with missing or incomplete built-in detectors.
637 +- [ ] **Step 3: Implement detector definitions**
639 +In `src/detectors.ts`, export precompiled detector objects.
640 +Each detector must define id, tag, family, regex, optional group, confidence, and whole-span kind.
641 +Precompile regexes once at module load.
642 +Avoid broad entropy-only detectors.
643 +Private key armors must redact whole logical secret values; boundary text becomes tags only.
644 +JWTs must redact whole token.
646 +- [ ] **Step 4: Wire built-ins into engine**
648 +Engine must run structure parsers, learned exact values, custom regex, and built-ins as separate sources, then selector decides overlaps.
649 +Built-in detector failures must fail open for that detector pass, warn once, and not block Pi.
651 +- [ ] **Step 5: Run detector and false-positive-related tests**
653 +Run: `mise run test -- extensions/leaks/__tests__/detectors.test.ts extensions/leaks/__tests__/structures.test.ts`
656 +- [ ] **Step 6: Commit built-ins**
661 +git add extensions/leaks/src/detectors.ts extensions/leaks/src/engine.ts extensions/leaks/index.ts extensions/leaks/__tests__/detectors.test.ts
662 +git commit -m
"feat(leaks): add high-confidence built-in detectors" 665 +###
Task 8: False Positive Policy 669 +- Create: `extensions/leaks/__tests__/false-positives.test.ts`
670 +- Modify: `extensions/leaks/src/safety.ts`
671 +- Modify: `extensions/leaks/src/detectors.ts`
672 +- Modify: `extensions/leaks/src/structures.ts`
673 +- Modify: `extensions/leaks/src/selector.ts`
675 +- [ ] **Step 1: Write false-positive tests**
677 +Create hand negative controls for:
682 +- URLs needing semantic host/path edits
684 +- distinguished names
687 +- long non-provider hex strings without secret context
688 +- comments and defaults
691 +- environment references `$API_KEY`, `${API_KEY}`, `${{ secrets.PROD_TOKEN }}`, `process.env.API_KEY`
692 +- private names and project codenames
695 +- TLS certificate block
697 +Create positive controls proving custom regex overrides negative policy and high-confidence provider-specific patterns still redact.
699 +- [ ] **Step 2: Run false-positive tests and verify failure or pass**
701 +Run: `mise run test -- extensions/leaks/__tests__/false-positives.test.ts`
702 +Expected before refinement: FAIL for any over-broad detector.
703 +Expected after refinement: PASS.
705 +- [ ] **Step 3: Tighten weak-value and reject logic**
707 +Refine `isWeakValue`, detector patterns, and selector priorities until all negatives stay visible and all positive controls redact.
708 +Keep metadata visible aggressively.
709 +Do not add user exclude lists.
711 +- [ ] **Step 4: Run detector family tests again**
713 +Run: `mise run test -- extensions/leaks/__tests__/detectors.test.ts extensions/leaks/__tests__/false-positives.test.ts`
716 +- [ ] **Step 5: Commit false-positive policy**
721 +git add extensions/leaks/src/safety.ts extensions/leaks/src/detectors.ts extensions/leaks/src/structures.ts extensions/leaks/src/selector.ts extensions/leaks/__tests__/false-positives.test.ts
722 +git commit -m
"fix(leaks): keep metadata visible" 725 +###
Task 9: Deep Redaction, Restoration, Caps, And Failure Bounds 729 +- Create: `extensions/leaks/__tests__/performance.test.ts`
730 +- Modify: `extensions/leaks/src/engine.ts`
731 +- Modify: `extensions/leaks/src/placeholders.ts`
732 +- Modify: `extensions/leaks/src/types.ts`
734 +- [ ] **Step 1: Write performance and traversal tests**
738 +- deep traversal copies objects and does not mutate originals during redaction
739 +- cyclic object traversal terminates
740 +- object identity bounds prevent repeat work
741 +- depth 64 cap warns once and skips deeper values
742 +- bigint, symbol, function, null, number, boolean pass through
743 +- arrays and plain objects are traversed
744 +- learned-value cap 8192 is enforced
745 +- placeholder map cap 8192 is enforced
746 +- operation count is bounded by input size times rule count
747 +- precompiled rule count does not grow across redaction calls
748 +- detector throw fails open for that pass and warns once
750 +- [ ] **Step 2: Run performance tests and verify failure**
752 +Run: `mise run test -- extensions/leaks/__tests__/performance.test.ts`
753 +Expected: FAIL until traversal and counters are complete.
755 +- [ ] **Step 3: Implement bounded traversal**
757 +Implement recursive clone traversal with `WeakMap<object, unknown>` for cycles and identity.
759 +Only redact string values.
760 +Return `{ value, changed, count }` from deep redaction.
761 +Restore uses same traversal rules but replaces known placeholders.
763 +- [ ] **Step 4: Implement operation and warning bounds**
765 +Track per-pass safe operation counters if useful for tests.
766 +Use warning-once keys for cap overflow, depth overflow, regex failure, and detector failure.
767 +Never include secret values in warning messages.
769 +- [ ] **Step 5: Run full unit suite**
771 +Run: `mise run test -- extensions/leaks/__tests__/unit.test.ts extensions/leaks/__tests__/placeholders.test.ts extensions/leaks/__tests__/selector.test.ts extensions/leaks/__tests__/settings.test.ts extensions/leaks/__tests__/dotenv.test.ts extensions/leaks/__tests__/structures.test.ts extensions/leaks/__tests__/detectors.test.ts extensions/leaks/__tests__/false-positives.test.ts extensions/leaks/__tests__/performance.test.ts`
774 +- [ ] **Step 6: Commit bounded engine**
779 +git add extensions/leaks/src/engine.ts extensions/leaks/src/placeholders.ts extensions/leaks/src/types.ts extensions/leaks/__tests__/performance.test.ts
780 +git commit -m
"feat(leaks): bound redaction traversal and caps" 783 +###
Task 10: Pi Provider Boundary Hooks 787 +- Create: `extensions/leaks/src/pi.ts`
788 +- Replace: `extensions/leaks/__tests__/harness.test.ts`
789 +- Modify: `extensions/leaks/index.ts`
791 +- [ ] **Step 1: Write harness tests for hooks**
793 +Replace harness tests with cases for:
795 +- extension loads in real Pi runtime
796 +- `session_start` initializes settings, dotenv/env learning, status
797 +- `context` redacts message copies and does not mutate originals
798 +- `before_provider_request` redacts final provider payload authoritatively
799 +- provider authentication headers remain present
800 +- `tool_call` restores placeholders in mutable tool args before local execution
801 +- `message_end` restores placeholders in finalized assistant messages
802 +- no mappings are persisted through session entries
803 +- no tools are registered by leaks
804 +- only slash command `leaks` is registered
806 +- [ ] **Step 2: Run harness tests and verify failure**
808 +Run: `mise run test -- extensions/leaks/__tests__/harness.test.ts`
809 +Expected: FAIL until Pi adapter exists.
811 +- [ ] **Step 3: Implement Pi adapter**
813 +In `src/pi.ts`, default-export a factory taking `ExtensionAPI`.
814 +Create one `LeaksEngine` per extension instance.
815 +Register handlers for `session_start`, `context`, `before_provider_request`, `tool_call`, and `message_end`.
816 +Do not call `appendEntry`.
817 +Do not register tools.
818 +Register command `leaks` only.
819 +Use `ctx.cwd` for dotenv discovery.
820 +Use settings from the runtime settings API when available and fallback to `.pi/settings.json` only if the current project is trusted or the harness has no settings API.
822 +- [ ] **Step 4: Replace `index.ts`**
824 +`index.ts` must import the factory from `src/pi.ts`, export it as default, and export `__test` internals used by tests.
826 +- [ ] **Step 5: Run harness tests**
828 +Run: `mise run test -- extensions/leaks/__tests__/harness.test.ts`
831 +- [ ] **Step 6: Commit Pi hooks**
836 +git add extensions/leaks/src/pi.ts extensions/leaks/index.ts extensions/leaks/__tests__/harness.test.ts
837 +git commit -m
"feat(leaks): enforce provider-bound redaction hooks" 840 +###
Task 11: UX, Status, Commands, And Safe Diagnostics 844 +- Create: `extensions/leaks/__tests__/ux.test.ts`
845 +- Modify: `extensions/leaks/src/pi.ts`
846 +- Modify: `extensions/leaks/src/engine.ts`
847 +- Modify: `extensions/leaks/src/types.ts`
849 +- [ ] **Step 1: Write UX tests**
853 +- one aggregate notification per provider turn with new leak values
854 +- no notification for a clean provider turn
855 +- footer/status shows enabled/on and last provider redaction count
856 +- `/leaks status` shows all required fields
857 +- `/leaks status` includes invalid regex count
858 +- `/leaks status` shows recent safe redaction labels
859 +- `/leaks status` shows latest safe placeholder tags only
860 +- process environment key names display only as `ENV_KEY`
861 +- `/leaks reload` reloads settings and dotenv/env learning
862 +- `/leaks test <text>` prints redacted diagnostic without secret values
863 +- `/leaks clear` asks for confirmation when UI can confirm
864 +- `/leaks clear` respects cancel
865 +- `/leaks clear` clears placeholder mappings when confirmed
867 +- [ ] **Step 2: Run UX tests and verify failure**
869 +Run: `mise run test -- extensions/leaks/__tests__/ux.test.ts`
870 +Expected: FAIL until command output is complete.
872 +- [ ] **Step 3: Implement status model**
874 +Engine stats must expose:
877 +- built-in rule count
878 +- custom regex count
879 +- regex warning/error count
880 +- learned dotenv/env value count
881 +- placeholder mapping count
882 +- last provider redaction count
883 +- total provider redaction count
884 +- recent safe redaction labels
885 +- latest safe placeholder tags
886 +- invalid regex count
888 +- [ ] **Step 4: Implement command handlers**
890 +`/leaks status` formats a safe multi-line report.
891 +`/leaks reload` reloads settings and learning from current cwd.
892 +`/leaks test <text>` redacts the supplied local diagnostic text and reports counts, labels, and redacted output; missed secrets are possible by definition.
893 +`/leaks clear` confirms when `ctx.hasUI`, clears mappings and volatile restore state on confirmation, and reports cancellation otherwise.
895 +- [ ] **Step 5: Implement footer/status notification updates**
897 +On `session_start`, set status to `leaks on | last 0`.
898 +After each provider redaction, update status and notify once if count > 0.
899 +Use warning severity only for faulty settings or detector failures; use info for reload/clear/test success.
901 +- [ ] **Step 6: Run UX and harness tests**
903 +Run: `mise run test -- extensions/leaks/__tests__/ux.test.ts extensions/leaks/__tests__/harness.test.ts`
906 +- [ ] **Step 7: Commit UX**
911 +git add extensions/leaks/src/pi.ts extensions/leaks/src/engine.ts extensions/leaks/src/types.ts extensions/leaks/__tests__/ux.test.ts
912 +git commit -m
"feat(leaks): add safe status and commands" 915 +###
Task 12: End-To-End Validation Batches V0-V9 919 +- Modify: `extensions/leaks/__tests__/ledger.test.ts`
920 +- Create: `extensions/leaks/__tests__/validation-batches.test.ts`
921 +- Modify: `extensions/leaks/SPEC.md` only if new evidence records are explicitly desired by the user.
923 +- [ ] **Step 1: Write validation batch test wrapper**
925 +Create `validation-batches.test.ts` that groups existing focused tests by V0-V9 labels and asserts each batch has at least one positive and one negative control where the spec requires controls.
926 +Do not duplicate every fixture; import fixture builders from existing test files only if those builders are exported without secrets in names.
928 +- [ ] **Step 2: Run validation batch tests**
930 +Run: `mise run test -- extensions/leaks/__tests__/ledger.test.ts extensions/leaks/__tests__/validation-batches.test.ts`
933 +- [ ] **Step 3: Run all leaks tests**
935 +Run: `mise run test -- extensions/leaks/__tests__`
938 +- [ ] **Step 4: Commit validation batches**
943 +git add extensions/leaks/__tests__/ledger.test.ts extensions/leaks/__tests__/validation-batches.test.ts
944 +git commit -m
"test(leaks): map spec validation batches" 947 +###
Task 13: README And User Documentation 951 +- Replace: `extensions/leaks/README.md`
952 +- Modify: `extensions/leaks/package.json` only if description or keywords no longer match.
953 +- Test: markdown lint via repo lint task.
955 +- [ ] **Step 1: Rewrite README**
957 +README must include:
959 +- mission: provider-bound plaintext redaction
960 +- threat model and non-goals
961 +- transparent local behavior and placeholder tradeoff
962 +- placeholder examples using fake values only
963 +- settings JSON with only `regex`
964 +- custom regex label rules
965 +- commands: `/leaks status`, `/leaks reload`, `/leaks test <text>`, `/leaks clear`
966 +- dotenv/env learning rules
967 +- false-positive policy
968 +- limitations for images, audio, binary, OCR, semantic secret-byte edits, DLP, sandboxing, permissions, repo scanning, and git history cleanup
969 +- no secret values in diagnostics guarantee
971 +- [ ] **Step 2: Run README generation check only if repo requires it**
973 +Run: `mise run readme -- leaks`
974 +Expected: README remains semantically aligned with manual content or generator updates it without adding unsupported settings.
975 +If generator overwrites critical spec content, stop and ask human because build tooling conflicts with the spec.
977 +- [ ] **Step 3: Run markdown lint through repo lint**
979 +Run: `mise run lint`
982 +- [ ] **Step 4: Commit README**
987 +git add extensions/leaks/README.md extensions/leaks/package.json
988 +git commit -m
"docs(leaks): document spec-shaped redaction" 991 +###
Task 14: Final Integration Gate 995 +- Modify: any leaks files touched by failing checks.
997 +- [ ] **Step 1: Run focused leaks tests**
999 +Run: `mise run test -- extensions/leaks/__tests__`
1002 +- [ ] **Step 2: Run static extension checks**
1004 +Run: `mise run check`
1007 +- [ ] **Step 3: Run full CI**
1012 +- [ ] **Step 4: Search for plan-forbidden placeholders in implementation**
1014 +Run: `grep -R "TO[D]O\|TB[D]\|secretFiles\|keywords\|exclude\|enabled" extensions/leaks --exclude=SPEC.md`
1015 +Expected: no matches for unfinished-marker words or unsupported settings in runtime code; README may mention rejected settings only as rejected.
1017 +- [ ] **Step 5: Verify mappings are not persisted**
1019 +Run: `grep -R "appendEntry\|sessionManager.*append\|writeFile.*LEAK\|localStorage\|sessionStorage" extensions/leaks --exclude=SPEC.md`
1020 +Expected: no runtime persistence of placeholder mappings.
1022 +- [ ] **Step 6: Verify secret-safe diagnostics by test names**
1024 +Run: `mise run test -- extensions/leaks/__tests__/ux.test.ts extensions/leaks/__tests__/settings.test.ts extensions/leaks/__tests__/performance.test.ts`
1025 +Expected: PASS with tests that assert fixture secret strings are absent from diagnostics.
1027 +- [ ] **Step 7: Final commit**
1033 +git commit --allow-empty -m
"chore(leaks): complete spec implementation gate" 1036 +Use the empty commit only if all implementation commits already captured file changes.
1038 +##
Normative Requirement Ledger 1040 +| Spec area | Requirement group | V batch | Plan coverage |
1041 +| ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------- |
1042 +| Authority | Treat `extensions/leaks/SPEC.md` as source of truth and current implementation as obsolete reference. | V0 | Task 0 locks spec ledger; Task 1 replaces obsolete settings/runtime assumptions; Task 14 checks rejected legacy names. |
1043 +| Authority | Use a fresh spec-shaped implementation; overwrite `index.ts`, tests, and README in place; do not create `extensions/leaks-ref`. | V0 | File Structure and Tasks 1, 10, 13 replace files in place and never add a reference extension directory. |
1044 +| Mission | Protect provider-bound plaintext while preserving provider auth headers and selected provider call ability. | V1 | Task 10 tests authoritative `before_provider_request` redaction and provider auth preservation. |
1045 +| Mission | Keep local Pi session and tool behavior unredacted except exact placeholder round trips. | V1/V2 | Tasks 2, 9, and 10 implement restore maps, `tool_call` restore, and `message_end` restore. |
1046 +| Mission and Non-goals | Exclude exfiltration guard, sandboxing, DLP, permissions, repo scanning, git cleanup, binary/OCR/image/audio redaction, and homomorphic or symbolic secret-byte editing. | V0 | Tasks 1, 13, and 14 document and check excluded scope; no tools or permission gates are registered. |
1047 +| Core requirements | Normal Pi workflows remain transparent by default; local visible/session behavior preserves original values where possible. | V1/V8 | Tasks 10 and 11 test context copy redaction, local restoration, and non-spam UX. |
1048 +| Core requirements | Run every provider turn and touch user/tool/assistant text fields; context redaction is opportunistic and provider payload redaction authoritative. | V1 | Task 10 wires `context` and `before_provider_request` and tests provider-bound payloads. |
1049 +| Core requirements | Bound hot path by input size, rule count, match count, mapping caps, object identity, and depth 64; avoid O(n²); precompile regexes. | V9 | Tasks 7 and 9 precompile rules and test traversal/cap/performance bounds. |
1050 +| Core requirements | Faulty user regex and detector failures must warn, fail open, and never prevent Pi from loading. | V3/V9 | Tasks 4 and 9 test unsafe input rejection, warning counters, and detector failure-open behavior. |
1051 +| Core requirements | UX must never print classified or learned secret values; local restoration may show original values only because Pi already had them. | V8 | Task 11 status/command tests assert fixture secrets and env names are absent. |
1052 +| Core model | Provider sees placeholders; local Pi keeps mappings in memory only; reload/new session/exit/clear can make placeholders unrestorable. | V2/V8 | Tasks 2, 10, 11, and 14 implement volatile maps, no `appendEntry`, and `/leaks clear`. |
1053 +| Core model | Placeholder format uses tags, HMAC12, random in-memory key, collision suffix, stable same-value mapping, frozen tags, and overflow non-restorable placeholders. | V2 | Task 2 tests format, HMAC, stability, tag ordering/caps, collision suffix, and overflow. |
1054 +| Core model | Tags derive from dotenv/env, custom labels, built-ins, structure components, and service/type labels, with semantic priority and caps. | V2/V5/V6 | Tasks 2, 5, 6, and 7 generate tags from every source and verify ordering. |
1055 +| Core model | Select component spans before enclosing exact learned values, exact before generic regexes, smallest secret-bearing overlap, private key/JWT whole spans, and never replace inside existing placeholders. | V2/V6/V7 | Tasks 3, 6, 7, and 8 test selector behavior and false-positive policy. |
1056 +| Pi integration | Use `session_start`, `context`, `before_provider_request`, `tool_call`, and `message_end`; do not persist mappings or register tools; register only `/leaks`. | V1/V8 | Task 10 harness tests all hooks plus no persistence/no tools/one command. |
1057 +| Settings | Accept only `leaks.regex` with `pattern` and `label`; reject `flags` and unsupported fields; cap pattern and label lengths. | V3 | Task 4 settings tests cover accepted and rejected settings. |
1058 +| Settings | Reject cheap unsafe regex constructs; faulty settings warn without breaking startup or provider requests. | V3/V9 | Task 4 implements heuristic rejection; Task 9 tests failure-open behavior. |
1059 +| Settings | Custom regex capture semantics: zero captures full match, one capture group 1, multiple group 1 with warning; labels must match `[A-Z0-9_]{1,64}` or fall back to `CUSTOM_REGEX`. | V3 | Task 4 tests capture counts and label fallback. |
1060 +| Built-ins | Always active high-confidence detector families cover AI, VCS/package, cloud, payment/messaging/webhook/mail, auth/OAuth/JWT/cookie/session, DB/cache URLs, private keys, and sensitive assignments. | V4 | Task 7 has positive controls for each minimum detector family. |
1061 +| Built-ins | Credential-like IDs redact only for reliable provider-specific patterns; arbitrary account/customer/org/project IDs, hostnames, and domains stay visible. | V4/V7 | Tasks 7 and 8 include explicit negative controls. |
1062 +| Dotenv/env | Learn exact values from fixed cwd files `.env`, `.env.local`, `.env.*.local`; no recursive discovery or user-configured file list. | V5 | Task 5 discovery tests fixed file behavior. |
1063 +| Dotenv/env | Process env uses same classifier; status collapses env key names to `ENV_KEY`; values and names never print. | V5/V8 | Tasks 5 and 11 test env learning and UX collapse. |
1064 +| Dotenv/env | Sensitive keys are case-insensitive with `_`/`-` equivalence and numeric suffixes; public prefixes suppress key-name sensitivity only; weak/common values ignored. | V5/V7 | Tasks 5 and 8 cover key classifier and weak metadata negatives. |
1065 +| Dotenv/env and structures | Credentialed URL, query, header, cookie, and assignment parsing redacts only secret components while preserving safe structure. | V6/V7 | Task 6 structure parser tests cover URL/header/cookie/assignment components and shell snippets. |
1066 +| Dotenv/env and structures | JWTs and private key material redact as whole logical secrets; public keys and certificates remain metadata. | V6/V7 | Tasks 6, 7, and 8 include whole-span positives and public-material negatives. |
1067 +| False positives | Metadata is leaked aggressively; no entropy-only redaction; names, hosts, domains, ordinary URLs, references, IDs, codenames, and internal domains remain visible unless custom regex matches. | V7 | Task 8 negative corpus and custom-regex override tests enforce this policy. |
1068 +| UX and commands | Notify once per redacting provider turn, not per secret, and no notification for clean turns. | V8 | Task 11 UX tests aggregate notifications. |
1069 +| UX and commands | `/leaks status` reports active state, rule counts, warning/error counts, learned count, mapping count, last/total counts, recent labels, latest tags, and invalid regex count without secret values. | V8 | Task 11 implements and tests the full status model. |
1070 +| UX and commands | `/leaks reload`, `/leaks test <text>`, and `/leaks clear` operate safely; clear respects cancellation. | V8 | Task 11 command tests cover reload/test/clear and confirmation behavior. |
1071 +| Validation ledger | Every validation batch records command, fixture class, and result; detector batches have positive and negative controls; demo corpus evidence reports only paths/key names/labels/classes/counts. | V0/V4/V7 | Tasks 0 and 12 test ledger presence and batch mapping; Tasks 7 and 8 provide controls. |
1073 +##
Reviewer Checklist 1075 +- V0 scope: spec authority honored; obsolete prototype treated as reference only; non-goals excluded.
1076 +- V1 provider boundary: both `context` and `before_provider_request`; provider auth preserved; local restore hooks present.
1077 +- V2 placeholders: HMAC, tags, caps, collision suffix, restore, stability, no persistence.
1078 +- V3 settings: only `regex`; unsafe patterns rejected; warnings safe.
1079 +- V4 built-ins: minimum detector families covered by positive and negative controls.
1080 +- V5 learned values: fixed dotenv files and process env classifier; caps; env key collapse.
1081 +- V6 component parsers: URL/header/cookie/assignment components preserve safe structure.
1082 +- V7 false positives: metadata remains visible; no entropy-only redaction.
1083 +- V8 UX: safe status, reload, test, clear, aggregate notifications.
1084 +- V9 performance/failure: precompile, cap, depth bound, cycle safety, fail-open warnings.