Skip to content

fix(browser): fingerprint cookies at the selected page URL - #763

Merged
N0zoM1z0 merged 1 commit into
morluto:mainfrom
rudycelekli:fix/rea-current-page-cookie-fingerprints-20261006
Oct 7, 2026
Merged

N0zoM1z0 merged 1 commit into
morluto:mainfrom
rudycelekli:fix/rea-current-page-cookie-fingerprints-20261006

Conversation

@rudycelekli

Copy link
Copy Markdown

Summary

Include path-specific cookies in explicitly requested storage fingerprints for the selected page. This is a self-contained correctness fix; no separate issue is linked.

Problem and expected behavior

On a page at /app, a cookie with Path=/app is available to the page. Capture previously requested Network.getCookies with the origin URL, whose path is /, so it omitted that cookie while reporting complete fingerprints. Changing the omitted cookie could leave the observed storage fingerprints identical.

Change and scope

Pass the authorized attached main-frame URL to the cookie query. Derive the same origin for DOM storage, IndexedDB, cache names and quota. Document that cookie coverage means the current page URL, including its path, rather than every cookie path on the origin.

Contract and boundary impact

  • Semantic owner and earliest changed stage: browser storage capture, at the CDP cookie URL selection.
  • CLI and MCP/tool-catalog contract: unchanged schemas and tool names; requested storage fingerprints now include current-page cookies.
  • Provider, bridge, target-format, or platform compatibility: CDP browser capture; real Chrome tested on macOS arm64.
  • Evidence, artifact, provenance, or reconstruction contract: cookie identity/value hashes remain value-redacted; current-page scope is explicit in limitations.
  • Process execution, authorization, cleanup, or containment impact: the URL is the already-authorized main frame; other storage retains origin scope. No browser-wide cookie enumeration or new process ownership.
  • Generated metadata (docs/product-catalog.json), package, or installation impact: none.

Evidence and regression coverage

  • Tests added or updated: boundary test checks full attached cookie URL and unchanged DOM-storage origin; real browser verifier installs root and /app cookies and requires both fingerprints.
  • Base reproduction or other evidence: executed public CdpBrowserProvider.inspectPage against owned loopback HTTP and actual Chrome. Base 91daaa6 captures only the root cookie (1 vs expected 2), despite fingerprints_complete: true. The fix captures both; changing the actual /app cookie from alpha to beta changes its fingerprint.
  • User-visible CLI/MCP output: storage content_fingerprints gains the missing cookie hash; raw cookie values remain absent.
  • Remaining proof gaps: no other browser or OS matrix tested locally. Cookies at unrelated paths are outside the documented current-page scope. The native verifier's process-lineage metadata was unavailable because a descendant run token did not match; its browser checks completed successfully.

For evidence-bearing changes:

  • 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

  • Native public capture fixture — fails on base (root only), passes after fix (root plus /app, changed scoped-cookie hash).
  • npm run test:focused -- tests/boundary/browser/cdpBrowserProvider.sensitive_data.test.ts — 6 passed.
  • npm run check — 5 tasks successful; 124 existing lint warnings, zero errors.
  • npm run check:fast — 2 tasks successful.
  • npm run docs:check — 2 tasks successful.
  • npm run verify:browser — verified with Chrome 154.0.8037.94 and locked Playwright-core 1.58.2, including actual CLI/stdio MCP scenarios, source maps, screenshots, popup events and owned/external cleanup controls.
  • git diff --check — passed. Node 24.18.0 and reused exact dependency versions; no dependency source changes.

Full deterministic coverage remains with hosted CI; its results are tracked separately.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: actual macOS Chrome only; unrelated binary providers not exercised.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: origin authorization remains unchanged; fingerprints remain hashes of explicitly requested cookie data, never raw values. Owned loopback/profile fixtures only, with cleanup; no personal browser profile or browser download.

AI assistance: implemented and source reviewed with Codex on behalf of @rudycelekli before publication.

Review checklist

  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

@morluto

morluto commented Oct 6, 2026

Copy link
Copy Markdown
Owner

