Skip to content

feat(fiddler): inspect native SAZ captures - #2409

Merged
N0zoM1z0 merged 6 commits into
morluto:mainfrom
zahhak:docs/fiddler-web-debugging
Oct 13, 2026
Merged

N0zoM1z0 merged 6 commits into
morluto:mainfrom
zahhak:docs/fiddler-web-debugging

Conversation

@zahhak

@zahhak zahhak commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

REA can now inspect recorded SAZ archives directly through the existing historical-capture CLI/MCP workflow, preserving archive coordinates, HTTP fields, stored bytes and Session XML. The admitted profile is the documented raw HTTP/XML layout; producer product/version attribution remains unverified. This is offline analysis of caller-selected files.

The follow-up also adds opt-in detail: "summary" and retained preview/complete record pages. Complete selected Evidence is retained once, and subsequent pages work after the source is removed without launching another decoder. Existing complete replies remain available.

Correctness fixes include the earliest HTTP header/body separator, format-aware XML DTD rejection that permits declaration text inside CDATA/comments, and fail-closed SAZ admission when the runtime cannot enforce a decoder memory bound. UTF-8 validation avoids a redundant full-body copy. ZIP integrity and unsupported-layout checks remain enforced.

Validation on final head 92884580bccecd6cc75c32dfff2859638b5cdbfc:

  • Typecheck/lint passed. Related compiled CLI/MCP/domain tests passed: 24 tests plus one expected runtime skip; all three Android summary tests passed after reconciling the shared registry with current main.
  • Three pinned public recorded archives (Mattermost 3.7.0, Mattermost 10.6.1 and Clearinet Encodings) matched an independent Python ZIP/HTTP/XML oracle: 356 sessions, 713 byte fields and 356 XML roots. Built CLI/stdio MCP parity, SDK-converted schemas, retained pages and unchanged input hashes passed again on the final head.
  • A non-seekable deflater archive with data descriptors, flag 8 and zero local-header sizes passed the public CLI. The ZIP reader uses central-directory sizes.
  • Full check, generated documentation, test discovery, duplication gate and website checks passed during the follow-up. Final CI remains the merge gate.

Performance: three isolated alternating pairs on the same main compared reading the same first ten record descriptors in two pages. Summary plus retained previews reduced task-call/response text from 217,939 to 7,065 estimated o200k tokens; including the full advertised input catalog, 348,610 to 138,083. Median task wall time was 16.764 s to 12.784 s; sampled process-family peak 942.89 to 906.90 MiB. These are bounded local workflow measurements on the pinned comparison heads, not agent billing or a general speed claim. All heavy local verification used two CPU cores and an 8 GiB process-family guard; no OOM or guard stop occurred.

Scope decision: maintainers accept this bounded historical raw HTTP/XML capability. Live capture/replay, automatic network activity, undocumented layouts and bypassing protection are outside this change. Current Fiddler Everywhere GUI export and actual Bun/macOS/Windows producer workflows remain unverified; no broader support is claimed.

Original implementation by @zahhak; follow-up review, corrections and real-data verification by @N0zoM1z0. Captures and private verification artifacts are not committed.

Read Fiddler Everywhere SAZ sessions directly through the existing CLI/MCP
capture workflow. Retain HTTP fields, stored body bytes, XML metadata and
archive coordinates with credential exclusions and bounded offline decoding.
Share the Node decoder lifecycle with HAR and expose SAZ in the contracts
and provider catalog.

Add concise Fiddler Everywhere capture, MCP and public-skill guidance across
the documentation and website. Preserve REA's existing skill description.

Validation: 135 focused tests passed (3 platform skips), including public
CLI/MCP parity, malformed archives, redaction and HAR memory exhaustion.
Static checks, documentation checks/build, test discovery and all 18
translation catalogs passed. SAZ coverage uses synthetic documented-layout
fixtures; real Everywhere exports and its live MCP server remain unverified.
The full website build is blocked by the host's missing native Cairo library.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@matbrgz

matbrgz commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Technical Review & Findings

1. Rejection of Compressed or Unsized Members in Valid SAZ Archives (SazCapture.ts)

In decodeSazCapture (src/browser/history/SazCapture.ts):

if (length > (entry.declaredSize ?? 0))
  throw new CaptureFormatError(
    "format",
    "SAZ member exceeds its declared size.",
  );
chunks.push(chunk);
}
if (length !== entry.declaredSize)
  throw new CaptureFormatError(
    "format",
    "SAZ member does not match its declared size.",
  );

In standard ZIP archives created with data descriptors (streaming deflater or streaming zip creation commonly emitted by proxies like Fiddler Everywhere during live export), entry.declaredSize (uncompressed size in local file header) can be 0, null, or unknown until the data descriptor trailer is read. Furthermore, entry.declaredSize ?? 0 means that if declaredSize is null or 0, any incoming chunk causes length > 0, throwing CaptureFormatError: SAZ member exceeds its declared size..
Instead of failing when entry.declaredSize is null or zero-initialized from streaming local headers, the size check should only enforce bounds if declaredSize !== null && declaredSize > 0, and rely on the aggregate input bytes limit (WEB_NETWORK_CAPTURE_LIMITS.inputBytes) to defend against zip bombs.

2. False Failure on Session Ordering and File Suffixes (SazCapture.ts)

In decodeSazCapture:

const match = /^raw\/(\d+)_(c\.txt|s\.txt|m\.xml|w\.txt|g\.txt)$/.exec(
  entry.path,
);

