feat(jwt-asm): support AWS Secrets Manager for JWT verification#3763
Conversation
96a9a29 to
f6e67af
Compare
|
I have also added a temporary GH Actions Workflow to test the nightly job in this PR and removed it: |
AWS Secrets Manager Bearer Auth E2E Test ScriptThis commit adds an e2e test script ( How It Works
Flags for Local Iteration
Test Cases
Key validations:
Raw Test Logs - LocalStack (click to expand) |
a47a331 to
e0b418e
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3763 +/- ##
==========================================
+ Coverage 91.60% 91.63% +0.02%
==========================================
Files 189 190 +1
Lines 26932 27040 +108
==========================================
+ Hits 24672 24778 +106
- Misses 1460 1462 +2
Partials 800 800 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
04c599b to
a1b9cba
Compare
|
Edit: Go script removed. About the binary size increase, this time it's tiny: 1.8% |
There was a problem hiding this comment.
Pull request overview
This PR adds support for loading JWT bearer verification keys from AWS Secrets Manager, enables JWKS-based public keys for bearer auth, and wires this into the bearer auth middleware plus CI E2E coverage.
Changes:
- Extend auth configuration and bearer auth wiring to support AWS Secrets Manager as a dynamic source of JWT verification keys, alongside static certs.
- Introduce
AWSSecretsManagerAuthorizerplus JWKS-aware key loading, refactorBearerAuthorizerto use a context-aware key callback, and add comprehensive unit tests (including Ed25519/JWKS scenarios). - Add a
jwt-signhelper, an AWS Secrets Manager bearer-auth E2E script (LocalStack or real AWS), documentation, and a new nightly workflow job.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
pkg/api/config/config.go |
Adds AWSSecretsManagerConfig and related helpers so bearer auth can be configured to load verification keys from AWS Secrets Manager. |
pkg/api/bearer.go |
Refactors BearerAuthorizer to use a BearerAuthorizerKeyFunc with context.Context, enabling dynamic key lookup (including from AWS Secrets Manager) and JWKS-based verification. |
pkg/api/authn.go |
Integrates the new AWS Secrets Manager authorizer and JWKS-aware key loading into the bearer-auth middleware, enforces mutual exclusivity between cert and awsSecretsManager, and passes request contexts into BearerAuthorizer. |
pkg/api/bearer_aws_secrets_manager.go |
Implements AWSSecretsManagerAuthorizer, encapsulating config validation, AWS SDK client construction, key retrieval/caching, and kid-based key selection. |
pkg/api/bearer_test.go |
Updates bearer tests to the new context-aware key func, and adds Ed25519/JWKS tests (including a pre-signed external token) to validate JWKS support. |
pkg/api/bearer_aws_secrets_manager_test.go |
Provides unit tests and end-to-end tests for AWS Secrets Manager integration, covering config validation, caching, JWKS vs PEM parsing, error propagation, and end-to-end bearer auth with kid selection. |
examples/jwt-sign/main.go |
Adds a small CLI to sign Ed25519 JWTs from a JWKS payload, producing tokens with the access claim structure expected by BearerAuthorizer. |
examples/aws-secrets-manager-bearer-auth.sh |
Adds an E2E script that provisions a secret in AWS Secrets Manager (or LocalStack), starts Zot configured for ASM-backed bearer auth, signs tokens, and validates push/pull flows with crane. |
examples/README-AWS-SECRETS-MANAGER-BEARER-AUTH.md |
Documents how to configure Zot for AWS Secrets Manager-based JWT verification, secret formats (PEM and JWKS), key rotation, IAM permissions, and troubleshooting. |
.github/workflows/nightly.yaml |
Adds a nightly job that runs the new AWS Secrets Manager bearer-auth E2E script, ensuring this integration remains healthy in CI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
a1b9cba to
831181f
Compare
|
@rchincha Can you please retrigger the two red test jobs? I'm not sure it's related |
604d7d0 to
f0ab21d
Compare
379d75a to
ee25a30
Compare
|
@matheuscscp the PR actually lgtm. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
ee25a30 to
26254e8
Compare
|
Thanks @rchincha! I have rebased and fixed one of copilot's comments 🙏 |
Closes: #3756
The e2e test uses LocalStack to run in CI. I also ran the script locally with the
--use-real-awsflag and it works: