Allow specific private networks for webhooks instead of all-or-nothing GLITCHTIP_ALLOW_PRIVATE_IPS
Review this checklist before submitting.
- GitLab issues are for bug reports and feature requests.
- Document reproduction steps. Be as detailed as possible.
- Be considerate of the reviewer of your issue and their time.
- Check existing issues first. (#249 (closed) added the guard; this asks for a narrower opt-out.)
Description
Self-hosted installs often send alert webhooks to a receiver on a private network: a VPN or mesh address (for example in 100.64.0.0/10), an internal chat bot, or a sidecar container. Today the only way to reach one is GLITCHTIP_ALLOW_PRIVATE_IPS=True. That turns the webhook SSRF guard off for every private address, so an org admin can then aim a webhook at any internal host.
Reproduce on 7.0.0:
- Keep
GLITCHTIP_ALLOW_PRIVATE_IPS=False. - Create a generic webhook alert recipient whose URL points at a private address, such as
http://100.64.1.2:8010/hook. - Creation is rejected ("URLs targeting private or internal IPs are not allowed"). Setting the flag to True is the only way through, and it opens all private ranges.
Proposed solution
Add a setting such as GLITCHTIP_ALLOWED_PRIVATE_NETWORKS: a comma-separated list of IPs or CIDRs, optionally with a port. Webhook validation (check_url_safe in the alert schema and at send time) and the connector in safe_session would accept those destinations and keep blocking every other private address while GLITCHTIP_ALLOW_PRIVATE_IPS=False.
The plumbing mostly exists already: ValidatingResolver and ValidatingConnector in glitchtip/ssrf_protection.py take an exempt set, which is used today for the outbound proxy. Matching on the resolved IP (not the hostname) would keep the DNS-rebinding protection intact. Uptime monitors could share the list or get their own GLITCHTIP_UPTIME_ALLOWED_PRIVATE_NETWORKS.
Happy to test a build.