Files
reverse-engineering-anything/tests/boundary/browser
Abhishek SharmaandClaude Sonnet 5.5 3c7ea1ce85 feat(browser): count credential-named members in HAR capture inspection (#8708)
* feat(browser): count credential-named members in HAR capture inspection

inspect_web_network_capture now runs the credential-name scan that
environment-build already applies over the selected HAR records and
reports matches as limitations by pointer, never by value, together with
the bodies the scan could not read. Values the decoder already excluded
are not counted, and nothing is excluded on a name.

Refs #8207

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* fix(browser): bound the listed credential-name pointers

The limitation lists the pointers that fit within 1 KiB of text and says
how many counted names are not listed, so one long body member name
cannot inflate the limitation that summaries and record pages repeat.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* fix(environment): bound the credential scan's values before parsing a body

A body under the scan's 4 MiB text limit could still expand into millions
of JSON values or form fields when parsed in the application process, and
the inspection now runs the scan on every HAR capture. The scan counts the
characters that can start a value (`[`, `{`, `,` for JSON, `&` for forms)
before parsing and skips a body that could hold more than 524288, reporting
it like a body over the text limit. Both consumers' messages and docs name
the bound.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* fix(web): charge every body and name/value list to one credential-scan budget

The credential-name scan bounded each body's values on its own, so a
capture of many compact bodies still expanded millions of values in the
application process, and HAR header, query and form-parameter lists were
copied twice without any bound. One 524288-value budget now covers the
whole scan: a body's values are bounded from its text before it is parsed
and a list is charged by its length before it is read in place, so what
would pass the budget is reported as not scanned instead.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* fix(web): read credential names in place and charge nothing for empty text

The credential-name scan split each member, header and query name with
two regex replacements, a lowercase copy and a split into a segment
array before matching. A near-4 MiB alternating-case member name
(`x-aAaA…`) therefore expanded into about two million segments: more
than 192 MiB of heap in the application process after the decoder's
containment had ended. `credentialNamed` now reads the name once in
place with the same segmentation (case changes, digits, separators, and
`toLowerCase`'s KELVIN SIGN and dotted capital I), keeping at most two
segments no longer than the longest credential word, so a name of any
length allocates no copies.

`valueBound` started every text at one value, so an empty query, a bare
`?`, an empty form and whitespace-only JSON were each charged a value
they do not hold; once earlier content spent the budget, they were
reported as unscanned in `credential-scan-incomplete`. JSON now holds its
first value only after a non-whitespace character, and a form holds one
field per non-empty `&`-separated piece after an optional leading `?`,
as `URLSearchParams` and the query reader split it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(browser): point the environment build link at the physical guide

The guide lives at docs/agent-environments.md, so the relative link from
docs/guides/web must climb two levels. The Documentation job failed on the
dead link; vitepress build now completes.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* test: drop the hard-coded timeout from the heap-bound name test

The test finishes in about half a second, so the shared test deadline is
enough, and a literal 60_000 bypasses the CI and coverage deadline scaling.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* fix(web-network-capture): name an unavailable response source in the scan limitation

The credential-name scan counts a response body whose retained source is
unavailable as not scanned, and WebNetworkCaptureService reuses that scan. Its
limitation text still listed only a cut body, text over 4 MiB, or past the value
budget, so CLI and MCP reports gave none of those reasons for such a body.

Name the unavailable source in the text, matching the environment-build warning,
and cover it with a test that fails on the old wording.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-11-22 15:42:13 +08:00
..