Skip to content

Commit 9d69f57

Browse files
authored
Merge pull request #251 from commandlayer/codex/create-webhook-auto-verification-example
Add webhook auto-verify example with runtime canonical receipt verification
2 parents 86f0c35 + bc76887 commit 9d69f57

8 files changed

Lines changed: 1083 additions & 0 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
.env
3+
.DS_Store
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Webhook Auto-Verification Example
2+
3+
This example shows automatic verification. No manual paste is required.
4+
5+
## Flow
6+
7+
1. Runtime signs receipt.
8+
2. Webhook receives receipt.
9+
3. Server posts receipt to verifier.
10+
4. Valid receipt returns accepted.
11+
5. Tampered receipt returns rejected.
12+
13+
## Commands
14+
15+
```bash
16+
cd examples/webhook-auto-verify
17+
npm install
18+
npm run check
19+
npm run generate:samples
20+
npm start
21+
```
22+
23+
In another terminal:
24+
25+
```bash
26+
curl -X POST http://localhost:3000/webhook \
27+
-H "Content-Type: application/json" \
28+
--data @sample-canonical-shape-webhook.json
29+
30+
curl -X POST http://localhost:3000/webhook \
31+
-H "Content-Type: application/json" \
32+
--data @sample-canonical-shape-tampered-webhook.json
33+
```
34+
35+
Expected:
36+
- valid -> 200 accepted
37+
- tampered -> 400 rejected
38+
39+
## Environment variables
40+
41+
- `COMMANDLAYER_VERIFY_URL`
42+
- `COMMANDLAYER_SIGN_URL`
43+
- `PORT`
44+
45+
## Trust boundaries
46+
47+
- Runtime signs.
48+
- Verifier validates.
49+
- MCP bridges.
50+
- SDK wraps.
51+
- Schema-valid alone is not verified.
52+
- Verification requires hash and signature checks.
53+
- Webhook sender authentication is separate from receipt verification.
54+
55+
56+
## Note on sample files
57+
58+
If your environment can reach `https://runtime.commandlayer.org`, run `npm run generate:samples` to create real live samples (`sample-valid-webhook.json` and `sample-tampered-webhook.json`).
59+
In offline or restricted environments, the committed `sample-canonical-shape-*.json` files are structure-only placeholders and are not verifiable runtime receipts.

0 commit comments

Comments
 (0)