[BREAKING] feat/refactor/docs: multiple providers, large refactor, configurable ticking interval, fix for jwks endpoint has different host#99
Conversation
e6806c9 to
0d882e9
Compare
80e497e to
d94b6df
Compare
36c5896 to
818a32c
Compare
eb3e9de to
17ac0f4
Compare
* plugin can now have more than one oidc provider * the discovery will load information from all providers * user selects the provider on an auth page if there is >1 provider * more logs * more comments TODO: * error handling * performance and linting * large refactoring to file structure This is just a POC! THIS IS A BREAKING CHANGE! Signed-off-by: Anton Engelhardt <antoncengelhardt@icloud.com>
* add auth.rs for code flow * rename cookies.rs to session.rs * add pause.rs Signed-off-by: Anton Engelhardt <antoncengelhardt@icloud.com>
Signed-off-by: Anton Engelhardt <antoncengelhardt@icloud.com>
Signed-off-by: Anton Engelhardt <antoncengelhardt@icloud.com>
Signed-off-by: Anton Engelhardt <antoncengelhardt@icloud.com>
Signed-off-by: Anton Engelhardt <antoncengelhardt@icloud.com>
Signed-off-by: Anton Engelhardt <antoncengelhardt@icloud.com>
https://github.com/antonengelhardt/wasm-oidc-plugin/security/dependabot/5 Signed-off-by: Anton Engelhardt <antoncengelhardt@icloud.com>
Signed-off-by: Anton Engelhardt <antoncengelhardt@icloud.com>
| - name: Install cargo audit | ||
| run: cargo install cargo-audit | ||
|
|
Simplify discovery.rs a bit by removing some mutexes that are not strictly necessary. We do however need to work around proxy-wasm/proxy-wasm-rust-sdk#303 by using the hostcalls module (around which the HttpContext trait is just a trivial wrapper) directly
as defined by the OIDC spec: https://openid.net/specs/openid-connect-core-1_0.html#ClaimsParameter This avoids the need to escape quotes in the "stringly typed" JSON object and allows the map-type of the value to be validated during config parsing
and use anyhow
because that makes sense intuitively and fixes a bug which could lead to duplicate providers being created
While it would be nice to share these with the Root context, that would require some refactoring, so we don't currently do that and the Arc is unnecessary
There was a problem hiding this comment.
PR Summary
This PR introduces significant changes to support multiple OpenID Connect providers, including a new provider selection UI with dark mode and improved error handling.
- Added new
open_id_configsarray in configuration files to support multiple OIDC providers with separate endpoints and settings - Changed WASM target from
wasm32-wasitowasm32-wasip1across all build configurations and documentation - Added configurable
ticking_interval_in_msandlogout_pathwith optionalend_session_endpointsupport - Introduced request ID tracking in logs and error pages for better debugging
- Upgraded Envoy from v1.29 to v1.31 in Docker configurations and fixed JWKS endpoint host issues
Note: The PR contains some potential issues with unwrap() calls in provider selection and artifact path mismatches between build target and upload paths that should be addressed.
💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!
24 file(s) reviewed, 24 comment(s)
Edit PR Review Bot Settings | Greptile
| @@ -116,7 +185,7 @@ jobs: | |||
| path: target/wasm32-wasi/release/wasm_oidc_plugin.wasm | |||
There was a problem hiding this comment.
logic: Path mismatch: Build uses wasm32-wasip1 target (line 179) but artifact upload looks for wasm32-wasi path. This will cause the artifact upload to fail.
| path: target/wasm32-wasi/release/wasm_oidc_plugin.wasm | |
| path: target/wasm32-wasip1/release/wasm_oidc_plugin.wasm |
| needs: [verify-project] | ||
|
|
There was a problem hiding this comment.
style: Build job only depends on verify-project and not on test/clippy/fmt jobs. This could allow builds with failing tests or linting issues.
| needs: [verify-project] | |
| needs: [verify-project, test, clippy, fmt] |
| authors = [ | ||
| "WWU Cloud Developer <cloud@uni-muenster.de>, Anton Engelhardt <antoncengelhardt@icloud.com>", | ||
| ] | ||
| description = "A Wasm-Pplugin for the Envoy Proxy written in Rust acting as an HTTP-Filter, that implements the OpenID Authorization Code Flow. Requests sent to the filter are checked for the presence of a valid session cookie. If the cookie is not present, the user is redirected to OpenID Provider to authenticate. After successful authentication, the user is redirected back to the original path with the autorization code in the URL query. The plugin then exchanges the code for a token using the token_endpoint and stores the token in the session." |
There was a problem hiding this comment.
syntax: Typo in description: 'Wasm-Pplugin' should be 'Wasm plugin'
| description = "A Wasm-Pplugin for the Envoy Proxy written in Rust acting as an HTTP-Filter, that implements the OpenID Authorization Code Flow. Requests sent to the filter are checked for the presence of a valid session cookie. If the cookie is not present, the user is redirected to OpenID Provider to authenticate. After successful authentication, the user is redirected back to the original path with the autorization code in the URL query. The plugin then exchanges the code for a token using the token_endpoint and stores the token in the session." | |
| description = "A Wasm plugin for the Envoy Proxy written in Rust acting as an HTTP-Filter, that implements the OpenID Authorization Code Flow. Requests sent to the filter are checked for the presence of a valid session cookie. If the cookie is not present, the user is redirected to OpenID Provider to authenticate. After successful authentication, the user is redirected back to the original path with the autorization code in the URL query. The plugin then exchanges the code for a token using the token_endpoint and stores the token in the session." |
| authors = [ | ||
| "WWU Cloud Developer <cloud@uni-muenster.de>, Anton Engelhardt <antoncengelhardt@icloud.com>", | ||
| ] | ||
| description = "A Wasm-Pplugin for the Envoy Proxy written in Rust acting as an HTTP-Filter, that implements the OpenID Authorization Code Flow. Requests sent to the filter are checked for the presence of a valid session cookie. If the cookie is not present, the user is redirected to OpenID Provider to authenticate. After successful authentication, the user is redirected back to the original path with the autorization code in the URL query. The plugin then exchanges the code for a token using the token_endpoint and stores the token in the session." |
There was a problem hiding this comment.
syntax: Typo in description: 'autorization' should be 'authorization'
| description = "A Wasm-Pplugin for the Envoy Proxy written in Rust acting as an HTTP-Filter, that implements the OpenID Authorization Code Flow. Requests sent to the filter are checked for the presence of a valid session cookie. If the cookie is not present, the user is redirected to OpenID Provider to authenticate. After successful authentication, the user is redirected back to the original path with the autorization code in the URL query. The plugin then exchanges the code for a token using the token_endpoint and stores the token in the session." | |
| description = "A Wasm-Pplugin for the Envoy Proxy written in Rust acting as an HTTP-Filter, that implements the OpenID Authorization Code Flow. Requests sent to the filter are checked for the presence of a valid session cookie. If the cookie is not present, the user is redirected to OpenID Provider to authenticate. After successful authentication, the user is redirected back to the original path with the authorization code in the URL query. The plugin then exchanges the code for a token using the token_endpoint and stores the token in the session." |
| logo.style.visibility = 'hidden'; | ||
| setTimeout(() => {{ | ||
| logo.style.visibility = 'visible'; | ||
| }}, 0); | ||
| }}); |
There was a problem hiding this comment.
style: The visibility toggle hack could cause flickering. Consider using CSS transitions or opacity instead
|
|
||
| Ok(values) | ||
| } | ||
| proxy_wasm::set_log_level(LogLevel::Debug); |
There was a problem hiding this comment.
style: Setting log level to Debug in production could impact performance and expose sensitive information
| 307, | ||
| vec![ | ||
| // Redirect to the requested path | ||
| ("location", self.original_path.as_ref().unwrap()), |
There was a problem hiding this comment.
logic: unwrap on original_path could panic if None - should handle this case gracefully
| ("location", self.original_path.as_ref().unwrap()), | |
| ("location", self.original_path.as_ref().unwrap_or(&"/".to_string())), |
| let num_parts = cookie_values.len(); | ||
| let num_parts_cookie_value = format!("{cookie_name}-parts={num_parts}; Path=/; HttpOnly; Secure; Max-Age={cookie_duration}; "); | ||
| cookie_values.push(num_parts_cookie_value); |
There was a problem hiding this comment.
style: The trailing space in the cookie value format string could cause issues with some browsers or proxies
| let nonce_cookie_value = format!( | ||
| "{}-nonce={}; Path=/; HttpOnly; Secure; Max-Age={}; ", | ||
| cookie_name, &encoded_nonce, cookie_duration | ||
| ); |
There was a problem hiding this comment.
style: The trailing space in the nonce cookie format string could cause issues with some browsers or proxies
Signed-off-by: Anton Engelhardt <antoncengelhardt@icloud.com>
Signed-off-by: Anton Engelhardt <antoncengelhardt@icloud.com>
Signed-off-by: Anton Engelhardt <antoncengelhardt@icloud.com>
Signed-off-by: Anton Engelhardt <antoncengelhardt@icloud.com>
Signed-off-by: Anton Engelhardt <antoncengelhardt@icloud.com>
Signed-off-by: Anton Engelhardt <antoncengelhardt@icloud.com>
Signed-off-by: Anton Engelhardt <antoncengelhardt@icloud.com>
Signed-off-by: Anton Engelhardt <antoncengelhardt@icloud.com>
Signed-off-by: Anton Engelhardt <antoncengelhardt@icloud.com>
Signed-off-by: Anton Engelhardt <antoncengelhardt@icloud.com>
…-open-id-providers Signed-off-by: Anton Engelhardt <antoncengelhardt@icloud.com>
…iders Signed-off-by: Anton Engelhardt <antoncengelhardt@icloud.com>
Signed-off-by: Anton Engelhardt <antoncengelhardt@icloud.com>
Signed-off-by: Anton Engelhardt <antoncengelhardt@icloud.com>
Signed-off-by: Anton Engelhardt <antoncengelhardt@icloud.com>
Signed-off-by: Anton Engelhardt <antoncengelhardt@icloud.com>
Signed-off-by: Anton Engelhardt <antoncengelhardt@icloud.com>
Signed-off-by: Anton Engelhardt <antoncengelhardt@icloud.com>
Please describe your changes and why you made them
Multiple OpenID providers
_wasm-oidc-plugin/provider-selection?authorize_with_provider=wwu&return_to=lw), which then redirect to theauthorization_endpoint, because otherwise we would not be able to know which server sent the code in the code callback.Small features
ticking_interval_in_ms)Refactor & fixes
jwks_uriexposed at a different host than the openid-configuration host:schemeto parseurlas in fix(exclude): get scheme to parse url, more debug logs and yaml fmt #98Does this PR introduce a breaking change?
Warning
This PR introduces a breaking change:
Please see
envoy.yamlfor the updated config structureTODOs
Other information and Screenshots (if appropriate)
🤫 It has darkmode
Linked
For #93
more to come