fix(gvproxy)!: apply allow_net to the host alias IP - #1106
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (10)
🚧 Files skipped from review as they are similar to previous changes (10)
📝 WalkthroughWalkthroughThe change makes ChangesHost alias allowlist enforcement
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant Gvproxy
participant HostLoopback
Client->>Gvproxy: Send UDP or TCP traffic to 192.168.127.254
Gvproxy->>Gvproxy: Apply allow_net filter
Gvproxy->>HostLoopback: Forward traffic when address is listed
Gvproxy-->>Client: Drop traffic when address is not listed
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
📦 BoxLite review — couldn't completepowered by BoxLite |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/faq.md`:
- Around line 306-307: The documentation should clarify that a non-empty
allow_net permits the host alias when it includes “192.168.127.254” or a CIDR
covering that address. Update the corresponding guidance in docs/faq.md lines
306-307 and docs/guides/README.md lines 342-344; make the same wording
correction at both sites.
In `@src/deps/libgvproxy-sys/gvproxy-bridge/udp_filter_test.go`:
- Around line 431-434: Update the ReadFrom error handling in the UDP filter test
to return only when the error is a net.Error whose Timeout() is true; fail the
test for every other error instead of silently returning. Preserve the existing
dropped-datagram behavior for deadline timeouts.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 8d75af3d-0747-4515-be76-ed8a93054f8f
📒 Files selected for processing (10)
docs/faq.mddocs/guides/README.mddocs/reference/README.mdsrc/boxlite/src/net/constants.rssrc/boxlite/tests/network_spec.rssrc/deps/libgvproxy-sys/gvproxy-bridge/allow_net_filter_test.gosrc/deps/libgvproxy-sys/gvproxy-bridge/forked_tcp_test.gosrc/deps/libgvproxy-sys/gvproxy-bridge/forked_udp_test.gosrc/deps/libgvproxy-sys/gvproxy-bridge/main.gosrc/deps/libgvproxy-sys/gvproxy-bridge/udp_filter_test.go
192.168.127.254 was handed to NewAllowNetFilter as an internal address, so MatchesIP short-circuited on it before any rule was consulted. The alias NATs to host loopback, which makes it an egress destination like any other: a box with a restrictive allow_net could still reach every service bound to 127.0.0.1 on the host, over both TCP and UDP. Its DNS record is still served unconditionally — resolving the alias is not egress — but reaching it now requires listing "192.168.127.254" or a covering CIDR. Build the filter through a single newAllowNetFilter so the test harness shares the production wiring. It previously duplicated the argument list, which left this behaviour invisible to the Go suite. BREAKING CHANGE: a non-empty allow_net no longer implies access to host.boxlite.internal. Add "192.168.127.254" to keep it reachable. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
8010d5b to
ef82970
Compare
## Summary `192.168.127.254` — the built-in host alias that gvproxy NATs to host loopback — was exempt from `allow_net`, so a box with a restrictive allowlist could still reach every service bound to `127.0.0.1` on the host, over both TCP and UDP. It is now an ordinary egress destination. ## Changes - Drop `config.HostIP` from the filter's always-allow set. The alias is a NAT to host loopback, not a virtual-network endpoint like the gateway and guest addresses, so it belongs under policy. - Build the filter through a single `newAllowNetFilter(config)`. The Go test harness previously duplicated the argument list, which is why a one-line policy change was invisible to `go test`; all test construction now routes through the production helper. - Resolution is unchanged: the built-in DNS record for `host.boxlite.internal` is still served unconditionally — resolving the alias is not egress. Reaching it requires listing `"192.168.127.254"` or a covering CIDR. - Tests: tap-level reproducers for both transports plus a routing guard that pins pre-NAT policy matching against post-NAT dialing; the four Rust integration cases now cover blocked-and-listed on both TCP and UDP. - Docs: four sites stated the alias was not governed by `allow_net`. ## How to verify ``` make test:unit:gvproxy FILTER='HostAlias' make test:integration:rust FILTER='host_alias' ``` Manually: start a box with `allow_net: ["example.com"]`, then `wget http://host.boxlite.internal:<port>/` against a host loopback listener — the connection is refused while `nslookup host.boxlite.internal` still returns `192.168.127.254`. Adding `"192.168.127.254"` to `allow_net` restores it. ## Risks / rollout Breaking change. Existing callers that set a non-empty `allow_net` and rely on `host.boxlite.internal` must add `"192.168.127.254"`. Boxes with an empty or omitted `allow_net` are unaffected. Granularity is address-level: allowing the alias opens every port bound to host loopback. `allow_net` has no port dimension, so this is not expressible more narrowly today. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Host-loopback access now consistently follows `allow_net` rules for UDP and HTTP traffic. - Restrictive allowlists block access through `host.boxlite.internal` unless `192.168.127.254` is explicitly included. - Empty or omitted allowlists continue to permit host-loopback access. - DNS resolution for `host.boxlite.internal` remains available regardless of access permissions. - **Documentation** - Updated networking FAQs, guides, and reference documentation to clarify host-loopback addressing, allowlist behavior, and access requirements. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Summary
192.168.127.254— the built-in host alias that gvproxy NATs to host loopback — was exempt fromallow_net, so a box with a restrictive allowlist could still reach every service bound to127.0.0.1on the host, over both TCP and UDP. It is now an ordinary egress destination.Changes
config.HostIPfrom the filter's always-allow set. The alias is a NAT to host loopback, not a virtual-network endpoint like the gateway and guest addresses, so it belongs under policy.newAllowNetFilter(config). The Go test harness previously duplicated the argument list, which is why a one-line policy change was invisible togo test; all test construction now routes through the production helper.host.boxlite.internalis still served unconditionally — resolving the alias is not egress. Reaching it requires listing"192.168.127.254"or a covering CIDR.allow_net.How to verify
Manually: start a box with
allow_net: ["example.com"], thenwget http://host.boxlite.internal:<port>/against a host loopback listener — the connection is refused whilenslookup host.boxlite.internalstill returns192.168.127.254. Adding"192.168.127.254"toallow_netrestores it.Risks / rollout
Breaking change. Existing callers that set a non-empty
allow_netand rely onhost.boxlite.internalmust add"192.168.127.254". Boxes with an empty or omittedallow_netare unaffected.Granularity is address-level: allowing the alias opens every port bound to host loopback.
allow_nethas no port dimension, so this is not expressible more narrowly today.🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
allow_netrules for UDP and HTTP traffic.host.boxlite.internalunless192.168.127.254is explicitly included.host.boxlite.internalremains available regardless of access permissions.Documentation