feat: Support resource alias translation in CONNECT message#382
feat: Support resource alias translation in CONNECT message#382clement0010 wants to merge 5 commits into
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SACLEGn4b97yMUTEws2MyU
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## fix/verify-connect-downstream-port #382 +/- ##
======================================================================
- Coverage 86.26% 86.22% -0.04%
======================================================================
Files 40 40
Lines 2853 2861 +8
======================================================================
+ Hits 2461 2467 +6
- Misses 265 269 +4
+ Partials 127 125 -2
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
… tests Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SACLEGn4b97yMUTEws2MyU
There was a problem hiding this comment.
Pull request overview
This PR extends CONNECT destination validation and upstream resolution to support per-resource alias translation, so clients can CONNECT to a resource alias while the Gateway dials the underlying resource address (in addition to the existing downstream→upstream port rewrite).
Changes:
- Adds
resource.aliasto GAT token claims. - Moves CONNECT host validation into
resolveUpstreamAddress, allowing eitherresource.address(exact/wildcard) orresource.alias(exact) and performing alias→address translation. - Updates/expands unit tests to cover alias rewriting and new validation behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| internal/token/gat_claims.go | Adds Alias field to Resource claims for controller-provided alias support. |
| internal/connect/connect.go | Validates CONNECT host against resource address/alias and rewrites alias host to upstream address while preserving downstream→upstream port mapping. |
| internal/connect/connect_test.go | Updates existing expectations and adds coverage for alias rewriting and the new resolver signature. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SACLEGn4b97yMUTEws2MyU
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SACLEGn4b97yMUTEws2MyU
798dd62 to
5db3e5b
Compare
Branched out from #363
Related Tickets & Documents
upstreamanddownstreamresource configuration in GAT token #342Changes
Gateway should support translating the alias address in the CONNECT message to the upstream address alongside the existing downstream→upstream port mapping.
It should also validate that the CONNECT address must match the token's
resource.address(exact or wildcard) or itsresource.alias(exact match).A GAT carrying an alias for a wildcard address is rejected at token validation, so an alias always maps to a concrete upstream address.