Solo developer building practical CLI tools for Linux auditing and B2B data extraction. Creator of Vaultcheck and NPILift. I write about silent failures, false green lights, and infrastructure reliabi
Worth testing around "stored exactly as sent": a capture URL is a disk-fill primitive, because dd if=/dev/zero bs=1M count=2048 | curl -X POST --data-binary @- <capture-url> writes 2 GB to your volume per request from anyone who has the URL, and a 1 MB body sent with Content-Encoding: gzip expands a thousandfold before your code sees a byte. Cap at the socket and return 413, and meter stored bytes per endpoint — the SSRF guards and the storage guard fail in completely different ways.
Thanks, this is the kind of test I wanted. I ran both against the real app setup:
Per-request size and gzip: capped. express.raw has a 1 MB limit, and it applies to the decompressed stream. A 2 MB body got 413, and a 199 KB gzip that inflates to 200 MB also got 413.
Stored bytes per endpoint: you're right, this isn't metered. 200 × 1 MB requests were all stored, and there's no retention. The rate limit bounds speed, not total size.
So the socket guard works but the storage guard doesn't exist yet. I'm adding a per-endpoint cap on request count and total bytes that drops the oldest captures, rather than rejecting new ones, so live deliveries aren't lost. Tracking it here: #6 (comment)
Thanks for separating the two failure modes, that framing shaped the fix.
Update: this is fixed and merged. Each endpoint now keeps its newest 1000 requests and up to 50 MB (both configurable), deleting the oldest rather than refusing new deliveries. Aliweb789/hookpit#29 · feat: bound storage per endpoint…
One honest footnote: my own new tests caught a second bug right after. Two requests in the same millisecond could be listed in swapped order. That's fixed too: #30 · fix: stable order for requests…
The remaining gap is a global cap, because creating endpoints is still unlimited (#24). Thanks again for the prompt.
Solo developer building practical CLI tools for Linux auditing and B2B data extraction. Creator of Vaultcheck and NPILift. I write about silent failures, false green lights, and infrastructure reliabi
50 MB per endpoint only bounds it while endpoint count is bounded — 20k endpoints is still a terabyte, and #24 is exactly that dimension. A per-account byte budget with LRU across endpoints applies your own rule one level up without rejecting live deliveries. Count the evictions per endpoint and expose the number, otherwise the first symptom of dropping oldest is a support ticket about a missing webhook.
Update on this: the three things you suggested have all shipped.
Global byte budget: one cap across all endpoints (default 2 GiB, HOOKPIT_MAX_TOTAL_BYTES). When it's exceeded, the oldest captures are deleted first, down to 95% of the budget. That's oldest-first rather than LRU, since a capture's read time doesn't matter for a webhook log. Each endpoint always keeps its newest capture, so the budget never makes a capture URL refuse requests. Aliweb789/hookpit#33 · feat: global storage budget…
Eviction counts: each endpoint tracks how many captures the limits deleted. It's in GET /api/endpoints/:slug and shown as a note in the dashboard, so a trimmed history is visible. #32 · feat: count and show captures…
The endpoint-count dimension: creating endpoints is now rate limited per client IP (default 60 per minute, HOOKPIT_CREATE_RATE_LIMIT). Unknown slugs are no longer tracked by the capture limiter, so random slugs can't grow its memory. #35 · feat: rate limit endpoint…, #36 · Capture rate limiter: don't…
Testing the creation limit also turned up a bug: rate-limit answers had no CORS headers, so the dashboard showed them as "API unreachable". That's fixed too.
Caveats: the budget is per instance, since there are no accounts, so it's not the per-account version you described. A client with many IPs can still create endpoints at a higher combined rate. Serving mocks from a separate hostname is tracked in #34.
Solo developer building practical CLI tools for Linux auditing and B2B data extraction. Creator of Vaultcheck and NPILift. I write about silent failures, false green lights, and infrastructure reliabi
Oldest-first to 95% will thrash under steady load: every append over 2 GiB triggers a delete pass to 95%, so you evict on nearly every write. Trigger at 100% but evict to a low-water mark (say 80%, HOOKPIT_EVICT_TO_PCT) so the pass runs once per ~20% of the budget instead of per capture. And decide what one capture larger than HOOKPIT_MAX_TOTAL_BYTES does -- keep-newest fights the cap there, so reject it with 413 rather than let one upload blow the budget.
Creator of GithubStarsManager — an open-source, local-first tool that organizes GitHub stars with AI: auto-categorization, semantic search, release tracking, and an MCP server for star library.
The SSRF section is the part I'll steal: checking the address inside the DNS lookup used for the real connection, not just before it, is the detail most write-ups skip — DNS rebinding makes the pre-check version almost theater. And "prove your tests can fail" is a great habit; 13 red tests with the protection off is a much stronger claim than "I have tests for it." The better-sqlite3 ARM story is painfully relatable too — CI being x86-only is exactly how those bugs hide. Nice build!
Creator of GithubStarsManager — an open-source, local-first tool that organizes GitHub stars with AI: auto-categorization, semantic search, release tracking, and an MCP server for star library.
It was — that DNS-lookup detail is the kind of thing I'd have missed. Good luck with the inspector, the replay + mocks combo sounds genuinely useful for debugging webhooks.
The raw-body point is the one that bites in production: once a framework parses the payload you have lost the exact bytes the signature was computed over, and no amount of re-checking the secret will fix it. I like the test discipline too — deliberately breaking each protection and watching the test go red is the only way I trust a replay tool, since replay is exactly where a helpful debugging feature becomes an SSRF hole. In our EDI work we do the same with captured partner payloads: store them byte-for-byte, replay against a staging handler, and never let replay reach a real production endpoint.
Thanks, the EDI workflow you describe is the one I had in mind: store the
payload as received, replay against staging, keep replay away from production.
One honest caveat on "byte-for-byte": Hookpit stores bodies as UTF-8 text, so
it's exact for normal JSON and text, but a payload with non-UTF-8 bytes
(Latin-1 EDI, for example) won't round-trip exactly yet. That's a known gap and
it's tracked here: github.com/Aliweb789/hookpit/issue...
Your last point made me realise there's a related gap: replay blocks private
and metadata addresses, but nothing stops you pointing it at a real public
production URL. An allow-list of permitted replay hosts would give you the
"never reaches production" rule you describe. I'll open an issue for it.
This is the rare build-in-public post where the security section is the actual product, not a footnote. The SSRF detail is what sold me — checking the address inside the DNS lookup used for the real connection, instead of validating a hostname and then resolving it again later, is exactly the rebinding trap most replay tools walk straight into, and catching ::ffff:127.0.0.1 shows you tested the sneaky cases, not just the textbook ones.
One thing I kept thinking about while reading the replay section: you store the raw body exactly as sent, which is the right call for signature checks, but the moment someone edits a payload before replaying, a Stripe-style signature stops verifying. Do you re-sign on replay, strip the signature header, or leave that as the user's problem to notice? And on the rate-limit gap you found in review — creating many endpoints sidestepping the per-endpoint limit — did you end up adding a per-IP global cap alongside it, or is that still the open issue?
The "prove your tests can fail" habit is worth stealing too. 13 red tests with SSRF protection off is a much stronger claim than "tests pass."
Thanks, Abdullah, this is a great read of the article, and both questions are fair.
Signatures on replay: right now I forward the original headers as they were, signature header included, and don't re-sign or strip anything. So replaying an unedited request still verifies, and editing the body makes the signature fail, which is arguably useful for testing your handler's rejection path, but it isn't something the UI explains. The better answer is probably an option on the replay panel: keep the original signature, strip it, or re-sign with a secret you supply (Stripe-style first, since it's well documented). Signature verification is on the roadmap, and I'd build re-signing alongside it. I opened github.com/Aliweb789/hookpit/issue... for exactly this, thanks to your question.
Rate limit: still open. The per-endpoint limit shipped, and the global per-IP cap plus limiting endpoint creation is tracked here: github.com/Aliweb789/hookpit/issue.... I'd rather say it's a known gap than pretend the limiter is complete.
And thanks for the note on the tests. Breaking each protection on purpose and seeing it fail was the most convincing check I did.
serving mocks from a separate hostname is a nice second layer on top of the CSP sandbox. then a missed header still can't reach the dashboard's cookies
Good point, and it fits how the code is laid out. Right now mocks and the management API share one origin, and the forced CSP: sandbox + nosniff is the only thing between a mock response and /api/*. Set-Cookie is already blocked in mock rules, and Hookpit sets no cookies yet, so nothing is exposed today. But once auth lands that stops being true, so a header-independent split is worth having. I'm tracking an optional capture-hostname setting here: #34. Thanks for the idea.
We're a place where coders share, stay up-to-date and grow their careers.
Worth testing around "stored exactly as sent": a capture URL is a disk-fill primitive, because
dd if=/dev/zero bs=1M count=2048 | curl -X POST --data-binary @- <capture-url>writes 2 GB to your volume per request from anyone who has the URL, and a 1 MB body sent withContent-Encoding: gzipexpands a thousandfold before your code sees a byte. Cap at the socket and return 413, and meter stored bytes per endpoint — the SSRF guards and the storage guard fail in completely different ways.Thanks, this is the kind of test I wanted. I ran both against the real app setup:
Per-request size and gzip: capped. express.raw has a 1 MB limit, and it applies to the decompressed stream. A 2 MB body got 413, and a 199 KB gzip that inflates to 200 MB also got 413.
Stored bytes per endpoint: you're right, this isn't metered. 200 × 1 MB requests were all stored, and there's no retention. The rate limit bounds speed, not total size.
So the socket guard works but the storage guard doesn't exist yet. I'm adding a per-endpoint cap on request count and total bytes that drops the oldest captures, rather than rejecting new ones, so live deliveries aren't lost. Tracking it here: #6 (comment)
Thanks for separating the two failure modes, that framing shaped the fix.
Update: this is fixed and merged. Each endpoint now keeps its newest 1000 requests and up to 50 MB (both configurable), deleting the oldest rather than refusing new deliveries. Aliweb789/hookpit#29 · feat: bound storage per endpoint…
One honest footnote: my own new tests caught a second bug right after. Two requests in the same millisecond could be listed in swapped order. That's fixed too: #30 · fix: stable order for requests…
The remaining gap is a global cap, because creating endpoints is still unlimited (#24). Thanks again for the prompt.
50 MB per endpoint only bounds it while endpoint count is bounded — 20k endpoints is still a terabyte, and #24 is exactly that dimension. A per-account byte budget with LRU across endpoints applies your own rule one level up without rejecting live deliveries. Count the evictions per endpoint and expose the number, otherwise the first symptom of dropping oldest is a support ticket about a missing webhook.
Update on this: the three things you suggested have all shipped.
Global byte budget: one cap across all endpoints (default 2 GiB, HOOKPIT_MAX_TOTAL_BYTES). When it's exceeded, the oldest captures are deleted first, down to 95% of the budget. That's oldest-first rather than LRU, since a capture's read time doesn't matter for a webhook log. Each endpoint always keeps its newest capture, so the budget never makes a capture URL refuse requests. Aliweb789/hookpit#33 · feat: global storage budget…
Eviction counts: each endpoint tracks how many captures the limits deleted. It's in GET /api/endpoints/:slug and shown as a note in the dashboard, so a trimmed history is visible. #32 · feat: count and show captures…
The endpoint-count dimension: creating endpoints is now rate limited per client IP (default 60 per minute, HOOKPIT_CREATE_RATE_LIMIT). Unknown slugs are no longer tracked by the capture limiter, so random slugs can't grow its memory. #35 · feat: rate limit endpoint…, #36 · Capture rate limiter: don't…
Testing the creation limit also turned up a bug: rate-limit answers had no CORS headers, so the dashboard showed them as "API unreachable". That's fixed too.
Caveats: the budget is per instance, since there are no accounts, so it's not the per-account version you described. A client with many IPs can still create endpoints at a higher combined rate. Serving mocks from a separate hostname is tracked in #34.
Oldest-first to 95% will thrash under steady load: every append over 2 GiB triggers a delete pass to 95%, so you evict on nearly every write. Trigger at 100% but evict to a low-water mark (say 80%, HOOKPIT_EVICT_TO_PCT) so the pass runs once per ~20% of the budget instead of per capture. And decide what one capture larger than HOOKPIT_MAX_TOTAL_BYTES does -- keep-newest fights the cap there, so reject it with 413 rather than let one upload blow the budget.
The SSRF section is the part I'll steal: checking the address inside the DNS lookup used for the real connection, not just before it, is the detail most write-ups skip — DNS rebinding makes the pre-check version almost theater. And "prove your tests can fail" is a great habit; 13 red tests with the protection off is a much stronger claim than "I have tests for it." The better-sqlite3 ARM story is painfully relatable too — CI being x86-only is exactly how those bugs hide. Nice build!
Thanks, glad it was useful!
It was — that DNS-lookup detail is the kind of thing I'd have missed. Good luck with the inspector, the replay + mocks combo sounds genuinely useful for debugging webhooks.
The raw-body point is the one that bites in production: once a framework parses the payload you have lost the exact bytes the signature was computed over, and no amount of re-checking the secret will fix it. I like the test discipline too — deliberately breaking each protection and watching the test go red is the only way I trust a replay tool, since replay is exactly where a helpful debugging feature becomes an SSRF hole. In our EDI work we do the same with captured partner payloads: store them byte-for-byte, replay against a staging handler, and never let replay reach a real production endpoint.
Thanks, the EDI workflow you describe is the one I had in mind: store the
payload as received, replay against staging, keep replay away from production.
One honest caveat on "byte-for-byte": Hookpit stores bodies as UTF-8 text, so
it's exact for normal JSON and text, but a payload with non-UTF-8 bytes
(Latin-1 EDI, for example) won't round-trip exactly yet. That's a known gap and
it's tracked here: github.com/Aliweb789/hookpit/issue...
Your last point made me realise there's a related gap: replay blocks private
and metadata addresses, but nothing stops you pointing it at a real public
production URL. An allow-list of permitted replay hosts would give you the
"never reaches production" rule you describe. I'll open an issue for it.
This is the rare build-in-public post where the security section is the actual product, not a footnote. The SSRF detail is what sold me — checking the address inside the DNS lookup used for the real connection, instead of validating a hostname and then resolving it again later, is exactly the rebinding trap most replay tools walk straight into, and catching ::ffff:127.0.0.1 shows you tested the sneaky cases, not just the textbook ones.
One thing I kept thinking about while reading the replay section: you store the raw body exactly as sent, which is the right call for signature checks, but the moment someone edits a payload before replaying, a Stripe-style signature stops verifying. Do you re-sign on replay, strip the signature header, or leave that as the user's problem to notice? And on the rate-limit gap you found in review — creating many endpoints sidestepping the per-endpoint limit — did you end up adding a per-IP global cap alongside it, or is that still the open issue?
The "prove your tests can fail" habit is worth stealing too. 13 red tests with SSRF protection off is a much stronger claim than "tests pass."
Thanks, Abdullah, this is a great read of the article, and both questions are fair.
Signatures on replay: right now I forward the original headers as they were, signature header included, and don't re-sign or strip anything. So replaying an unedited request still verifies, and editing the body makes the signature fail, which is arguably useful for testing your handler's rejection path, but it isn't something the UI explains. The better answer is probably an option on the replay panel: keep the original signature, strip it, or re-sign with a secret you supply (Stripe-style first, since it's well documented). Signature verification is on the roadmap, and I'd build re-signing alongside it. I opened github.com/Aliweb789/hookpit/issue... for exactly this, thanks to your question.
Rate limit: still open. The per-endpoint limit shipped, and the global per-IP cap plus limiting endpoint creation is tracked here: github.com/Aliweb789/hookpit/issue.... I'd rather say it's a known gap than pretend the limiter is complete.
And thanks for the note on the tests. Breaking each protection on purpose and seeing it fail was the most convincing check I did.
serving mocks from a separate hostname is a nice second layer on top of the CSP sandbox. then a missed header still can't reach the dashboard's cookies
Good point, and it fits how the code is laid out. Right now mocks and the management API share one origin, and the forced CSP: sandbox + nosniff is the only thing between a mock response and /api/*. Set-Cookie is already blocked in mock rules, and Hookpit sets no cookies yet, so nothing is exposed today. But once auth lands that stops being true, so a header-independent split is worth having. I'm tracking an optional capture-hostname setting here: #34. Thanks for the idea.