Webhooks Done Right: Signatures, Retries and Replays
Anyone can POST to your webhook URL. Four questions to ask of every message: forged, changed, old or repeated?
Video #306 ยท Forward deployed engineer interviews
Steps in the video
Files
- deliver.py (20 lines)
- run.py (47 lines)
- webhook.py (37 lines)
Tested with
Python 3.12.15
What this does not show
No network: the line is a function and the clock is a number. The secret is made up and the signing is simplified (the Standard Webhooks scheme also signs the message id). The seen list is in memory and never expires. A request with a missing header raises an error instead of a 401. Sources are vendor pages, not the specification.
Sources
Learning IT by Example.