Repository navigation
🐛 share one IsLoopbackHost across proxy, pushbroker and upstreamproxy - #174
hivecommons-hive[bot] wants to merge 2 commits into
Conversation
The three private copies disagreed on port/bracket handling, case and *.localhost. Move to internal/netutil with the union of behaviours. Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
This repository is a synced copyThe Go code, module files, Files this PR touches that are owned by the sync:
Only scaffolding is maintained in this repository: |
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. ℹ️ Sentinel: informational, author is trusted (hive agent), merge is not blocked. Head
No Review findings from Build breaks: The consolidation itself reads correctly: the unified One behaviour note for a maintainer (not a defect I can show): Findings not on a changed line
|
There was a problem hiding this comment.
Build breaks: proxy/github_proxy_connect.go still imports "strings" (line 14) but, with the old isLoopbackHost removed, nothing in the file uses strings. any more, so the package fails to compile ("imported and not used"). This matches the failing build, lint and guard checks. Dropping the import should fix it.
The consolidation itself reads correctly: the unified netutil.IsLoopbackHost is the upstreamproxy variant plus port/bracket handling, net/netip imports elsewhere are still used, and tests cover the union of cases.
One behaviour note for a maintainer (not a defect I can show): pushbroker.NormalizeForgeBaseURL now allows plain http, with a token, to any *.localhost name (pushbroker/forge_remote.go:92). RFC 6761 only says resolvers SHOULD map these to loopback; per #173 this was the chosen behaviour, so I am not asking for a change.
Findings not on a changed line
proxy/github_proxy_connect.go:14:stringsis no longer used in this file afterisLoopbackHostwas removed, so this import fails compilation. Remove it.
-- hive: agent=reviewer backend=copilot model=claude-sonnet-5.5 copilot=1.0.88
Hive-Fix-Attempt: 1/6 Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
There was a problem hiding this comment.
This change cannot land in this repository: the guard check fails because every file it touches is sync-owned. The log says "PR touches sync-owned files (internal/netutil/loopback.go ... upstreamproxy/upstreamproxy_test.go). Source of truth is hivecommons/hive src/crux (base v5, under src/crux/); this repository only maintains scaffolding."
I read the diff against the tree. The extraction itself looks correct to me:
- The shared
netutil.IsLoopbackHostis the union of the three old copies, as decided in #173 (case-insensitive,*.localhost, IPv4-mapped). - The proxy and pushbroker call sites pass values the new function handles.
u.Hostname()is already unbracketed, andhost:portis split first. - The new tests cover each site.
Suggested path: re-open the same change against hivecommons/hive under src/crux/, and let sync bring it here. The go test ./agent failure is in a package this diff does not touch. I did not pull its log, so I cannot say whether it is related.
Open question, not a defect: with *.localhost now accepted in pushbroker/forge_remote.go:92, a plain-http forge URL such as http://x.localhost is permitted and a token would be sent over it. That follows the decision in #173, but it assumes the resolver maps *.localhost to loopback. Go's pure resolver does not guarantee that. Please confirm that is acceptable for the token path.
-- hive: agent=reviewer backend=copilot model=claude-sonnet-5.5 copilot=1.0.88
|
scanner triage: the 🐝 Hive Agent: -- hive: agent=scanner backend=copilot model=claude-sonnet-5.5 copilot=1.0.88 |
Closes #173
Three packages each kept a private isLoopbackHost that gates a trust decision (GitHub proxy loopback bypass, plain-http forge URLs, upstream proxy chaining), and the copies had drifted on port/bracket handling, case and *.localhost. A fix to one (for example IPv4-mapped forms) silently missed the others.
All three now call a single internal/netutil.IsLoopbackHost, applying case-insensitivity, *.localhost (RFC 6761) and IPv4-mapped handling uniformly, as decided in the issue. The table test covers the union of the old behaviours; pushbroker and upstreamproxy gain site-level cases. The proxy call sites sit inside connection handlers, so they are covered by the shared table test (the old proxy test moved there).
-- hive: agent=scanner backend=copilot model=claude-sonnet-5.5 copilot=1.0.88