Repository navigation
π fix: consistent redirect policy and credential stripping for http clients - #19226
hivecommons-hive[bot] wants to merge 2 commits into
Conversation
β¦lients The egress proxy's own clients (inferenceHTTPClient, FindEndpointForModel, queryMaxModelLen, probeEntitledModels, defaultReferenceLookup) used net/http's default redirect policy: 10 hops, Authorization kept on same-domain/other-port/subdomain hops and https->http downgrades, and custom headers such as X-IBM-Project-ID never stripped. They now share egressCheckRedirect: 3 hops, http(s) only, credentials and route ExtraHeaders stripped on any off-host or downgrading hop. The knowledge clients and the connector HTTP client gain the same stripping on top of their private-host policy, and the hub lite-enrollment repo-access check stops forwarding the GitHub token off-host. Tests pin that forwardPlainDirect relays redirects without following them, and the decision for dialUpstreamRaw's chained hostname case: names are delegated verbatim to the upstream proxy, literal IPs are still refused locally. Closes #19222 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> 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 |
|
Hive status β updated in place; edits do not notify. Full history is in the Activity Monitor. hive/awaiting-ci: CI pending - sweep will merge when green. Note: the PR body says Closes #19222, but two items remain open: the hub lite-enrollment redirect limit stays at 10 (existing GHE tests require it), and explicit config for private enterprise hosts on the inspected TLS legs is not done. Maintainers may prefer Refs #19222. π Hive Agent: |
Open PR overlap checkβ
Resolved: no conflicting open PRs or same-file overlaps remain against |
|
Needs a decision, not a merge:
Head: verdict requires_human @f0c2909, 76/77 checks green, 1 pending, DCO yes, soak 0s of 10m0s, labels: decision-needed. What to do: approve this head ( How to release it:
Clear the cause and the hive re-evaluates on its next pass; the stage moves to Updated 2026-11-19 06:40 UTC. |
Mutation testingβ gremlins did not produce a report for 1 package(s), so no verdict can be derived from this run (see the job log):
Verdict: |
|
owner action required: set or rotate the secret named in the title, then remove Rationale: secrets, PATs and org permissions are the owner's alone. Hive decided: Only the hive owner can do this. Decided by the hive at @hosted-available-oke-11-placeholder-r05x's request as the owner's delegate under the owner-delegate policy (rule |
|
/hive decision Request changes at f0c2909, then this can merge:
|
|
Decision recorded by @clubanderson for head |
β¦irect limit Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
Thanks. I re-checked each point against f0c2909 before changing anything, and all four were right. Fixed in 71cecc6 on the same branch.
Left unchanged: the optional π Hive Agent: |
π Hold-gate integrity: branch changed while hold-gated β fresh review requiredThis PR's branch moved while it sat hold-gated: the head recorded when the hold was applied was Commits not present in the hold-time snapshot (1):
A human should review the FULL diff at the current head β a rebase or force-push renames every commit, so everything above needs eyes even if it looks familiar. Removing the hold label after that review is the fresh approval: the guard has re-pinned its snapshot to the current head, so a clean lift re-opens the merge lanes. |
Why
Part of the egress audit (#18986, sections 3 and 3b). Several outbound clients that send credentials relied on net/http's default redirect policy, which follows 10 hops, keeps
Authorizationon a hop to the same domain on another port, to a subdomain, or across an https to http downgrade, and never strips custom headers such asX-IBM-Project-IDor a route'sExtraHeaders. An upstream answering with a redirect could walk the gateway key or a GitHub token to another host.What
src/crux/proxy/egress_redirect.go: newegressCheckRedirectpolicy (3 hops, matchingssrfMaxRedirects; http(s) only; credential headers plus route extra headers stripped on any off-host or downgrading hop; same-host redirects keep credentials).inferenceHTTPClient(all paths; it no longer returnshttp.DefaultClient, the transport is unchanged),FindEndpointForModel,queryMaxModelLen,probeEntitledModelsanddefaultReferenceLookup.src/pkg/knowledge:StripCredentialsOnCrossHostRedirectplusknowledgeRedirectPolicy, used by the llm-wiki client, Context7 andCheckRedirectNoPrivate(connector HTTP client). The connectorAllowPrivatepolicy also strips and refuses non-http(s) schemes.src/pkg/hub/lite_enrollment.go: repo-access check no longer forwards the user's GitHub token off-host or to plain http.Audit results and decisions
forwardPlainDirectusesTransport.RoundTripand never follows redirects. A regression test pins that the 307 is relayed to the agent and the target is never contacted.dialUpstreamRawhostname case on the chained path: kept as delegation. The upstream proxy resolves the name, so a local resolve would be both split-DNS-wrong and a TOCTOU with no enforcement value. Test pins that the hostname reaches the upstream proxy verbatim while private literals (IPv6 and v4-mapped) are refused before it is asked.stripAuthOnCrossHostRedirect; untouched.docsource.go,ssrf_guard.goand other dial-pinning files are not edited (sibling work).Left for follow-up
liteRepoAccessMaxRedirectsand stripping goes throughknowledge.StripCredentialsOnCrossHostRedirect. Shrinking the limit is follow-up.Tests added alongside each fix. Not run locally (gofmt only).
Refs #19222
π€ Generated with Claude Code
-- hive: agent=scanner backend=claude model=claude-sonnet-5-5 claude=2.1.327 requested_by=@clubanderson