permission replay debugger
Why this matters
When third-party scripts, embedded widgets, or browser extensions try to access camera, microphone, location, or USB APIs, standard JavaScript errors do not separate a user denial from an HTTP policy block or link the violation back to the script step that triggered it. Turning live permission checks and violation reports into a replayable audit log makes least-privilege gaps inspectable before shipping.
What this opens up
Developers can record, export, and re-import browser permission traces as plain .jsonl files, diff Enforcing vs. Report-Only Permissions-Policy rules offline before rolling out stricter headers, and measure silent browser denials that block a call without emitting a ReportingObserver event.
How the tests work
- Click Scan 6 Browser Permissions to query
camera,microphone,geolocation,notifications,clipboard-read, andpersistent-storagevianavigator.permissions.query()without triggering user popups. - Click Run 4 Blocked Probes in Iframe to dispatch camera, microphone, geolocation, and WebUSB attempts inside
/probe/restricted-policyand correlate capturedReportingObserverviolations against silent reporting gaps. - Click Save & Verify OPFS Audit File to persist
perm-journal.jsonlto the browser’s Origin Private File System, read it back, and check the line-by-line disk diff. - Edit the Editable Policy Matrix (or import a saved
.jsonltrace) and click Compare Enforcing vs. Report-Only or Replay Stored Trace Against Policy to see which recorded steps flip between allowed and blocked.
Hypothesis
Correlating
navigator.permissions.query(), Enforcing vs. Report-Only HTTPPermissions-Policyframe blocks, andReportingObserver/Reporting-Endpointsreports into a portable.jsonltrace makes unattended permission escalation and silent reporting gaps inspectable before deployment.
What confirms it: Restricted iframe probes emit captureable ReportingObserver and SQLite ReportCollector entries linked to initiating step IDs, Enforcing vs. Report-Only replay diffs isolate policy flips cleanly, and exported .jsonl traces re-import deterministically.
What bounds or disproves it: Silent browser permission denials or uninstrumented third-party frames block calls while emitting zero ReportingObserver records, leaving blind spots measured under Reporting Gaps.
Under the hood
Permission Replay Debugger (source on GitHub) combines live iframe header enforcement with offline trace replay:
- Live probe frame & delegation toggles (
/probe/restricted-policy): the Worker serves configurablePermissions-PolicyandPermissions-Policy-Report-Onlyheaders plus a per-runReporting-Endpointssink. Inside the page, you can togglesandbox="allow-scripts"(opaque"null"origin) and the parent<iframe allow>attribute to inspect how host delegation interacts with child HTTP headers. - Cross-frame violation correlation & server collection: the probe frame registers a
ReportingObserver, serializes reports via.toJSON()before forwarding them overpostMessage, and matches each violation to its initiating step by directive, frame origin, and timestamp delta. Simultaneously, browser-deliveredapplication/reports+jsonbatches land in theReportCollectorSQLite Durable Object. - Deterministic replay & OPFS
.jsonlpersistence:replayRun()re-evaluates recorded or imported.jsonlentries against any edited Enforcing or Report-Only policy matrix without re-triggering browser hardware prompts, while OPFS writes and diffsperm-journal.jsonllocally.
Key terms & further reading
- HTTP Permissions-Policy ↗
- An HTTP response header that allows or blocks sensitive browser APIs (camera, microphone, geolocation, USB) per document or iframe before scripts execute.
- Reporting-Endpoints ↗
- An HTTP header instructing the browser to POST structured violation batches (
application/reports+json) asynchronously to a server collector. - ReportingObserver ↗
- A client-side JavaScript observer that receives policy violation reports in real time so an app can match blocked calls to the step that caused them.
- Permissions API ↗
- Provides
navigator.permissions.query()to read whether a capability isgranted,denied, orpromptwithout showing a permission dialog. - Origin Private File System (OPFS) ↗
- Private, origin-scoped local file storage in the browser, used here to store, diff, and export newline-delimited JSON (
.jsonl) audit traces. - Cloudflare Durable Objects (ReportCollector) ↗
- A per-session SQLite-backed edge endpoint collecting asynchronous browser violation reports at
/api/report/:runId.
Open questions
- Which APIs omit
ReportingObserverreports when blocked byPermissions-Policy(clipboard-read,geolocation, USB/serial prompts)? - Can
PerformanceObserverevent timing and console instrumentation link permission requests back to specific script URLs?
Iteration log
- — Built Permissions API scanner,
/probe/restricted-policyiframe test, OPFS JSONL journal, and developer code blueprint. - — Reordered page around live permission replay and silent-denial gap telemetry, added pure-DOM syntax highlighting, hardened 700px responsive layout, and enforced no-cache headers on static assets.
- — Moved into Track 4 (
delegated-authority), added.jsonltrace import alongside OPFS export, added Enforcing vs. Report-OnlyPermissions-Policyreplay diffing, backed reporting endpoints with a SQLiteReportCollectorDurable Object, and shipped dark mode,?embed=1height bridging, and@containerdiagrams.
Primitives tested: Permissions API, Permissions-Policy (Enforcing & Report-Only), OPFS JSONL Journal, ReportingObserver, Durable Object SQLite (ReportCollector).
This is an active lab under /labs/ and stays off the main RSS feed until graduated into a full essay.