Repository navigation
fix(browser): exclude sensitive binary lengths from historical captures - #2477
Merged
morluto merged 1 commit intoOct 13, 2026
Merged
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
16 of 19 tasks
Owner
|
@greptileai review |
Contributor
|
3 tasks done
4 of 5 tasks
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Honor explicit sensitive-value exclusions for derived binary byte counts in historical HAR and mitmproxy captures. Both producers now apply the same count exclusion already used by SAZ.
Problem and expected behavior
When an excluded literal matches only a decoded body's decimal byte count, the historical HAR and mitmproxy projections retain that count and its binary field. For example, a synthetic 12,345-byte body with
sensitive_values: ["12345"]still producesstate: "retained", bytes: 12345. The input contract explicitly excludes literals from byte/numeric projections. Substring declarations, such as"2345", must also apply.The corrected field is
state: "redacted"withbytes,content_base64, andsha256allnull, and the corresponding body display is omitted. Unmarked content remains retained; HAR producer-reportedcontent.sizeremains an independent source fact.No related public issue was opened; this is a focused correction using synthetic capture data. Before submission, I searched all 1,609 historical PRs, including 207 open PRs, and checked three additional newly opened PRs immediately before submission. I also inspected relevant file diffs: #992 introduced the two affected producers; #2409 already implements count exclusion for SAZ; #2046 concerns session HAR. None implements this correction in the two affected producers.
Change and scope
Check the generated decimal byte count at the two producing boundaries, alongside the existing raw-byte, base64, and digest checks. Reuse existing redacted-field representations and application consumers without adding another downstream filter or dependency.
This follows the contribution scope. Separate maintainer scope decision: not applicable (ordinary fix within an existing offline capture capability).
Contract and boundary impact
projectHarand mitmproxyproject_record, before binary sidecars are retained as Evidence.sensitive_valuessemantics; no new fields or operations. Public CLI and MCP results agree.bb154d106, including the new qlog capability. The subsequent main commits through 1724077 do not change any of the four touched files; a merge-tree check succeeds.explicit-sensitive-valueredaction and nullable binary sidecar; retained preview/complete views preserve the exclusion.Expected effects:
The effects above describe this change; the existing mitmproxy workflow still uses its owned decoder process.
Evidence and regression coverage
Tests added or updated: public CLI/MCP HAR regression with an unmarked control, exact and substring count exclusions, independent producer-size preservation, and retained preview/complete views. The existing real-mitmproxy fixture generator gains equivalent control and exclusion assertions.
Base reproduction: the new HAR regression fails on
a2d8b94ddbecause the body remains visible. Executing the unchanged production Python projection from that revision retainsbytes: 12345; executing the fixed projection redacts both declarations. These Python checks compile the production projection functions from their AST and do not substitute a decoder.Representative public output:
binary_fields: [{ pointer: "/response/content/text", representation: "har-base64-content", state: "redacted", bytes: null, content_base64: null, sha256: null }].Remaining proof gaps: the real mitmproxy 12.2.3/Linux verification lane has not run locally on this Windows host. The added generator assertions need that existing lane. Broader source tests are not all green on this host (details below).
Observed, derived, and inferred claims remain distinguishable.
Artifact identity, source provenance, and failed attempts remain preserved.
Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.
Validation performed
npm run test:focused -- tests/boundary/browser/historicalWebCapture.test.ts src/browser/history/HarCapture.test.ts src/application/WebNetworkCaptureService.test.ts tests/boundary/browser/sazWebCapture.test.ts— 92 passed, 1 skipped, after rebasing ontobb154d106.npm run test:focused -- src/browser/history/QlogCapture.test.ts tests/acceptance/tools/qlogCapture.test.ts— 24 passed, 1 skipped, on the rebased branch.npm run check— passed on the rebased branch (typecheck, lint/module boundaries, formatting, knip, metadata, architecture guards); lint reports 997 warnings, zero errors.npm run verify:test-discovery— passed on the initial base (1,008 test files discovered once).git diff --check origin/mainand the repository pre-commit/pre-push hooks — passed.npm audit --registry=https://registry.npmjs.org— zero reported advisories for the locked dependency inventory. The Windows native artifact used for broader tests was verified and came from upstream CI at the exact initial base SHA.Compatibility, safety, and release
Before merge
type(scope): outcome.