feat(sidecar): support remote HTTPS sidecar addresses#1225
Conversation
Relax the auth-sidecar proxy address policy so a remote central sidecar reachable over TLS can be used, while keeping existing same-host plaintext behavior unchanged. - ValidateProxyAddr: allow https:// to any host (cross-machine); http:// and bare host:port stay same-host only; userinfo/path/query/fragment remain rejected. - Add ProxyScheme and route the interceptor URL rewrite through the configured scheme (https for remote, http for same-host). ProxyScheme parses the address so a mixed-case HTTPS:// cannot silently downgrade to plaintext HTTP. - Update LARKSUITE_CLI_AUTH_PROXY doc and server-demo README for the new policy; refresh the package comment. - Tests: case-insensitive scheme, IPv6 https, https userinfo rejection, query/fragment rejection, ProxyHost https forms, and end-to-end interceptor scheme selection.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR extends sidecar proxy support from HTTP-only to dual HTTP/HTTPS by extracting and propagating the configured proxy URL scheme; it tightens proxy validation, updates the interceptor to honor the scheme, and expands tests and docs to reflect same-host HTTP vs remote HTTPS rules. ChangesHTTPS support for remote sidecars
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
Align comment spacing flagged by the fast-gate gofmt check.
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@52dc09af954a9030ff3608aa11ad91ef0779a292🧩 Skill updatenpx skills add larksuite/cli#feat/sidecar-remote-https -y -g |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1225 +/- ##
=======================================
Coverage 69.19% 69.20%
=======================================
Files 634 634
Lines 59482 59489 +7
=======================================
+ Hits 41161 41168 +7
Misses 15007 15007
Partials 3314 3314 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
Relax the auth-sidecar proxy address policy so the CLI can route through a remote central sidecar over TLS, while keeping the existing same-host plaintext sidecar working unchanged.
Previously
LARKSUITE_CLI_AUTH_PROXYonly accepted a same-host (loopback / alias) plaintexthttp://address;https://and cross-machine hosts were rejected. That blocked a remote/central sidecar deployment, even though the multi-tenant sidecar pattern can route requests to a gateway and attach a trusted per-user identity.Policy after this change
https://<any-host>(incl. remote / cross-machine)http://<same-host>or barehost:porthttp://<remote-host>Same-host behavior is unchanged (backward compatible).
Changes
sidecar/protocol.go: rewriteValidateProxyAddrscheme policy; addProxyScheme(parses the address so a mixed-caseHTTPS://cannot silently downgrade to plaintext); refresh package /errNotSameHost/ doc comments.extension/transport/sidecar/interceptor.go: the interceptor now carries the resolved scheme and rewritesreq.URL.Schemetohttpsfor a remote sidecar (was hardcodedhttp).internal/envvars/envvars.go,sidecar/server-demo/README.md: doc updates for the new policy.Tests
ProxyScheme+ end-to-end interceptor), IPv6 https, remote-http rejection, https userinfo rejection, query/fragment rejection,ProxyHosthttps forms.go build ./...andgo build -tags authsidecar ./...pass;go vetclean.go test ./sidecar/...andgo test -tags authsidecar ./extension/transport/sidecar/... ./extension/credential/sidecar/...all pass.-tags authsidecarbuild now acceptshttps://sidecar.mycorp.com(and mixed-caseHTTPS://…) where it previously errored.Security notes
The boundary is "plaintext only same-host; cross-machine requires TLS". The CLI→sidecar hop carries only a sentinel placeholder + HMAC signature (no real token); the real token is injected by the trusted sidecar. Remote plaintext stays rejected so signed / credential-bearing traffic is never sent in the clear.
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Documentation
Tests