Skip to content

Fix(gatewayapi): allow mixed IP and UDS endpoints in backend route references#8530

Open
stekole wants to merge 5 commits intoenvoyproxy:mainfrom
stekole:fix/mixed-ip-uds-endpoints
Open

Fix(gatewayapi): allow mixed IP and UDS endpoints in backend route references#8530
stekole wants to merge 5 commits intoenvoyproxy:mainfrom
stekole:fix/mixed-ip-uds-endpoints

Conversation

@stekole
Copy link
Contributor

@stekole stekole commented Mar 16, 2026

What type of PR is this?
/kind bug

What this PR does / why we need it:
Backend resources with mixed IP and Unix Domain Socket (UDS) endpoints were incorrectly rejected as unsupported mixed address types. Additionally, UDS endpoints were blocked entirely in route backend references.

  • Classifies IP + UDS combinations as IP (static) instead of MIXED
  • Allows UDS endpoints in route Backend references
  • Only rejects MIXED when FQDN is involved with IP or UDS

Which issue(s) this PR fixes:
Fixes #8229

Release Notes: Yes

@stekole stekole requested a review from a team as a code owner March 16, 2026 03:32
@netlify
Copy link

netlify bot commented Mar 16, 2026

Deploy Preview for cerulean-figolla-1f9435 ready!

Name Link
🔨 Latest commit 90cc4f1
🔍 Latest deploy log https://app.netlify.com/projects/cerulean-figolla-1f9435/deploys/69c1fa50c4cfa800085f131b
😎 Deploy Preview https://deploy-preview-8530--cerulean-figolla-1f9435.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov
Copy link

codecov bot commented Mar 16, 2026

Codecov Report

❌ Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 74.37%. Comparing base (a049df2) to head (90cc4f1).

Files with missing lines Patch % Lines
internal/gatewayapi/listener.go 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8530      +/-   ##
==========================================
+ Coverage   74.35%   74.37%   +0.01%     
==========================================
  Files         242      242              
  Lines       37811    37808       -3     
==========================================
+ Hits        28113    28118       +5     
+ Misses       7748     7743       -5     
+ Partials     1950     1947       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@stekole stekole force-pushed the fix/mixed-ip-uds-endpoints branch 2 times, most recently from 5d23c9f to 32d38cb Compare March 17, 2026 10:33
}
case egv1a1.KindBackend:
if err := t.validateBackendRefBackend(backendRef.BackendObjectReference, resources, backendNamespace, false); err != nil {
if err := t.validateBackendRefBackend(backendRef.BackendObjectReference, resources, backendNamespace, true); err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC, we're find to remove the last one parameter from function validateBackendRefBackend.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense - Thanks - Addressed.

@stekole stekole force-pushed the fix/mixed-ip-uds-endpoints branch 2 times, most recently from 6f00c6d to 9d4545d Compare March 18, 2026 03:53
@stekole stekole requested a review from zirain March 19, 2026 02:51
@zirain
Copy link
Member

zirain commented Mar 19, 2026

is it possible to add an e2e test to ensure that a mixed backend worked as expected?

@stekole
Copy link
Contributor Author

stekole commented Mar 19, 2026

Yes - I can write something to validate the route is accepted (not rejected as "MIXED") and traffic flows through. If we want a full HTTP on UDS and serve traffic that may require additional containers and complexity.

I think ensuring the route is created is a good first step. Let me know if you'd like to see something else. We can discuss further or happy to address it in a follow-up.

zirain
zirain previously approved these changes Mar 19, 2026
stekole added 2 commits March 21, 2026 22:37
Fixes envoyproxy#8229

Signed-off-by: stekole <stefan@sandnetworks.com>
Fixes envoyproxy#8229

Signed-off-by: stekole <stefan@sandnetworks.com>
@stekole stekole force-pushed the fix/mixed-ip-uds-endpoints branch from b76668c to d648970 Compare March 22, 2026 02:37
@zirain
Copy link
Member

zirain commented Mar 22, 2026

/retest

stekole and others added 2 commits March 22, 2026 21:53
* For security reasons, Envoy Gateway MUST reject references to a `Backend` in xRoute resources. For example, UDS and
localhost references will not be supported for xRoutes.
* For security reasons, Envoy Gateway MUST reject localhost references to a `Backend` in xRoute resources.
Unix domain socket references are supported in xRoutes, but admins must ensure proper access controls.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how would admins ensure proper access control if app developers can route back into the proxy ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @guydc

Copy link
Contributor Author

@stekole stekole Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. I may not have all the answers but I will references a few things I know.

rbac on Backend resources - the docs already reference restricting who can create Backend CRs, consistent with guidance on CVE-2021-25740. An app developer without RBAC to create Backend resources can't reference UDS: https://github.com/envoyproxy/gateway/blob/main/site/content/en/latest/tasks/traffic/backend.md#L14-L21

UDS also requires a mounted socket in the proxy pod - UDS path in a Backend spec is a no-op unless the socketfile is actually present in the proxy pods filesystem. Mounting it requires an envoyproxy infrastructure patch, which is an admin resource that app developers shouldnt control.
ref: https://github.com/envoyproxy/gateway/blob/main/site/content/en/contributions/design/backend.md#L129-L131
Task doc: https://github.com/envoyproxy/gateway/blob/main/site/content/en/latest/tasks/traffic/backend.md#L37

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Signed-off-by: stekole <30674956+stekole@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mixed IP and UDS endpoints rejected

3 participants