AI Focus

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

  1. Click Scan 6 Browser Permissions to query camera, microphone, geolocation, notifications, clipboard-read, and persistent-storage via navigator.permissions.query() without triggering user popups.
  2. Click Run 4 Blocked Probes in Iframe to dispatch camera, microphone, geolocation, and WebUSB attempts inside /probe/restricted-policy and correlate captured ReportingObserver violations against silent reporting gaps.
  3. Click Save & Verify OPFS Audit File to persist perm-journal.jsonl to the browser’s Origin Private File System, read it back, and check the line-by-line disk diff.
  4. Edit the Editable Policy Matrix (or import a saved .jsonl trace) and click Compare Enforcing vs. Report-Only or Replay Stored Trace Against Policy to see which recorded steps flip between allowed and blocked.
Audit live browser permission states without popups, test Enforcing vs. Report-Only Permissions-Policy iframes, capture server-side violation batches, and replay exported .jsonl traces offline. Open permission replay debugger full screen ↗

Hypothesis

Correlating navigator.permissions.query(), Enforcing vs. Report-Only HTTP Permissions-Policy frame blocks, and ReportingObserver / Reporting-Endpoints reports into a portable .jsonl trace 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 configurable Permissions-Policy and Permissions-Policy-Report-Only headers plus a per-run Reporting-Endpoints sink. Inside the page, you can toggle sandbox="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 over postMessage, and matches each violation to its initiating step by directive, frame origin, and timestamp delta. Simultaneously, browser-delivered application/reports+json batches land in the ReportCollector SQLite Durable Object.
  • Deterministic replay & OPFS .jsonl persistence: replayRun() re-evaluates recorded or imported .jsonl entries against any edited Enforcing or Report-Only policy matrix without re-triggering browser hardware prompts, while OPFS writes and diffs perm-journal.jsonl locally.

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 is granted, denied, or prompt without 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 ReportingObserver reports when blocked by Permissions-Policy (clipboard-read, geolocation, USB/serial prompts)?
  • Can PerformanceObserver event timing and console instrumentation link permission requests back to specific script URLs?

Iteration log

  • — Built Permissions API scanner, /probe/restricted-policy iframe 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 .jsonl trace import alongside OPFS export, added Enforcing vs. Report-Only Permissions-Policy replay diffing, backed reporting endpoints with a SQLite ReportCollector Durable Object, and shipped dark mode, ?embed=1 height bridging, and @container diagrams.

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.

More in delegated authority & keyless execution

Connected labs

← delegated authority & keyless execution · All labs