Skip to content

fix: validate SDS URL - #9030

Merged
zirain merged 9 commits into
envoyproxy:mainfrom
zirain:fix/sds-uds-scheme
Jul 27, 2026
Merged

fix: validate SDS URL#9030
zirain merged 9 commits into
envoyproxy:mainfrom
zirain:fix/sds-uds-scheme

Conversation

@zirain

@zirain zirain commented May 19, 2026

Copy link
Copy Markdown
Member

fixes: #9018

@zirain
zirain requested a review from a team as a code owner May 19, 2026 06:02
@netlify

netlify Bot commented May 19, 2026

Copy link
Copy Markdown

Deploy Preview for cerulean-figolla-1f9435 ready!

Name Link
🔨 Latest commit d9b806e
🔍 Latest deploy log https://app.netlify.com/projects/cerulean-figolla-1f9435/deploys/6a5f7010dc600100083283fd
😎 Deploy Preview https://deploy-preview-9030--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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e5fcdb4439

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread internal/utils/net/url.go
@codecov

codecov Bot commented May 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.43478% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.58%. Comparing base (2874485) to head (d9b806e).
⚠️ Report is 27 commits behind head on main.

Files with missing lines Patch % Lines
internal/xds/translator/sds.go 76.47% 2 Missing and 2 partials ⚠️
internal/xds/translator/listener.go 0.00% 3 Missing ⚠️
internal/ir/xds.go 77.77% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9030      +/-   ##
==========================================
- Coverage   75.59%   75.58%   -0.01%     
==========================================
  Files         252      253       +1     
  Lines       41713    41744      +31     
==========================================
+ Hits        31531    31552      +21     
- Misses       8057     8066       +9     
- Partials     2125     2126       +1     

☔ View full report in Codecov by Harness.
📢 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.

# /var/run/secrets/workload-spiffe-uds/socket
url: L3Zhci9ydW4vc2VjcmV0cy93b3JrbG9hZC1zcGlmZmUtdWRzL3NvY2tldA==
# unix:///var/run/secrets/workload-spiffe-uds/socket
url: dW5peDovLy92YXIvcnVuL3NlY3JldHMvd29ya2xvYWQtc3BpZmZlLXVkcy9zb2NrZXQ=

@zhaohuabing zhaohuabing May 27, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This would break upgrades from v1.8.0 to v1.9.0. Would it make sense to default to UDS for url without scheme?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

it's experimental, it should be fine.
I'm fine to add compatibility in v1.9, cc @envoyproxy/gateway-maintainers WDYT?

@zhaohuabing zhaohuabing May 28, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If this breaking change is acceptable, it's better to cp this into v1.8.1 to break early.

@zhaohuabing

Copy link
Copy Markdown
Member

internal/utils/net/url.go (line 25) accepts unix://host/path values but silently drops the host by returning only u.Path. For example unix://var/run/app.sock becomes /run/app.sock, which can point Envoy at the wrong socket while still passing validation. The validator should reject non-empty u.Host for unix URLs, or normalize it intentionally with tests.

@zirain

zirain commented Jun 3, 2026

Copy link
Copy Markdown
Member Author

is unix://var/run/app.sock valid? should it be unix:///var/run/app.sock?

@zirain
zirain force-pushed the fix/sds-uds-scheme branch from e413ba5 to 30e5b8d Compare June 3, 2026 04:32
@zhaohuabing

Copy link
Copy Markdown
Member

unix:///var/run/secrets/workload-spiffe-uds/socket

unix://var/run/app.sock shouldn't become /run/app.sock. Should we just reject unix://var/run/app.sock?

@zirain

zirain commented Jun 3, 2026

Copy link
Copy Markdown
Member Author

unix:///var/run/secrets/workload-spiffe-uds/socket

unix://var/run/app.sock shouldn't become /run/app.sock. Should we just reject unix://var/run/app.sock?

this should be rejected, the implement updated.

@zirain
zirain force-pushed the fix/sds-uds-scheme branch 2 times, most recently from c8fd664 to 29387ac Compare June 8, 2026 22:56
@zhaohuabing
zhaohuabing requested a review from a team June 11, 2026 13:33
arkodg
arkodg previously approved these changes Jun 11, 2026
zirain added 8 commits July 21, 2026 09:46
Signed-off-by: zirain <zirain2009@gmail.com>
Signed-off-by: zirain <zirain2009@gmail.com>
Signed-off-by: zirain <zirain2009@gmail.com>
Signed-off-by: zirain <zirain2009@gmail.com>
Signed-off-by: zirain <zirain2009@gmail.com>
Signed-off-by: zirain <zirain2009@gmail.com>
Signed-off-by: zirain <zirain2009@gmail.com>
Signed-off-by: zirain <zirain2009@gmail.com>
zhaohuabing
zhaohuabing previously approved these changes Jul 21, 2026

