Skip to content

Commit c8e7fb6

Browse files
ryanbas21claude
andcommitted
docs: add and update README files across all packages
- Root README: updated with full package table, architecture diagram, and references to both browser and VS Code extensions - devtools-core: new README documenting annotators, diagnosis, event store, and export modules - devtools-ui: new README documenting Elm views, ports, and build - vscode-extension: new README with quick start, commands, architecture - devtools-extension: updated architecture section to reference shared packages (devtools-core, devtools-ui) - devtools-bridge: updated to reference VS Code extension and CDP capture path - devtools-types: added FlowState/FlowExport/OidcSemantics to exports table and consumers section - e2e: new README documenting test suite and mock OIDC server Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 77fa255 commit c8e7fb6

8 files changed

Lines changed: 467 additions & 76 deletions

File tree

README.md

Lines changed: 140 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
**Captures, correlates, and diagnoses** OIDC/OAuth 2.0 authentication flows in real time — works standalone with any OIDC provider or as an enhanced companion to the Ping Identity SDK.
44

5-
A browser DevTools panel for Chrome and Firefox that replaces the Network-panel-and-jwt.io workflow with a single view: OIDC-annotated network traffic, SDK-level event correlation, inline JWT decoding, and an automated diagnosis engine that tells you what went wrong and how to fix it.
5+
Available as a **browser DevTools panel** (Chrome & Firefox) and a **VS Code extension** (via Chrome DevTools Protocol). Both share the same annotation engine, diagnosis rules, and Elm UI.
66

77
![Flow view with diagnosis banner and node rail](packages/devtools-extension/screenshots/Flow-Screen.png)
88

@@ -12,14 +12,19 @@ A browser DevTools panel for Chrome and Firefox that replaces the Network-panel-
1212

