Skip to content

feat(translator): support ext-auth dynamic metadata options (Envoy to auth server)#6453

Closed
nareddyt wants to merge 8 commits intoenvoyproxy:mainfrom
nareddyt:ext-authz-dynamic-metadata
Closed

feat(translator): support ext-auth dynamic metadata options (Envoy to auth server)#6453
nareddyt wants to merge 8 commits intoenvoyproxy:mainfrom
nareddyt:ext-authz-dynamic-metadata

Conversation

@nareddyt
Copy link
Copy Markdown
Contributor

@nareddyt nareddyt commented Jul 2, 2025

What this PR does / why we need it:

Added support for specifying dynamic metadata namespaces that External Authorization services can access in SecurityPolicy API

This follows the structure and CRD naming conventions established in #5023.

NOTE: This PR only introduces fields for "sending metadata to ext-authz server". It does NOT handle the reverse operation of "parsing ext-authz HTTP headers and turning them into dynamic metadata on Envoy" (which #4163 was initially opened for). However, this PR structures the CRD changes in a way that allows for the reverse operation to be easily added.

Which issue(s) this PR fixes:
Not aware of any pre-existing issue describing this specific use case. #4163 is related but for the reverse operation.

Release Notes: Yes

nareddyt and others added 2 commits July 2, 2025 17:43
Signed-off-by: Teju Nareddy <tnareddy@confluent.io>
Signed-off-by: Teju Nareddy <tnareddy@confluent.io>
@nareddyt nareddyt requested a review from a team as a code owner July 2, 2025 15:48
…-authz-dynamic-metadata

Signed-off-by: Teju Nareddy <tnareddy@confluent.io>

# Conflicts:
#	release-notes/current.yaml
@codecov
Copy link
Copy Markdown

codecov Bot commented Jul 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.76%. Comparing base (64f3576) to head (e2bda53).
Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6453      +/-   ##
==========================================
+ Coverage   70.75%   70.76%   +0.01%     
==========================================
  Files         220      220              
  Lines       37757    37767      +10     
==========================================
+ Hits        26715    26727      +12     
+ Misses       9482     9479       -3     
- Partials     1560     1561       +1     

☔ 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.

@nareddyt nareddyt changed the title feat(translator): support ext-auth dynamic metadata options (read only) feat(translator): support ext-auth dynamic metadata options (Envoy --> server only) Jul 7, 2025
@nareddyt nareddyt changed the title feat(translator): support ext-auth dynamic metadata options (Envoy --> server only) feat(translator): support ext-auth dynamic metadata options (Envoy to auth server only) Jul 7, 2025
@nareddyt nareddyt changed the title feat(translator): support ext-auth dynamic metadata options (Envoy to auth server only) feat(translator): support ext-auth dynamic metadata options (Envoy to auth server) Jul 7, 2025
Copy link
Copy Markdown

@TheRushingWookie TheRushingWookie left a comment

Choose a reason for hiding this comment

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

Just a nit

@arkodg arkodg added this to the v1.5.0-rc.1 Release milestone Jul 7, 2025
Comment thread internal/xds/translator/testdata/in/xds-ir/ext-auth.yaml
Comment thread api/v1alpha1/ext_auth_types.go
Comment thread api/v1alpha1/ext_auth_types.go
Comment thread api/v1alpha1/ext_auth_types.go Outdated
Comment thread test/cel-validation/securitypolicy_test.go
Comment thread release-notes/current.yaml Outdated
nareddyt added 3 commits July 11, 2025 11:50
Signed-off-by: Teju Nareddy <tnareddy@confluent.io>
Signed-off-by: Teju Nareddy <tnareddy@confluent.io>
@nareddyt nareddyt requested a review from guydc July 11, 2025 10:14
@nareddyt
Copy link
Copy Markdown
Contributor Author

@guydc PTAL, addressed all review comments. Would like your input on our idea to expose both typed and untyped namespaces, as Confluent has a use case for typed namespaces

Signed-off-by: Teju Nareddy <tnareddy@confluent.io>
@nareddyt
Copy link
Copy Markdown
Contributor Author

/retest

guydc
guydc previously approved these changes Jul 11, 2025
Copy link
Copy Markdown
Contributor

@guydc guydc left a comment

Choose a reason for hiding this comment

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

LGTM.
Would be nice to extend the e2es to cover this feature, e.g. have grcp ext-auth consume metadata and add it to the request headers through the Check Response.

Signed-off-by: Teju Nareddy <tnareddy@confluent.io>
Comment thread examples/envoy-ext-auth/main.go
Comment thread test/e2e/tests/ext_auth_grpc_service.go
@nareddyt
Copy link
Copy Markdown
Contributor Author

LGTM. Would be nice to extend the e2es to cover this feature, e.g. have grcp ext-auth consume metadata and add it to the request headers through the Check Response.

Good idea, done. I tested static untyped route metadata in the e2e test. IMO there is no additional value is testing the other 3 fields (typed route metadata, typed + untyped listener metadata).

Copy link
Copy Markdown
Contributor

@guydc guydc left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for adding the e2e test.

@nareddyt
Copy link
Copy Markdown
Contributor Author

/retest

@arkodg
Copy link
Copy Markdown
Contributor

arkodg commented Jul 14, 2025

hey @nareddyt can we limit this feature to route metadata ?
filters in the data plane may map to different resources which are tied to different actors, so prefer avoiding it until we've thought through all the implications

@nareddyt
Copy link
Copy Markdown
Contributor Author

@arkodg we do have a few use cases at Confluent where we need to propagate filter metadata from other OSS filters. We had a similar discussion in #6453 (comment)

Are there any specific implications you are worried about? I can limit it to route metadata if really required, but then we can no longer use this feature and will still need an extension server modification.

@arkodg
Copy link
Copy Markdown
Contributor

arkodg commented Jul 14, 2025

would A CEL validtion be tricky be add for this case ?

  • allow filter metdata if target is Gateway, else dont

@nareddyt
Copy link
Copy Markdown
Contributor Author

would A CEL validtion be tricky be add for this case ?

  • allow filter metdata if target is Gateway, else dont

Just trying to understand what that would solve?

IIRC we have precedent for filter metadata in EnvoyExtensionPolicy via ExtProc. https://gateway.envoyproxy.io/docs/api/extension_types/#extprocmetadata . This supports untyped filter metadata. And ExtProc can target both a HTTPRoute or a Gateway.

I didn't see any sort of similar validations in ExtProc CRD, so just trying to understand if they are necessary.

@nareddyt
Copy link
Copy Markdown
Contributor Author

Just want to clear up some confusion: Envoy allows attaching xDS metadata to multiple resources, such as routes, clusters, listeners. Envoy filters also can modify per-request dynamic metadata.

The ext_authz callout should allow sending all these types of metadata, regardless of whether the SecurityPolicy is targeting a Gateway vs HTTPRoute. That should be orthogonal

@arkodg
Copy link
Copy Markdown
Contributor

arkodg commented Jul 15, 2025

Just want to clear up some confusion: Envoy allows attaching xDS metadata to multiple resources, such as routes, clusters, listeners. Envoy filters also can modify per-request dynamic metadata.

The ext_authz callout should allow sending all these types of metadata, regardless of whether the SecurityPolicy is targeting a Gateway vs HTTPRoute. That should be orthogonal

if a SecurityPolicy can target a Gateway its in the same namespace as the Gateway, and implies same persona is creating them.

Envoy Gateway does not gives direct access to xds filters, except in the EnvoyProxy resource to order xds filters which is applied at the Gateway level

There's ExtensionServer and EnvoyExtensionPolicy which is the back door enabled by the admin in the startup EnvoyGateway config

@nareddyt
Copy link
Copy Markdown
Contributor Author

Thanks @arkodg , I understand the concern now. Unfortunately this will not work for Confluent's use case. Let me close this PR and rethink it. Perhaps I will go with a custom extension server mutation on our end for the time being.

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.

6 participants