Repository navigation
Allow webhook delivery to operator-approved private networks (e.g. WEBHOOK_ALLOWED_CIDRS) #261
Replies: 1 comment 1 reply
|
Agreed in principle, and your reading of the code is accurate, including the point that we already accept this trade-off for CalDAV, the LLM client and LiveKit. What the block is for, in plain terms. A webhook is a URL our server fetches on demand. If it will fetch any address, then whoever can create a webhook can make our server issue requests inside the operator's network, including the cloud metadata address that hands out credentials on hosted machines. That is why The cost of that default for self-hosting, which is your point: the most natural webhook receiver is a container next door. So: accepted, with three conditions. The escape hatch is an env var, as you propose, not an in-app setting. The distinction matters: a workspace admin can already create a webhook, and an instance setting would let them widen their own reach. The operator sets it, so widening is a deliberate act by whoever runs the box. The blocked ranges that must stay blocked regardless of configuration are the metadata address and link-local. Listing The check must apply both when the URL is saved and at dial time, which is what Document it in DEPLOY.md beside PR welcome. Tests worth having: a private target refused by default, allowed when listed, and still refused for the metadata address. |
Uh oh!
There was an error while loading. Please reload this page.
Webhook targets are resolved through netutil.ResolveSafe / SafeTransport, which rejects any private, loopback, link-local, CGNAT or ULA address. That's the right default against SSRF.
For self-hosted deployments, though, the most natural webhook receiver is a sibling container on the same Docker network (e.g. http://sms-sender:8080/webhook, resolving to 172.x). Today that's impossible. The workarounds are routing the webhook out through the public reverse proxy and back in (hairpin, extra public endpoint) or polling the REST API.
The codebase already accepts this trade-off elsewhere: ResolveNotMetadata / MetadataSafeTransport deliberately allow private ranges for CalDAV, LLM and LiveKit, because "a self-hostable product can't treat 'private network' as inherently suspicious".
Proposal:
New env var WEBHOOK_ALLOWED_CIDRS (comma-separated, empty by default, so behaviour is unchanged). Operator-level, not an in-app setting, so a workspace admin can't widen it.
When set, webhook targets inside those CIDRs pass. Everything else still goes through ResolveSafe. The cloud-metadata range (169.254.0.0/16, fe80::/10) stays blocked unconditionally, even if listed.
The check applies both when saving the webhook URL and at dial time (same DNS-rebinding protection as today).
Documented in DEPLOY.md next to TRUSTED_PROXY_CIDRS, with the same "only list networks you control" warning.
We can send a PR with tests if you agree with the shape.
All reactions