Reviewed: passing the authorized attached main-frame URL (not bare origin) to Network.getCookies is correct CDP semantics — path-scoped cookies (Path=/app) were silently omitted while fingerprints_complete:true. Origin derivation for other storage + hash-only fingerprints + limitations/docs update keep observed-vs-complete distinct with no auth expansion. Boundary test asserts exact CDP params; real-verifier requires 2 cookie fingerprints. APPROVE. Non-blocking: new URL(pageUrl).origin throws bare TypeError on empty attachedUrl even when frame origin was available — consider computing origin in CdpPageCapture with the existing frames[0]?.origin fallback or guarding with a typed BrowserObservationError.

@morluto

morluto commented Oct 6, 2026

Copy link
Copy Markdown
Owner

Review — APPROVE (one defensive-code note)

Summary

Passes the authorized attached main-frame URL (not the bare origin) to Network.getCookies, so path-scoped cookies (e.g. Path=/app) are included in explicitly-requested storage fingerprints. DOM storage / IndexedDB / caches stay origin-scoped.

Verification

  • Core fix is right: CDP Network.getCookies { urls: [origin] } only returns cookies applicable to /, so /app cookies were silently omitted while fingerprints_complete: true. Passing the full page URL is the documented CDP semantic.
  • Origin derivation via new URL(pageUrl).origin preserves all other storage scoping; added limitations entry plus docs/browser-observation.md update keeps observed-vs-complete distinguishable.
  • Fingerprints stay hash-only; no auth-scope expansion (already-authorized main-frame URL).
  • Boundary test asserts the exact CDP params (cookie URL keeps path+query, DOM storage keeps origin); real-verifier requires exactly 2 cookie fingerprints (root + /app).
  • CI: all 20 checks SUCCESS, including real-browser.

Note (non-blocking)

  • src/browser/CdpCaptureStorage.ts (new const origin = new URL(pageUrl).origin): pageUrl derives from mainFrameUrl(frameResult) ?? "". On main, frames[0]?.origin ?? new URL(attachedUrl).origin only parsed the URL when the frame origin was missing; after this change an empty attachedUrl throws a bare TypeError out of captureStorage even when a frame origin was available, bypassing the typed BrowserObservationError contract. Narrow (requires frames non-empty with a URL-less frame tree), but consider computing the origin in CdpPageCapture.ts with the existing frames[0]?.origin fallback and passing { pageUrl, origin }, or guarding new URL with a malformed-input error.

@rudycelekli

rudycelekli commented Oct 6, 2026 •

Copy link
Copy Markdown
Author

I checked this against the complete capture path and actual Chrome 154. captureAuthorizedPage obtains its frame result from authorizedMainFrame, which only returns when the root URL passes allowedSanitizedUrl for an approved HTTP(S) origin. Both attachedUrl and captureFrames read that same result; a missing/empty root URL therefore does not reach storage capture, even if an allowed child frame could exist.

For the native control, an owned loopback /app page captures both root and path cookies. Navigating that real selected page to about:blank immediately before passive-domain capture returns typed BrowserObservationError(target_not_allowed); Chrome's frame result contains url: about:blank, and no raw TypeError escapes. The relevant ten boundary/document tests also pass. I kept the current main-frame authorization and full-page cookie URL rather than introducing a bare-origin fallback that would omit path cookies again. No production change was needed for this path. Checked with Codex assistance on behalf of @rudycelekli.

Comment thread src/browser/CdpCaptureStorage.ts Resolved

@N0zoM1z0 N0zoM1z0 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed head573ee9fd96ff3219e8f6879cededb461b36c99a5. The authorized main-frame URL reaches Network.getCookies unchanged, preserving path-specific cookies; DOM storage/IndexedDB/quota retain origin scope. The documented cookie coverage matches the query. Existing authorization rejects invalid main-frame URLs before publication; the prior inline concern does not describe a reachable regression. Local production build and all6 sensitive-data boundary tests passed. All20 hosted checks passed, including the real-browser fixture that independently requires both root and /app cookie fingerprints. No blocking findings; approved for merge.

@N0zoM1z0
N0zoM1z0 merged commit 78014e3 into morluto:main Oct 7, 2026
20 checks passed
@morluto

morluto commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Thanks, @rudycelekli, for your work on “fix(browser): fingerprint cookies at the selected page URL.” I appreciate your contribution to REA.

darsrc pushed a commit to darsrc/rea that referenced this pull request Oct 10, 2026
@morluto morluto added the bug Something isn't working label Oct 14, 2026
@morluto morluto added the area: runtime Process capture and runtime observation label Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: runtime Process capture and runtime observation bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants