refactor(domain): redact declared sensitive values and transport credentials through one owner (#11327)

* refactor(domain): redact declared sensitive values and transport credentials through one owner

src/domain/explicitSensitiveValues.ts becomes the single owner of how a
declared value (a caller's explicit sensitive value or a REA-minted
transport credential) is found and replaced:

- redactExplicitText gains a preferred replacement marker (still refused
  when it would spell a declaration) and budget cut-off handling, and
  redactExplicitOutput applies cut-off from a stream's observed/retained
  bytes.
- explicitValuesOccurIn and explicitUtf8Spellings replace CaptureRedaction's
  private literal checks; empty declarations no longer match.
- TRANSPORT_CREDENTIAL_HEADERS / isTransportCredentialHeader replace three
  copies of the RFC 9110/6265 header table (capture, Playwright network,
  IDA registration). IDA now also treats Set-Cookie as an authentication
  header.

Migrated: process/ProviderDiagnosticRedaction.ts (deleted; Ghidra client,
diagnostics and launcher, Hopper launcher outcome), AgentEnvComputer's
control-token replaceAll, CaptureRedaction, QLOG, Playwright network
content, IDA registration and diagnostic redactor header checks.

* fix(ida): redact a configured Set-Cookie value without its attributes

* refactor(domain): spell and match declared values through the redaction owner (#11370)

* refactor(domain): spell and match declared values through the redaction owner

* fix(domain): yield declared-value spans lazily so budgeted callers stop early
This commit is contained in:
morluto authored and GitHub committed 2026-11-16 03:17:39 +08:00
1 parent 17e7c26087
commit a97a5b823d
18 files changed
+544 -273

No files matched your search

+4 -8
View File
@@ -7,7 +7,7 @@ import {
ProviderProcessSupervisor,
type ProcessDiagnosticBudget,
} from "./ProviderProcess.js";
import { redactCapturedTransportCredential } from "./ProviderDiagnosticRedaction.js";
import { redactExplicitOutput } from "../domain/explicitSensitiveValues.js";
it("retains final stderr between verified exit and output close during stop", async () => {
const producer = Object.assign(new EventEmitter(), {
@@ -544,13 +544,9 @@ it.each(["stdout", "stderr"] as const)(
observedBytes: Buffer.byteLength(token),
text: token.slice(0, 8),
});
expect(
redactCapturedTransportCredential(
scoped.snapshot[stream],
token,
"[REDACTED]",
),
).toBe("[REDACTED]");
expect(redactExplicitOutput(scoped.snapshot[stream], [token])).toBe(
"[REDACTED]",
);
} finally {
supervisor.dispose();
producer.stdout.destroy();