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

Fix DPoPInterceptor thread-safety #1534

Conversation

clementdenis
Copy link
Contributor

Issue(s)

When ApiClient is used concurrently (either with a single or multiple instances) with DPoP enabled, it will eventually fail with an invalid ath DPoP claim error.
This is caused by the static MessageDigest in DPoPInterceptor not being thread safe, and returning invalid token hashes if used from multiple threads.

=> wrap the static field in a ThreadLocal to get an instance per thread.

Description

Category

  • Bugfix
  • Enhancement
  • New Feature
  • Library Upgrade
  • Configuration Change
  • Versioning Change
  • Unit or Integration Test(s)
  • Documentation

Signoff

  • I have submitted a CLA for this PR
  • Each commit message explains what the commit does
  • I have updated documentation to explain what my PR does
  • My code is covered by tests if required
  • I did not edit any automatically generated files

- MessageDigest is not thread-safe, wrap in a ThreadLocal
@arvindkrishnakumar-okta arvindkrishnakumar-okta changed the base branch from master to fix_dpop_thread_safety August 30, 2024 18:10
@arvindkrishnakumar-okta arvindkrishnakumar-okta merged commit 7605761 into okta:fix_dpop_thread_safety Aug 30, 2024
arvindkrishnakumar-okta added a commit that referenced this pull request Sep 3, 2024
- MessageDigest is not thread-safe, wrap in a ThreadLocal

Co-authored-by: Clément Denis <clement.denis@gmail.com>
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

Successfully merging this pull request may close these issues.

2 participants