# permission replay debugger

- Status: `experiment`
- Track: [browser containment & sandbox boundaries](https://aifoc.us/labs/browser-containment/)
- Layer: 3. Identity, Permissions & Delegated Authority
- Updated: 1 December 2026
- Live demo: https://permission-replay-debugger.kinlan-test.workers.dev
- Source: https://github.com/PaulKinlan/permission-replay-debugger

## Inspired by

- [my chrome extensions are just prompts](https://aifoc.us/my-chrome-extensions-are-just-prompts/)
- [agent-do: my agent loop](https://aifoc.us/agent-do-my-agent-loop/)

## Hypothesis

- **Claim:** Recording `navigator.permissions.query()`, `Permissions-Policy` frame blocks, and `ReportingObserver` violations into a structured JSONL trace makes unattended permission escalation inspectable before shipping.
- **Confirms it:** Restricted sandbox iframes trigger captureable `ReportingObserver` entries and match `Permissions.query()` state deltas cleanly inside the OPFS replay log.
- **Falsifies or bounds it:** Silent browser permission denials or asynchronous third-party iframe requests leave gaps where no `ReportingObserver` record correlates the initiating call stack.

> **Why this exists:** When third-party scripts, widgets, or browser extensions run unattended inside a session and attempt to access camera, microphone, location, or clipboard APIs, developers rarely have an audit trail showing *which* script step triggered the check and whether HTTP policies actually blocked it. Correlating permission checks and policy violations into an exportable JSONL timeline makes least-privilege gaps inspectable before shipping.


## What this lab tests

[Permission Replay Debugger](https://permission-replay-debugger.kinlan-test.workers.dev) ([GitHub](https://github.com/PaulKinlan/permission-replay-debugger)) audits live [`navigator.permissions.query()`](https://developer.mozilla.org/en-US/docs/Web/API/Permissions_API) states, exercises a strict HTTP [`Permissions-Policy`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy) iframe (`/probe/restricted-policy`), and correlates `ReportingObserver` violations into an exportable OPFS JSONL replay journal.


## Open questions to iterate on

- 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

- **2026-12-01:** Built Permissions API scanner, `/probe/restricted-policy` iframe test, OPFS JSONL journal, and developer code blueprint.
- **2026-12-01:** 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.

## Primitives tested

- `Permissions API`
- `Permissions-Policy`
- `OPFS Journal`
- `ReportingObserver`

## Connected labs in other tracks

- [self-observing web fault bundler](https://aifoc.us/labs/platform-observability/self-observing-web/) — Captures broader LoAF, CLS, and fetch regressions into JSON replay bundles.

---
Canonical: https://aifoc.us/labs/browser-containment/permission-replay-debugger/
