Repository navigation
feat(plugins): allow CGNAT addresses for listed private hosts via PLUGIN_FETCH_ALLOW_CGNAT - #864
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
There was a problem hiding this comment.
ℹ️ No blocking issues — one non-blocking finding below.
Approach: sound — an explicit, default-off opt-in that reuses the existing listed-host mechanism and leaves every other internal range blocked.
Reviewed changes
- CGNAT exception:
PrivateHostsOption/WithAllowCGNATandisCGNATextendPrivateHosts.Blocksso listed hosts may reach100.64.0.0/10only when opted in; loopback, link-local, multicast, unspecified, and IPv6 transition literals stay blocked. - Config plumbing:
PLUGIN_FETCH_ALLOW_CGNATis parsed as a bool (defaultfalse, invalid values error out) intoPluginsConfig.FetchAllowCGNATand passed toNewPrivateHostsinbootstrap/app.go, reachingpaca.fetchthrough the existingFetchPrivateHostsset. - Deployment and docs: Compose, Helm values/template,
deploy/README.md, and the plugin backend docs describe the new opt-in. - Tests: New cases cover the allowed/blocked CGNAT matrix and the config default/
true/invalid paths;go test ./internal/platform/netguard/... ./internal/config/...passes.
Non-blocking
- New env var missing from the env templates.
PLUGIN_FETCH_ALLOW_CGNATis not added next to the existingPLUGIN_FETCH_PRIVATE_HOSTSentry in services/api/.env.example or deploy/.env.production.example, even though services/api/README.md asks for env vars to stay in.env.example; operators copying those templates won't discover the opt-in.
deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏
pikann
left a comment
There was a problem hiding this comment.
LGTM! Thank you for the contribution! 🚀

Summary
Adds an explicit opt-in
PLUGIN_FETCH_ALLOW_CGNAT(defaultfalse) sopaca.fetchcan reach services on CGNAT addresses (100.64.0.0/10, such as Tailscale) when their hostname is already listed inPLUGIN_FETCH_PRIVATE_HOSTS.netguard.PrivateHosts.Blockspreviously only exemptednet.IP.IsPrivate()(RFC 1918 andfc00::/7), keeping100.64.0.0/10blocked even for listed hosts because some cloud metadata endpoints live there.PrivateHostsOption/WithAllowCGNAT(bool)andisCGNATinservices/api/internal/platform/netguard/netguard.go. Only direct IPv4 / IPv4-mapped CGNAT addresses for listed hosts are exempted when opted in; unlisted hosts, loopback, link-local (169.254.0.0/16), and IPv6 transition literals remain blocked, andJEV_PRIVATE_HOSTSis unchanged.PluginsConfig.FetchAllowCGNATparsed fromPLUGIN_FETCH_ALLOW_CGNAT(falseby default) inservices/api/internal/config/and wired it inservices/api/internal/bootstrap/app.go.PLUGIN_FETCH_ALLOW_CGNAT/api.plugins.fetchAllowCGNATtodeploy/docker-compose.prod.yml,deploy/helm/paca/,deploy/README.md, anddocs/plugins/backend-plugin-system.md.private_hosts_test.goandload_test.go.Fixes #688
Type of Change
Verification
Run in
services/apiwithgolang:1.26.4-alpine:gofmt -s -l internal/platform/netguard internal/config internal/bootstrap(clean)go test -count=1 ./internal/platform/netguard/... ./internal/config/...(passed)go vet ./...(passed)go build ./...(passed)golangci-lint run --timeout=5m ./internal/platform/netguard/... ./internal/config/... ./internal/bootstrap/...(0 issues)Checklist