1313
| Package | Description | npm |
1414
| --- | --- | --- |
15-
| [`@wolfcola/devtools-extension`](packages/devtools-extension) | Browser extension (Chrome & Firefox) — DevTools panel with Timeline, Flow, and Learn views | private |
16-
| [`@wolfcola/devtools-bridge`](packages/devtools-bridge) | Opt-in SDK adapter — emits `AuthEvent`s from DaVinci, Journey, and OIDC clients | [![npm](https://img.shields.io/npm/v/@wolfcola/devtools-bridge)](https://www.npmjs.com/package/@wolfcola/devtools-bridge) |
17-
| [`@wolfcola/devtools-types`](packages/devtools-types) | Shared `AuthEvent` Effect Schema definitions and TypeScript types | [![npm](https://img.shields.io/npm/v/@wolfcola/devtools-types)](https://www.npmjs.com/package/@wolfcola/devtools-types) |
15+
| [`devtools-extension`](packages/devtools-extension) | Chrome & Firefox DevTools panel — Timeline, Flow, and Learn views | private |
16+
| [`vscode-extension`](packages/vscode-extension) | VS Code extension — debugs via Chrome DevTools Protocol | private |
17+
| [`devtools-core`](packages/devtools-core) | Shared logic — annotators, diagnosis engine, event store, export | private |
18+
| [`devtools-ui`](packages/devtools-ui) | Shared Elm UI — compiled JS, CSS, TypeScript port interface | private |
19+
| [`devtools-bridge`](packages/devtools-bridge) | SDK adapter — emits events from DaVinci, Journey, and OIDC clients | [![npm](https://img.shields.io/npm/v/@wolfcola/devtools-bridge)](https://www.npmjs.com/package/@wolfcola/devtools-bridge) |
20+
| [`devtools-types`](packages/devtools-types) | Effect Schema definitions for AuthEvent, FlowState | [![npm](https://img.shields.io/npm/v/@wolfcola/devtools-types)](https://www.npmjs.com/package/@wolfcola/devtools-types) |
1821

1922
---
2023

2124
## Quick start
2225

26+
### Browser extension
27+
2328
```bash
2429
pnpm install
2530
pnpm build # Chrome (default)
@@ -28,14 +33,30 @@ pnpm build:firefox # Firefox
2833

2934
Load the extension as unpacked from `packages/devtools-extension/dist/` — see the [extension README](packages/devtools-extension) for full instructions.
3035

36+
### VS Code extension
37+
38+
```bash
39+
pnpm install
40+
pnpm build
41+
```
42+
43+
Open the `packages/vscode-extension` folder in VS Code and press F5 to launch. Then:
44+
45+
1. Launch Chrome with `--remote-debugging-port=9222`
46+
2. Run **"OIDC DevTools: Start Capture"** from the command palette
47+
48+
See the [VS Code extension README](packages/vscode-extension) for details.
49+
3150
### Browser compatibility
3251

3352
| Browser | Minimum version |
3453
| --- | --- |
3554
| Chrome | 88+ (Manifest V3) |
3655
| Firefox | 128+ (`world: "MAIN"` content scripts) |
3756

38-
To wire up SDK-level events in your app:
57+
### SDK integration (optional)
58+
59+
The extension captures and annotates OIDC network traffic automatically. To also see SDK-level events, add the bridge:
3960

4061
```bash
4162
pnpm add @wolfcola/devtools-bridge
@@ -53,16 +74,127 @@ The bridge is a no-op when the extension is not installed.
5374

5475
---
5576

77+
## Architecture
78+
79+
```
80+
┌──────────────────────────────────────────────────────────┐
81+
│ Shared Packages │
82+
│ devtools-core: annotators, diagnosis, event store │
83+
│ devtools-ui: Elm UI (Timeline, Flow, Learn) │
84+
│ devtools-types: Effect Schema definitions │
85+
└─────────────────────┬────────────────────────────────────┘
86+
87+
┌───────────┴───────────┐
88+
▼ ▼
89+
┌──────────────────┐ ┌──────────────────┐
90+
│ Browser Extension│ │ VS Code Extension│
91+
│ Chrome / Firefox │ │ CDP → Chrome │
92+
│ │ │ │
93+
│ content scripts │ │ CDP client │
94+
│ service worker │ │ TreeView │
95+
│ Elm panel │ │ WebView (Elm) │
96+
└──────────────────┘ └──────────────────┘
97+
```
98+
99+
Both consumers import the same annotators, diagnosis engine, and Elm UI from the shared packages. The only difference is how events enter the system:
100+
101+
- **Browser extension**`chrome.devtools.network.onRequestFinished` + content script relay
102+
- **VS Code extension** → CDP `Network` domain + `Runtime.bindingCalled` for SDK events
103+
104+
---
105+
106+
## Network-first OIDC intelligence
107+
108+
The extension automatically detects and annotates OIDC/OAuth 2.0 traffic without any SDK integration. It works out of the box with **any OIDC provider** — Ping Identity, Auth0, Okta, Keycloak, or any spec-compliant authorization server.
109+
110+
**Well-known discovery** — parses `/.well-known/openid-configuration` responses and matches subsequent requests against discovered endpoints.
111+
112+
**OIDC semantic annotation:**
113+
114+
| Phase | Extracted data |
115+
| --- | --- |
116+
| **discovery** | Issuer, all discovered endpoints |
117+
| **authorize** | `client_id`, `state`, `nonce`, `code_challenge`, `response_type` |
118+
| **par** | `request_uri`, `expires_in`, pushed parameters |
119+
| **token** | `grant_type`, `code_verifier`, tokens received, `token_type` |
120+
| **userinfo** | User profile data |
121+
| **revocation** | Token revocation status |
122+
| **introspection** | Token validity |
123+
| **end-session** | Logout status |
124+
125+
**DPoP detection (RFC 9449)** — detects `DPoP` proof JWTs, `token_type: "DPoP"`, `use_dpop_nonce` errors, and `DPoP-Nonce` headers.
126+
127+
**PAR detection (RFC 9126)** — detects Pushed Authorization Requests and correlates `request_uri` values.
128+
129+
---
130+
131+
## Diagnosis
132+
133+
Every captured event is run through a rule engine that produces flow-level and per-event diagnostics with severity ratings and numbered remediation steps.
134+
135+
| Category | Examples |
136+
| --- | --- |
137+
| **CORS** | Status-zero failures, missing `Access-Control-Allow-Origin`, wildcard + credentials |
138+
| **Token** | Missing `interactionToken` on non-initial nodes, expired JWTs |
139+
| **Flow config** | Node error/failure status, connector errors, policy-not-found |
140+
| **OIDC** | State mismatch, missing PKCE, redirect URI mismatch |
141+
| **OIDC flow** | Auth code without PKCE, missing `code_verifier`, implicit flow, nonce, code reuse |
142+
| **DPoP** | Missing proof, invalid proof structure, method/URI mismatch |
143+
| **PAR** | Missing `request_uri`, inline params alongside `request_uri` |
144+
145+
---
146+
147+
## Panel views
148+
149+
### Timeline
150+
151+
Chronological event table with type badges (NET, SDK, SES, CFG), status codes, OIDC phase tags, and inline CORS/DPoP indicators. A graph sidebar draws SDK node-change events as a vertical rail. The Inspector panel shows contextual tabs (Headers, SDK State, Collectors, OIDC, Diagnosis, etc.).
152+
153+
### Flow
154+
155+
Visual representation of the authentication flow as a sequence of SDK nodes. Includes a node rail, detail cards, playback controls, and a Flow Health banner for diagnosis.
156+
157+
### Learn
158+
159+
Canvas-based flow lifecycle visualization with layout variants for DaVinci, Journey, OIDC Code, OIDC+DPoP, and OIDC+PAR flows.
160+
161+
---
162+
56163
## Development
57164

58165
```bash
59166
pnpm install
60-
pnpm build # build all packages (Chrome)
61-
pnpm build:firefox # build Firefox variant
167+
pnpm build # build all packages
168+
pnpm test # vitest (308 tests)
169+
pnpm typecheck # TypeScript type checking
62170
pnpm lint # eslint
63-
pnpm test # vitest
64171
```
65172

173+
| Script | Description |
174+
| --- | --- |
175+
| `pnpm build` | Build all packages |
176+
| `pnpm test` | Run all unit tests |
177+
| `pnpm typecheck` | TypeScript type checking |
178+
| `pnpm lint` | Lint all packages |
179+
| `pnpm changeset` | Create a changeset for versioning |
180+
| `pnpm version` | Apply changesets and bump versions |
181+
| `pnpm release` | Build and publish to npm |
182+
183+
### Tech stack
184+
185+
- **TypeScript** with strict mode and Effect for typed functional effects
186+
- **Elm 0.19** for the DevTools panel UI
187+
- **esbuild** for bundling
188+
- **Vitest** for unit tests, **Playwright** for e2e tests
189+
- **pnpm workspaces** for monorepo management
190+
- **Changesets** for versioning and publishing
191+
192+
---
193+
194+
## Security and privacy
195+
196+
The extension requests only `storage` and `clipboardWrite`/`clipboardRead` — no `cookies`, `webRequest`, `tabs`, or other sensitive APIs. Content scripts use a two-world architecture to prevent arbitrary page code from injecting messages into the background script. All SDK events are decoded through `AuthEventSchema` (Effect Schema) before reaching the EventStore — malformed payloads are dropped. Captured data is stored locally and never transmitted off-device.
197+
66198
---
67199

68200
## License

e2e/README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# E2E Tests
2+
3+
Playwright end-to-end tests for the WolfCola DevTools browser extension.
4+
5+
## Tests
6+
7+
| Test | What it verifies |
8+
|------|-----------------|
9+
| `extension-loads` | Service worker registers, DevTools panel mounts |
10+
| `network-capture` | OIDC network events are captured and annotated |
11+
| `panel-renders-events` | Events render in the timeline, clear button works |
12+
| `firefox-build` | Firefox build produces valid manifest and dist files |
13+
14+
## Running
15+
16+
```bash
17+
pnpm test
18+
```
19+
20+
Chrome must be installed. The tests load the built extension into a Chrome instance with a temporary user data directory.
21+
22+
## Setup
23+
24+
The tests use a shared fixture (`fixtures/extension.ts`) that:
25+
1. Creates a temporary Chrome profile with the extension loaded
26+
2. Provides a `BrowserContext` with the extension ID resolved
27+
3. Starts a mock OIDC server (`mock-oidc-server/server.ts`) for network capture tests
28+
29+
## Mock OIDC server
30+
31+
A lightweight HTTP server that implements:
32+
- `/.well-known/openid-configuration` — discovery document
33+
- `/authorize` — authorization endpoint (302 redirect)
34+
- `/token` — token endpoint (returns access/refresh/ID tokens)
35+
- `/userinfo` — userinfo endpoint
36+
37+
## Prerequisites
38+
39+
- Chrome installed
40+
- Extension must be built first: `cd packages/devtools-extension && pnpm build`
41+
42+
## License
43+
44+
MIT

packages/devtools-bridge/README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# @wolfcola/devtools-bridge
22

3-
Opt-in SDK adapter that connects your Ping Identity / ForgeRock application to the [WolfCola DevTools extension](../devtools-extension). Add it to your app in one line — it is a no-op when the extension is not installed, so it is safe to ship in production builds.
3+
Opt-in SDK adapter that connects your Ping Identity / ForgeRock application to WolfCola DevTools — either the [browser extension](../devtools-extension) or the [VS Code extension](../vscode-extension). Add it to your app in one line — it is a no-op when the extension is not installed, so it is safe to ship in production builds.
44

55
## Contents
66

@@ -178,8 +178,23 @@ Your app
178178
│ chrome.runtime.sendMessage({ type: 'EVENTS_UPDATED' })
179179
180180
panel (Elm) ── Timeline view + Flow view
181+
182+
── OR (VS Code extension) ──
183+
184+
Your app
185+
└── emitAuthEvent()
186+
187+
│ window.postMessage({ type: '__pingDevtools', ... })
188+
189+
CDP-injected script (Page.addScriptToEvaluateOnNewDocument)
190+
191+
│ Runtime.bindingCalled('__wolfcolaBridge', payload)
192+
193+
VS Code extension host ──▶ TreeView + WebView (Elm)
181194
```
182195

196+
The VS Code extension captures SDK events via a CDP-injected script that listens for the same `__pingDevtools` postMessage — no browser extension needed.
197+
183198
Each bridge function:
184199

185200
1. Subscribes to the client store

packages/devtools-core/README.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# @wolfcola/devtools-core
2+
3+
Shared logic for WolfCola DevTools. Contains annotators, diagnosis engine, event store, and export utilities. Used by both the browser extension and VS Code extension.
4+
5+
## Modules
6+
7+
### Annotators (`src/annotators/`)
8+
9+
Pure functions that analyze network traffic and detect OIDC/OAuth patterns.
10+
11+
| Module | Purpose |
12+
|--------|---------|
13+
| `network-observer` | Filters auth-related requests and builds `AuthEvent` from HAR entries |
14+
| `oidc-annotator` | Detects OIDC phases (authorize, token, userinfo, etc.) and extracts parameters |
15+
| `cors-detector` | Identifies CORS issues (missing headers, wildcard+credentials, status zero) |
16+
| `dpop-detector` | Detects DPoP proof JWTs and validates claims |
17+
| `par-detector` | Detects Pushed Authorization Requests |
18+
| `oidc-discovery` | Parses `.well-known/openid-configuration` and matches endpoints |
19+
| `oidc-flow-tracker` | Tracks multi-step OIDC flows across requests |
20+
| `jwt-utils` | JWT decoding, pattern matching, and expiry detection |
21+
22+
### Diagnosis engine (`src/diagnosis/`)
23+
24+
Rule-based diagnostic engine that analyzes captured events and produces actionable issues.
25+
26+
**Rule categories:**
27+
- CORS rules — preflight failures, missing `Access-Control-Allow-Origin`, wildcard+credentials
28+
- Token rules — missing interaction tokens, expired sessions
29+
- Flow config rules — DaVinci node errors, connector errors, policy not found
30+
- OIDC rules — state mismatch, redirect URI mismatch, missing PKCE
31+
- DPoP rules — proof JWT validation, method/URI mismatches
32+
- PAR rules — missing `request_uri`, inline params with `request_uri`
33+
34+
### Event store (`src/event-store/`)
35+
36+
Effect-based event store with dependency injection via `Context.Tag` and `Layer`.
37+
38+
- `EventStoreInMemory` — in-memory store with no-op persistence (for VS Code and testing)
39+
- Consumers provide their own Layer for persistent storage (e.g., `chrome.storage.local`)
40+
41+
### Export (`src/export/`)
42+
43+
- `redact` — strips sensitive data (tokens, passwords, credentials) from flow state
44+
- `markdown` — renders a flow as a Markdown table with diagnosis results
45+
46+
## Usage
47+
48+
```ts
49+
import {
50+
buildNetworkEvent,
51+
isAuthRelated,
52+
runDiagnosis,
53+
redactFlowState,
54+
renderFlowMarkdown,
55+
EventStoreService,
56+
EventStoreInMemory,
57+
} from '@wolfcola/devtools-core';
58+
```
59+
60+
## Testing
61+
62+
```bash
63+
pnpm test # 161 tests
64+
```
65+
66+
## License
67+
68+
MIT

0 commit comments

Comments
 (0)