-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Align NimbusJwtDecoder HTTP timeout defaults with Nimbus by setting to 500ms #17669
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @frido37, for the PR! I've left some feedback inline.
oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/NimbusJwtDecoder.java
Outdated
Show resolved
Hide resolved
oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/NimbusJwtDecoder.java
Outdated
Show resolved
Hide resolved
oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/NimbusJwtDecoder.java
Outdated
Show resolved
Hide resolved
This is a note for myself: As part of merging, upgrade instructions should be added to the 6.5 guide for how to update an application's configuration to use the new timeout values. In this way, they can know whether the new timeouts will be an issue before updating to 7.0. |
Thanks for the feedback. I Resolved it with the second commit. |
Thanks, @frido37. Will you please squash your commits and then we can merge it? In the future, if you publish a PR on a branch instead of Please also change your commit to the following title and description:
|
Issue spring-projectsgh-14269 Signed-off-by: Fridolin Jackstadt <[email protected]>
I’ve squashed the commits and updated the commit message. Let me know if anything else is needed. |
Summary
This change proposes a potential fix for spring-security#15866, which we encountered in a production environment.
Problem
We experienced a critical "stop-the-world" event lasting approximately 15 minutes due to the absence of connection and read timeouts in the default RestTemplate configuration used by NimbusJwtDecoder. Specifically, the underlying SimpleClientHttpRequestFactory does not define any timeouts, which can cause the application to hang indefinitely in certain network failure scenarios.
Current Workaround
To mitigate this in our own application, we use a JwkSetUriJwtDecoderBuilderCustomizer to configure the RestTemplate with appropriate timeouts. While this works, the current default behavior is problematic and may impact other users as well.
Proposal
We suggest that reasonable default timeouts (both connect and read) should be applied to the RestTemplate used by default in NimbusJwtDecoder. This change will help prevent similar problems for others.