feat(browser): inspect historical web network captures (#992)

* feat(browser): inspect retained HAR and mitmproxy capture evidence

Add independent offline format adapters, inline CLI/MCP evidence, bounded
owned decoder processes, and real producer verification.

Refs #882

Assisted-by: Yukari (gensokyo-skills:yukari-boundary-analysis)
Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing)

* fix(browser): preserve capture boundaries during cancellation and decoding

Honor cancellation during owned-command cleanup, retain opaque HAR
extension content, and clean verifier resources on every failure path.

Refs #882

Assisted-by: Yukari (gensokyo-skills:yukari-boundary-analysis)
Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing)

* fix(browser): exclude sensitive capture fields across representations

Normalize known native transport URLs for both bytes and strings, including backups. Exclude explicitly sensitive text fields with null so redaction markers cannot reintroduce declared literals. Cover both provider identities in catalog conformance.

Refs #882

Assisted-by: Yukari (gensokyo-skills:yukari-boundary-analysis)
Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing)

* fix(browser): exclude sensitive capture identities and bound diagnostics

* fix(browser): validate excluded HAR subtrees before projection

* fix(browser): distinguish capture input limits from decoder failures

* fix(browser): preserve decoder failure categories

* fix(browser): validate excluded native credential values

* test(browser): report capture verifier assertions directly

* fix(browser): classify native representation failures precisely

* fix(browser): exclude URL userinfo after header whitespace

* fix(browser): preserve capture evidence and failure boundaries

* fix(browser): exclude sensitive literals from capture limitations

* test(browser): check limitation values without JSON syntax

* fix(browser): preserve acquisition integrity and exclude selection diagnostics

* fix(browser): preserve capture acquisition and declaration boundaries

* fix(mcp): project sensitive capture argument validation

* fix: preserve capture bytes and prelaunch cancellation

* fix(browser): exclude sensitive HAR record ancestry

* fix(browser): preserve transport URL and parameter exclusions

* fix(browser): preserve numeric redaction and canonical capture provenance

* fix(browser): cover derived capture values and ownership preparation deadlines

* fix(browser): exclude explicitly sensitive artifact digests

* chore: regenerate generated metadata

* fix(browser): reject lossy HAR member normalization

* test(browser): assert the advertised unsupported-profile outcome

* fix(browser): preserve JSON visitor nesting failure locations

* fix(browser): exclude explicitly sensitive native source ranges

---------

Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Ysopwnable
2026-10-08 07:53:41 +08:00
committed by GitHub
co-authored by Kaoru0822 github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
parent 6e4535c101
commit 2bf3663f65
77 changed files with 6315 additions and 47 deletions
+21 -5
View File
@@ -364,15 +364,30 @@ const filesystemFailure = (cause: unknown): string | undefined => {
return `Executable file observation failed: ${cause.message}`;
};
/** Sample the caller-selected executable contents and stable file identity before launch. */
/** Metadata IO seam for deterministic prelaunch cancellation and identity checks. */
export interface SelectedExecutableFileSystem {
open(path: string, flags: number): ReturnType<typeof open>;
stat(path: string): Promise<BigIntStats>;
}
const selectedExecutableFileSystem: SelectedExecutableFileSystem = {
open,
stat: (path) => stat(path, { bigint: true }),
};
/** Sample the selected file without launching it; retain cancellation and file identity. */
export const observeSelectedExecutable = async (
path: string,
signal?: AbortSignal,
fileSystem: SelectedExecutableFileSystem = selectedExecutableFileSystem,
): Promise<SelectedExecutableObservation> => {
assertNotCancelled(signal);
let handle: Awaited<ReturnType<typeof open>> | undefined;
try {
handle = await open(path, constants.O_RDONLY | constants.O_NONBLOCK);
handle = await fileSystem.open(
path,
constants.O_RDONLY | constants.O_NONBLOCK,
);
const openedStats = await handle.stat({ bigint: true });
if (!openedStats.isFile())
return {
@@ -381,9 +396,7 @@ export const observeSelectedExecutable = async (
reason: "Selected executable is not a regular file.",
};
const openedIdentity = identityFromStats(openedStats);
const selectedPathIdentity = identityFromStats(
await stat(path, { bigint: true }),
);
const selectedPathIdentity = identityFromStats(await fileSystem.stat(path));
if (!sameExecutableIdentity(openedIdentity, selectedPathIdentity))
return {
sha256: null,
@@ -391,6 +404,9 @@ export const observeSelectedExecutable = async (
reason: "Selected executable path changed while it was being opened.",
};
// IO above can settle after cancellation. Do not construct a stream with an
// already-aborted signal: Node can emit a second, unhandled AbortError.
assertNotCancelled(signal);
const hash = createHash("sha256");
for await (const chunk of handle.createReadStream({
autoClose: false,