@zhaohuabing zhaohuabing left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. Thanks!

@zhaohuabing
zhaohuabing requested a review from a team July 21, 2026 03:51
@zhaohuabing

Copy link
Copy Markdown
Member
  1. (High — test regression) sds-invalid no longer tests what it claims. internal/gatewayapi/testdata/sds-invalid.in.yaml was not updated, so its sds-ref-1/sds-ref-2 secrets still use bare-path URLs (/var/run/secrets/workload-spiffe-uds/socket, no scheme). With the new validation those now fail at ParseURL before the checks the test was built for. The golden diff confirms it: every case's message changed from Multiple SDS reference secrets are not supported. / Cannot mix SDS reference secrets with other CA certificate types. to the URL-scheme error. So all three labeled cases ("multiple SDS", "mix with ConfigMap", "mix with Secret") now short-circuit on URL validation and those validation paths are no longer exercised.
    → Update sds-invalid.in.yaml to give the SDS secrets valid unix://… URLs so the multiple/mixing logic is still covered, and add a separate case for the invalid-URL error.

  2. (Medium — compat / release-note framing) This rejects a previously-accepted format. The valid test (sds.in.yaml) and the invalid test both used bare paths before, so bare-path SDS URLs were the prior norm — they're now hard-rejected. If SDS-via-secret shipped in any release before this, that's a breaking change for existing secrets, and the release note (filed under bug_fixes, "added validation … instead of silently producing an invalid socket address") doesn't mention that bare paths stop working. Please confirm the feature is unreleased (same release as chore: add e2e for SDS Ref #8983); if not, call out the migration or accept bare paths as unix://.

Signed-off-by: zirain <zirain2009@gmail.com>
@zhaohuabing
zhaohuabing requested a review from a team July 24, 2026 07:54

@arkodg arkodg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM thanks
non blocking: does the IR validation failure error trickle into resource status to let the user know of the issue ?

@zirain
zirain merged commit 7f980e6 into envoyproxy:main Jul 27, 2026
63 of 65 checks passed
@zirain
zirain deleted the fix/sds-uds-scheme branch July 27, 2026 12:27
muwaqar-cflt added a commit to muwaqar/gateway that referenced this pull request Jul 27, 2026
…envoyproxy#9184/envoyproxy#9030 SDS changes

main's new TLSRoute dynamic-resolver support referenced a destSettings
variable that doesn't exist on this branch, which renamed it to
allDs/backendClusterRefs earlier in this branch's own history. git's 3-way
merge combined the two without a textual conflict, silently producing
code that failed to compile. Adapt the check to use allDs (a dynamic
resolver is never merge-eligible, so it can only appear there) while
counting both allDs and backendClusterRefs for the single-destination
requirement.

Signed-off-by: Muhammad Waqar <mwaqar@confluent.io>
muwaqar-cflt added a commit to muwaqar/gateway that referenced this pull request Jul 29, 2026
…envoyproxy#9184/envoyproxy#9030 SDS changes

main's new TLSRoute dynamic-resolver support referenced a destSettings
variable that doesn't exist on this branch, which renamed it to
allDs/backendClusterRefs earlier in this branch's own history. git's 3-way
merge combined the two without a textual conflict, silently producing
code that failed to compile. Adapt the check to use allDs (a dynamic
resolver is never merge-eligible, so it can only appear there) while
counting both allDs and backendClusterRefs for the single-destination
requirement.

Signed-off-by: Muhammad Waqar <mwaqar@confluent.io>
HusseinKabbout pushed a commit to HusseinKabbout/gateway that referenced this pull request Jul 30, 2026
* fix: add validation for SDS URL

Signed-off-by: zirain <zirain2009@gmail.com>

* fix

Signed-off-by: zirain <zirain2009@gmail.com>

* lint

Signed-off-by: zirain <zirain2009@gmail.com>

* fix test

Signed-off-by: zirain <zirain2009@gmail.com>

* reject UDS with host

Signed-off-by: zirain <zirain2009@gmail.com>

* fix lint

Signed-off-by: zirain <zirain2009@gmail.com>

* fix related path check

Signed-off-by: zirain <zirain2009@gmail.com>

* release notes

Signed-off-by: zirain <zirain2009@gmail.com>

* fix

Signed-off-by: zirain <zirain2009@gmail.com>

---------

Signed-off-by: zirain <zirain2009@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SDS: can we make sure unix scheme is used here to allow uds, how do we deal with this in other places of the API surface

3 participants