Pulse/internal/notifications
rcourtman 1b221cca71 feat: Add configurable allowlist for webhook private IP targets (addresses #673)
Allow homelab users to send webhooks to internal services while maintaining security defaults.

Changes:
- Add webhookAllowedPrivateCIDRs field to SystemSettings (persistent config)
- Implement CIDR parsing and validation in NotificationManager
- Convert ValidateWebhookURL to instance method to access allowlist
- Add UI controls in System Settings for configuring trusted CIDR ranges
- Maintain strict security by default (block all private IPs)
- Keep localhost, link-local, and cloud metadata services blocked regardless of allowlist
- Re-validate on both config save and webhook delivery (DNS rebinding protection)
- Add comprehensive tests for CIDR parsing and IP matching

Backend:
- UpdateAllowedPrivateCIDRs() parses comma-separated CIDRs with validation
- Support for bare IPs (auto-converts to /32 or /128)
- Thread-safe allowlist updates with RWMutex
- Logging when allowlist is updated or used
- Validation errors prevent invalid CIDRs from being saved

Frontend:
- New "Webhook Security" section in System Settings
- Input field with examples and helpful placeholder text
- Real-time unsaved changes tracking
- Loads and saves allowlist via system settings API

Security:
- Default behavior unchanged (all private IPs blocked)
- Explicit opt-in required via configuration
- Localhost (127/8) always blocked
- Link-local (169.254/16) always blocked
- Cloud metadata services always blocked
- DNS resolution checked at both save and send time

Testing:
- Tests for CIDR parsing (valid/invalid inputs)
- Tests for IP allowlist matching
- Tests for bare IP address handling
- Tests for security boundaries (localhost, link-local remain blocked)

Related to #673

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-09 08:31:12 +00:00
..
concurrency_test.go Fix settings security tab navigation 2025-10-11 23:29:47 +00:00
email_enhanced.go Fix critical monitoring system issues and add robustness improvements 2025-11-07 08:52:37 +00:00
email_providers.go Fix settings security tab navigation 2025-10-11 23:29:47 +00:00
email_template.go Fix settings security tab navigation 2025-10-11 23:29:47 +00:00
notifications.go feat: Add configurable allowlist for webhook private IP targets (addresses #673) 2025-11-09 08:31:12 +00:00
notifications_test.go Add test notification functionality for Apprise 2025-11-05 18:54:18 +00:00
queue.go Fix critical monitoring system issues and add robustness improvements 2025-11-07 08:52:37 +00:00
webhook_allowlist_test.go feat: Add configurable allowlist for webhook private IP targets (addresses #673) 2025-11-09 08:31:12 +00:00
webhook_enhanced.go feat: Add configurable allowlist for webhook private IP targets (addresses #673) 2025-11-09 08:31:12 +00:00
webhook_templates.go Fix Pushover webhook custom field overrides (related to #665) 2025-11-08 10:32:27 +00:00