Repository navigation
OAuth2 filter: Optimize HMAC encoding - #28867
Conversation
Signed-off-by: Ronnie Personal <[email protected]>
|
Hi @Ronnie-personal, welcome and thank you for your contribution. We will try to review your Pull Request as quickly as possible. In the meantime, please take a look at the contribution guidelines if you have not done so already. |
Signed-off-by: Ronnie Personal <[email protected]>
Signed-off-by: Ronnie Personal <[email protected]>
|
Hi @htuch I have configured the Visual Studio Code Dev Container based on the guide at https://github.com/envoyproxy/envoy/blob/main/tools/vscode/README.md. Thanks. |
Signed-off-by: Ronnie Personal <[email protected]>
Signed-off-by: Ronnie Personal <[email protected]>
|
I'm not super familiar with the VS Code flow, I tend to use vim :) That said, you can definitely run tests via Bazel locally. Maybe you are missing a Bazel plugin for VS Code? |
Signed-off-by: Ronnie Personal <[email protected]>
Signed-off-by: Ronnie Personal <[email protected]>
Signed-off-by: Ronnie Personal <[email protected]>
Signed-off-by: Ronnie Personal <[email protected]>
Signed-off-by: Ronnie Personal <[email protected]>
|
@htuch Thanks. |
|
Since you are a new contributor, CI requires a maintainer to kick off the CI. I pushed the button :) |
|
This change is user visible, i.e. it modifies Envoy's behavior in a way that can potentially break some users. In this case we use runtime features to allow switching back to the old behavior in case some Envoy operator was impacted by this change. Please add a new runtime feature to switch back to the old behavior. See PR #27974 for example on how to do it. /wait |
Thanks for the review! I will look into the runtime features. |
Signed-off-by: Ronnie Personal <[email protected]>
Signed-off-by: Ronnie Personal <[email protected]>
Signed-off-by: Ronnie Personal <[email protected]>
Signed-off-by: Ronnie Personal <[email protected]>
Signed-off-by: Ronnie Personal <[email protected]>
Signed-off-by: Ronnie Personal <[email protected]>
Thanks for the review.
|
| absl::Base64Escape(Hex::encode(crypto_util.getSha256Hmac(secret, hmac_payload)), &encoded_hmac); | ||
| return encoded_hmac; | ||
| if (Runtime::runtimeFeatureEnabled("envoy.reloadable_features.hmac_hex_encoding_only")) { | ||
| return Hex::encode(crypto_util.getSha256Hmac(secret, hmac_payload)); |
There was a problem hiding this comment.
Hex will take two characters for each byte while Base64 takes 4 characters for every 3 bytes, so it should be more efficient to just use base64. Wdyt?
There was a problem hiding this comment.
I agree, we can go with Base64.
There was a problem hiding this comment.
Do you have any guidance on 'respecting the token of the old format'?
I can update the OAuth2 filter validator to accept both 'base64' and 'hex+base64'. However, how do we disable this behavior when the user no longer needs this backward compatibility?
There was a problem hiding this comment.
I agree accepting the old token is a good idea. What we may be able to do is to accept the base64+hex token and set-cookie with the new token. This way when this backward compatibility is not required and becomes the default behaviour we can remove the runtime guard safely. There may be better ideas, but this seems simple enough.
Signed-off-by: Ronnie Personal <[email protected]>
Signed-off-by: Ronnie Personal <[email protected]>
Signed-off-by: Ronnie Personal <[email protected]>
Signed-off-by: Ronnie Personal <[email protected]>
Signed-off-by: Ronnie Personal <[email protected]>
Signed-off-by: Ronnie Personal <[email protected]>
Thanks, I'm fixing it right now. |
Signed-off-by: Ronnie Personal <[email protected]>
Signed-off-by: Ronnie Personal <[email protected]>
Co-authored-by: tony-2023 <[email protected]> Signed-off-by: Ronnie Personal <[email protected]>
Signed-off-by: Ronnie Personal <[email protected]>
|
The pipeline failed with '##[error]We stopped hearing from agent i-060b64c3735e1bae4. Verify the agent machine is running and has a healthy network connection. Anything that terminates an....' Shall I rerun the pipeline? |
|
/retest |
|
@Ronnie-personal I've restarted CI, but there merge conflict that needs resolving. |
|
/wait |
Thanks! I will resolve the conflict. |
Signed-off-by: Ronnie Personal <[email protected]>
|
After merging from the main branch, the pipeline failed with another error. This PR does not touch 'substitution_formatter_test.cc'. Here is the error: |
Signed-off-by: Ronnie Personal <[email protected]>
Commit Message: remove base64 encoding from OAuth2 HMAC cookie, apply hex encoding only.
Additional Description:
Risk Level: Low
Testing:
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
Fixes #28728
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]