Repository navigation
Keep backend credentials off environment proxies and cross-host redirects - #234
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Backend transport and redirect policy internal/adapter/factory/client.go, internal/adapter/factory/client_test.go |
Adds backend transport and client constructors. Clients ignore environment proxies and permit only same-host redirects, including HTTP-to-HTTPS upgrades. |
Health and discovery client integration internal/adapter/discovery/http_client.go, internal/adapter/health/checker.go, internal/app/services/discovery.go |
Health checks and model discovery use the backend client factory with their existing timeout and connection-pool settings. |
Credential and proxy validation internal/adapter/health/client_transport_test.go, internal/app/services/discovery_client_test.go |
Tests verify direct backend access, API-key delivery to the backend, and refusal of cross-host redirects. |
Proxy and redirect documentation docs/content/configuration/endpoint-auth.md, docs/content/about/release-notes.md, internal/adapter/proxy/... |
Documents direct connections, credential use, and permitted redirect behaviour. Updates transport comments for Olla and Sherpa.准 |
Priority:
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Bug fix
Sequence Diagram(s)
sequenceDiagram
participant DiscoveryService
participant HealthChecker
participant BackendHTTPClient
participant BackendEndpoint
DiscoveryService->>BackendHTTPClient: discover models with endpoint credentials
HealthChecker->>BackendHTTPClient: check endpoint health with endpoint credentials
BackendHTTPClient->>BackendEndpoint: connect directly without environment proxy
BackendEndpoint-->>BackendHTTPClient: return response or redirect
BackendHTTPClient-->>DiscoveryService: follow permitted redirect or return error
BackendHTTPClient-->>HealthChecker: follow permitted redirect or report unhealthy
Possibly related PRs
- thushan/olla#231: Adds TEI model discovery and health checks that inherit the backend client policy from this change.
Merge Risk: 
Minimal · up to e1d2a
-
The supplied evidence identifies no issue that would block merging after normal checks.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passedFull details: Docstring Coverage
-
Explanation
Docstring coverage is 65.38% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 26 functions across 11 files. (2 skipped: 2 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches: 💡 1
-
📝 Generate docstrings: 💡
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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 @coderabbitai help to get the list of available commands.
Summary
Model discovery used an
http.Clientwith no transport, so it honouredHTTP_PROXY/HTTPS_PROXY. That sent backend credentials (auth:bearer or basic,X-Api-Key, customheaders:) through an environment proxy. Discovery and health checks also followed cross-host redirects, which replayedX-Api-Keyand custom headers to the new host.Discovery and health now share
factory.NewBackendHTTPClient, which:The proxy engines are untouched; only their comments change.
Type of change
How was this tested?
New tests:
TestDiscoveryClient_IgnoresEnvironmentProxyTestDiscoveryClient_DoesNotReplayCredentialsOnCrossHostRedirectTestHealthClient_RefusesCrossHostRedirectTestRefuseCrossOriginRedirect: ports, default ports, downgrade,σ/ς, Kelvin K and IPv6 zone casesTestNewBackendHTTPClient_DoesNotReplayHeadersAcrossHostsThe discovery and health tests fail against
1cda972.A live run on
integration/test-october(85f9244) used a backend on a non-loopback address withHTTP_PROXYpointing at a capture listener. On this fix the listener saw 0 requests. On1cda972it saw 1, the discovery request.The http to https upgrade isn't exercised live, because there is no TLS fixture. Unit tests cover it.
Checklist
make readypasses ate1d2a6dconfiguration/endpoint-auth.md"Proxies and Redirects", plus the v0.0.30 release noteSummary by CodeRabbit