Repository navigation
fix(notifications): enforce blocked destinations in private mode - #2746
Conversation
Co-authored-by: Codex <[email protected]>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
|
The change affects notification outcomes users see, but the linked evidence is described as source and synthetic-test evidence rather than before-and-after captures of those outcomes.
Suggested fix: No diff; add the requested captures to the linked evidence page. Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness. Posted via Macroscope — Visible change evidence |
|
For the visible-change evidence request: destination acceptance changes, while the forms and diagnostic strings remain unchanged. This remediation is authorized for source assessment and finite offline tests only, so I have not captured runtime form errors or test-send results. The linked evidence shows the same policy assertion failing before the fix and passing afterward, plus injected resolver, connect-guard and redirect fixtures. It does not establish UI or live delivery behavior; maintainer acceptance of that evidence limit remains outstanding. AI-assisted follow-up: |
|
The
Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed. Posted via Macroscope — v1 validation impact |
Quick104
left a comment
There was a problem hiding this comment.
Review of 179832af1. The fix is correct: both guards now use netguard.CheckAddr, so private mode admits the Private class and still refuses Blocked addresses at registration and on every dial, redirect hops included. The dialer checks the address it actually connects to, the transport has no proxy, and IPv4-mapped, NAT64, zoned, and IPv4-compatible forms all classify through the shared policy. I found one test gap, which I'm fixing on this branch.
One defect predates this PR: turning the setting off doesn't affect keep-alive connections opened while it was on, so a LAN destination keeps receiving deliveries until its pooled connection closes. Blocked addresses aren't affected. The fix touches newNotificationHTTPClient, which this PR also changes, so I filed it as #2794 to follow this PR.
AI-generated review: Claude Code (claude-opus-5-5), cross-checked with Codex (gpt-6.1-sol).
The redirect test swapped out the transport and called Control itself, so it could not fail if the production dialer stopped guarding connections. Drive the real client against a loopback TLS server instead, including a redirect hop to 0.0.0.0 that main dials in private mode. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Review summaryReviewed head: Fit: 9/10 · Readiness: 9/10 — ready (assuming CI is green) Fit. This closes a real gap in the outbound address policy: the development switch for private webhook destinations also let webhooks reach cloud metadata, link-local, and other addresses that no caller may reach under Readiness. Both guards now refuse the Blocked class in private mode, on registration and on every dial, including redirect hops. The dialer checks the address it connects to, so a DNS answer that changes after registration is still caught, and IPv4-mapped, NAT64, zoned, and IPv4-compatible forms all go through the shared classifier. I checked it live on local builds of Addressed
Remaining
Validated featuresNo passed case is affected. The cases this reaches, #1234 C1 and #1235 C1/C2, are all recorded as Not run. The body's Other checks
AI-generated review: Claude Code ( |
Problem
Enabling private webhook destinations currently skips the shared address policy at registration and connection time. This change preserves intended LAN access while keeping the policy's Blocked class refused for personal webhooks and server channels.
Closes #2744
Related issue: N/A
Validation tasks: changes #1234 C1 and #1235 C1/C2; board-wide regression query unavailable (missing
read:projectscope).Approach
Both guards use
netguard.CheckAddrwith the current private-access setting. Registration resolves hostnames within two seconds and rejects failed, empty or disallowed answers in either mode. Public-only notification clients also enforce the shared restriction on the server's own interface addresses. HTTPS, URL credential rejection, TLS verification, redirect limits, timeouts, response-body bounds and existing delivery diagnostics remain enforced.The API and settings keep their existing shapes. Apple, Android and Jellyfin compatibility need no client change. The manual already describes private access as reaching LAN and localhost addresses, which remain supported.
Validation
main(387c497fc) and this branch (7f04f922c) against a throwaway database with private destinations allowed:maincreated server channels for169.254.169.254,0.0.0.0, andfe80::1%eth0; this branch refuses all three with 400 and still creates a loopback channel. No delivery was triggered.TestWebhookClientDialPolicydrives the production delivery client against a loopback TLS server: Private refused by default, Private delivered in private mode, and a redirect hop to0.0.0.0refused in private mode without reaching the server. Onmainthat redirect case fails with a TLS error because the hop is dialed.ci / Go testfails only onTestAdminDefaultChangeReachesEveryViewer, which fails onmaintoo ([bug] Administrator default changes no longer reach any events socket #2748).Evidence
Live registration results and focused test results for
7f04f922c; delivery to a real public destination and live TLS behavior remain unverified.Evidence: https://evidence.siloserver.org/r/silo-server/c32-webhook-private-policy/
Risks
Registration in both modes, including web push subscription, now has a two-second lookup deadline. Private mode newly requires successful resolution. Public-only delivery clients, including web push and the push relay, refuse destinations on the server's own interfaces under the existing shared policy. No migration is required.
Follow-up: turning the setting off does not close keep-alive connections opened while it was on, so a Private destination can keep receiving deliveries until its pooled connection closes. That predates this change and is tracked in #2794, to follow this PR.
Checklist
AI Disclosure
claudeAgentprovider for independent reviewclaudeAgentgpt-6.1-sol(implementation),claude-opus-5-5(independent review)claude-opus-5-5reviewed the approach on387c497fc7b00a451a9c8ea7c5dffefcc5a032d4. Bounded resolution, address parsing and documentation amendments were adopted; existing diagnostic mapping was retained and tested. Independent source review byclaude-opus-5-5completed on179832af15e9a985bb222f78451e774dc51fcf9dwith no verified code findings and nothing posted. Required context was read in the completed replacement round. Review used source and offline logs; no runtime proof is claimed. High effort was requested; effective effort could not be independently confirmed.claude-opus-5-5in Claude Code reviewed179832af1, with a Codexgpt-6.1-solcross-check. It found one test gap (the redirect test could not fail if the production dialer stopped guarding connections), fixed in7f04f922c, and one pre-existing defect, filed as [bug] Turning off private webhook destinations leaves pooled connections usable #2794.Note
Enforce blocked webhook destinations in private mode
WebhooksAllowPrivateDestinationsbypassed all address checks. Now private mode permits Private addresses but still rejects Blocked ones, using the sharednetguard.CheckAddrpolicynewNotificationDialer, which reads the private setting at connection time and rechecks each address, including on redirect hops (webhook_http.go)ValidateWebhookURLnow always resolves hostnames and validates credentials even in private mode; registrations with hostnames that fail or resolve slowly (2s limit) are rejectedMacroscope summarized 7f04f92.