Skip to content

feat: support BackendCluster for Remote JWKS - #5011

Merged
zhaohuabing merged 18 commits into
envoyproxy:mainfrom
zhaohuabing:jwks-custom-ca
Jan 17, 2025
Merged

zhaohuabing merged 18 commits into
envoyproxy:mainfrom
zhaohuabing:jwks-custom-ca

Conversation

@zhaohuabing

@zhaohuabing zhaohuabing commented Jan 6, 2025 •

Copy link
Copy Markdown
Member

This PR introduces support for representing JWT remote JWKS as Backend resources. With this enhancement, users can:

  • Specify a self-signed CA: use BackendTLSPolicy to define a self-signed CA for the remote JWKS
  • Configure retry policies: use rmoteJWKS.backendSettings.retry to sepecify the retry policy for the remote JWKS

Implements: #3536
Release Notes: Yes

@zhaohuabing
zhaohuabing requested a review from a team as a code owner January 6, 2025 09:03
@zhaohuabing
zhaohuabing marked this pull request as draft January 6, 2025 09:03
@codecov

codecov Bot commented Jan 6, 2025 •

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 76.33136% with 40 lines in your changes missing coverage. Please review.

Project coverage is 66.80%. Comparing base (8b89dad) to head (4cbf407).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
internal/gatewayapi/securitypolicy.go 78.94% 19 Missing and 9 partials ⚠️
internal/xds/translator/jwt.go 66.66% 8 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5011      +/-   ##
==========================================
- Coverage   66.84%   66.80%   -0.04%     
==========================================
  Files         211      210       -1     
  Lines       32916    32943      +27     
==========================================
+ Hits        22004    22009       +5     
- Misses       9586     9598      +12     
- Partials     1326     1336      +10     

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

@zhaohuabing zhaohuabing changed the title api feat: support Backend for Remote JWKS Jan 7, 2025
@zhaohuabing
zhaohuabing force-pushed the jwks-custom-ca branch 4 times, most recently from 00cf16b to 2a68252 Compare January 8, 2025 01:33

@zhaohuabing zhaohuabing Jan 8, 2025 •

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.

SecuritcyPolicy validation has been moved from the xds translation to the API translation. This change allows validation errors to be caught earlier and reflected in the SecurityPolicy status.

Signed-off-by: Huabing Zhao <[email protected]>
Signed-off-by: Huabing Zhao <[email protected]>
Signed-off-by: Huabing Zhao <[email protected]>
Signed-off-by: Huabing Zhao <[email protected]>
Signed-off-by: Huabing Zhao <[email protected]>
Signed-off-by: Huabing Zhao <[email protected]>
@zhaohuabing
zhaohuabing marked this pull request as ready for review January 8, 2025 01:48
@zhaohuabing zhaohuabing changed the title feat: support Backend for Remote JWKS feat: support BackendCluster for Remote JWKS Jan 8, 2025
Comment thread internal/gatewayapi/securitypolicy.go Resolved
case spec.ExtAuth != nil:
sum++
case spec.OIDC != nil:
sum++

@zhaohuabing zhaohuabing Jan 16, 2025 •

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.

Remove this empty spec check because other policy types don't do this check. We can apply the check to all the policy types through CEL in a follow-up PR if it's needed.

@@ -1,154 +0,0 @@
// Copyright Envoy Gateway Authors

@zhaohuabing zhaohuabing Jan 16, 2025 •

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.

This file was deleted from the API package and the validations have been moved into the gatewapi translator.

@zhaohuabing
zhaohuabing requested a review from arkodg January 16, 2025 01:29
Signed-off-by: Huabing Zhao <[email protected]>
Signed-off-by: Huabing Zhao <[email protected]>
Signed-off-by: Huabing Zhao <[email protected]>
Signed-off-by: Huabing Zhao <[email protected]>
Signed-off-by: Huabing Zhao <[email protected]>
@StephenRobin

Copy link
Copy Markdown
Contributor

@zhaohuabing Thank you for working on this! It's been blocking us from adopting Envoy Gateway and I'm looking forward to seeing this merged.

I notice this PR doesn't update the documentation, it would be good to see an example added there. Also for using OIDC with an internal certificate, it took me a couple of hours to work out how to do that.

@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 !

@arkodg
arkodg requested review from a team and removed request for sanposhiho January 16, 2025 22:30
@zhaohuabing

Copy link
Copy Markdown
Member Author

@StephenRobin

I notice this PR doesn't update the documentation, it would be good to see an example added there.

Will update the docs in a follow-up PR.

Also for using OIDC with an internal certificate, it took me a couple of hours to work out how to do that.

You can find an example for OIDC here: https://gateway.envoyproxy.io/docs/tasks/security/oidc/#connect-to-an-oidc-provider-with-self-signed-certificate

@zhaohuabing
zhaohuabing merged commit 75b2d84 into envoyproxy:main Jan 17, 2025
@zhaohuabing
zhaohuabing deleted the jwks-custom-ca branch January 17, 2025 11:05
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.

5 participants