Fiddler / Fiddler Everywhere session folders occasionally contain supplementary files such as raw/<id>_m.json (newer Fiddler Everywhere metadata formats), raw/<id>_wh.txt (WebSocket handshake headers), or subfolders. When any member starts with raw/ and does not match the strict regex:

} else if (entry.path.startsWith("raw/")) {
  throw new CaptureFormatError(
    "unsupported",
    "SAZ contains an unrecognized raw session member.",
  );
}

Throwing an unsupported CaptureFormatError causes an entire valid SAZ capture from newer Fiddler Everywhere versions to fail immediately instead of ignoring auxiliary raw artifacts or recording them as unrecognized members with a limitation disclaimer.

3. Premature Start-Line Rejection on Valid HTTP Reason Phrases (SazHttp.ts)

In decodeSazHttp (src/browser/history/SazHttp.ts):

const fields = request
  ? /^(\S+) +(\S+) +(HTTP\/\d+(?:\.\d+)?)$/.exec(first)
  : /^(HTTP\/\d+(?:\.\d+)?) +(\d{3})(?: (.*))?$/.exec(first);

For responses, HTTP/0.9 or HTTP/2/3 pseudo-header representations captured by modern Fiddler sessions often omit the HTTP version on the first line or start with :status 200. In addition, if a response status line has trailing whitespace after status code (e.g. HTTP/1.1 200 \r\n), (?: (.*))? captures an empty string, but if there are multiple spaces between status code and reason phrase (e.g. HTTP/1.1 200 OK), \d{3} matches, but if the status line contains non-ASCII characters in custom reason phrases (valid in Latin-1 HTTP/1.1), .* matches, but regex execution may fail if any carriage return \r remains unstripped before boundary splitting.

@N0zoM1z0

Copy link
Copy Markdown
Collaborator

Thanks for the SAZ work — I've taken this through a follow-up review and pushed fixes to this branch.

The integration scope is the bounded, offline raw HTTP/XML SAZ layout, using explicitly selected local files and owned decoder processes. It includes retained Evidence summaries and record pages. It does not add live proxy capture/replay, a Fiddler MCP wrapper, or software installation. Current Fiddler Everywhere UI exports and exporter versions remain unverified; the guide now states that limit and does not claim a tested product/version matrix.

The follow-up fixes LF-header/body separation and XML declaration text inside CDATA, preserves actual DTD rejection, avoids a full-body UTF-8 roundtrip allocation, and refuses SAZ decoding on runtimes without an enforceable memory bound. Existing complete delivery remains available; opt-in summary and preview/complete pages reuse the historical parent without decoding again.

Verification so far: independent Python ZIP/XML/byte checks against three public recorded corpora (356 sessions, 713 exact body/message fields), real CLI/stdio SDK parity and schema validation, source preservation, source-deletion/retained-page behavior, malformed input and capacity checks. 64 focused checks passed with one expected unsupported-runtime skip; check/docs passed, duplication is 2.98%, and test discovery passed. After syncing current main, the targeted checks are running again. The website translation conflict was merged by gettext identity while retaining both sides' translations and reviewer comments.

A completed two-page inspection task has identical ten-record facts. Counting the complete advertised input catalog, every request and MCP text result gives an o200k estimate of 348,610 → 138,083 tokens. This is a static estimate, not live agent billing; task-prompt/reasoning costs are unmeasured. I'm doing an isolated timing comparison and watching the CI on the final head before merging.

@N0zoM1z0 N0zoM1z0 self-assigned this Oct 13, 2026
@N0zoM1z0

Copy link
Copy Markdown
Collaborator

Thanks for checking these cases. I traced the size value to the producer: ZipArtifactReader.entries() enumerates zip.js directory entries, and projectZipEntry() uses entry.uncompressedSize. It is not the zero size in a streaming local header. I also tested a deflated, non-seekable ZIP with data-descriptor flag 8 and a zero local-header size: the actual CLI accepted it and retained the body bytes correctly. Keeping the observed-directory size/integrity checks is appropriate here.

The admitted raw member list follows Telerik's documented SAZ layout. The _m.json / _wh.txt layouts in the comment are not established by the current reference or our real corpora. They remain explicitly unsupported so we don't silently omit potentially essential session data. An original export demonstrating another layout would be useful for a separately verified profile.

The current response pattern accepts empty/trailing-space reason phrases, multiple spaces, and Latin-1 reason text. The streaming-ZIP probe also retained HTTP/1.1 200 OK as the exact reason OK. Versionless / pseudo-header-only serialized messages are outside the admitted profile; I won't infer their protocol or status semantics without an actual exporter specimen.

The isolated same-main timing comparison is now complete (three alternating pairs, fresh MCP sessions, warm filesystem caches). Both tasks returned identical first-ten-record facts: median wall time 16.76s → 12.78s; median CPU 19.20s → 15.00s; sampled peak process-family RSS 942.89 → 906.90 MiB. The final input-catalog + request + MCP-text token estimates remain 348,610 → 138,083 in o200k. Cold disk, live model reasoning and billing were not measured.

@N0zoM1z0
N0zoM1z0 merged commit a2d8b94 into morluto:main Oct 13, 2026
39 checks passed
@morluto morluto mentioned this pull request Oct 13, 2026
3 tasks done
@morluto morluto added enhancement New feature or request area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior labels Oct 14, 2026
@morluto morluto added area: runtime Process capture and runtime observation provider: fiddler Analysis provider / engine: fiddler labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior area: runtime Process capture and runtime observation enhancement New feature or request provider: fiddler Analysis provider / engine: fiddler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants