Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

need to redeploy regularly every few months, it seems the key ids change in jwks.json #18

Closed
hubsi opened this issue Jul 11, 2022 · 2 comments

Comments

@hubsi
Copy link

hubsi commented Jul 11, 2022

Getting this error every few months needing to redeploy:
stderr | 598a88bc | thread 'main' panicked at 'called Option::unwrap() on a None value', src/jwt.rs:25:10
stderr | 598a88bc | note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
stderr | 598a88bc | {"diagnostic":"instance_error","error":"entered_unreachable","trap":{"trap_code":"wasm unreachable instruction executed","i32_exit_status":null,"display_reason":"wasm trap: wasm unreachable instruction executed"}}

It appears that this is caused by a change of the kid fields in jwks.json leading to a None value after filtering for the (renamed) key_id

Is there a possibility to refresh the jwks.json on a regular basis from the jwks_uri instead of deploying it statically into the well-known folder?

@timwisbauer-contsec
Copy link

This seems to happen because the jwks.json file contains public keys for the OIDC provider and are built into the package by the build process. See: https://github.com/fastly/compute-rust-auth/blob/main/src/config.rs#L71

However, these keys are regularly rotated by many providers such as Okta: https://developer.okta.com/docs/concepts/key-rotation/ and tokens can no longer be validated. Okta warns against doing this

Caution: Keys used to sign tokens automatically rotate and should always be resolved dynamically against the published JWKS. Your app might fail if you hardcode public keys in your applications. Be sure to include key rollover in your implementation.

It'd be ideal if the keys could be looked up just before validation to avoid needing to rebuild and deploy the function periodically.

@doramatadora
Copy link
Contributor

Apologies for taking so long to address this properly. v0.4.0 (#39) uses secret store and config store–both now in general availability for Fastly Compute–to decouple configuration from code. This means you can now rotate keys separately from deployments of the service.

Sorry again, we try to do better :)

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

No branches or pull requests

3 participants