Repository navigation
make the SAMLSSOResponseValidator replay check atomic - #3625
Conversation
SAMLSSOResponseValidator.validateSubjectConfirmation guarded a POST binding assertion against replay with contains() followed by putId() on the TokenReplayCache, so concurrent submissions of the same captured response all passed the lookup before any of them was cached, and were all accepted. Add TokenReplayCache.putIdIfAbsent, backed by the atomic putIfAbsent of Ehcache and JCache (with a synchronized default for custom caches), and use it in the validator. This is the JAX-RS SAML SSO counterpart of the WS-Security JCacheReplayCache change in apache#3622.
|
@rootvector2 isn't it the same as #3622 ? (CC @coheigea )? |
|
Not the same code path. #3622 only touched the WS-Security |
…to the cache concurrency test
* make the SAMLSSOResponseValidator replay check atomic SAMLSSOResponseValidator.validateSubjectConfirmation guarded a POST binding assertion against replay with contains() followed by putId() on the TokenReplayCache, so concurrent submissions of the same captured response all passed the lookup before any of them was cached, and were all accepted. Add TokenReplayCache.putIdIfAbsent, backed by the atomic putIfAbsent of Ehcache and JCache (with a synchronized default for custom caches), and use it in the validator. This is the JAX-RS SAML SSO counterpart of the WS-Security JCacheReplayCache change in #3622. * reject null and empty ids in the default putIdIfAbsent, add timeouts to the cache concurrency test (cherry picked from commit d27cfb0)
* make the SAMLSSOResponseValidator replay check atomic SAMLSSOResponseValidator.validateSubjectConfirmation guarded a POST binding assertion against replay with contains() followed by putId() on the TokenReplayCache, so concurrent submissions of the same captured response all passed the lookup before any of them was cached, and were all accepted. Add TokenReplayCache.putIdIfAbsent, backed by the atomic putIfAbsent of Ehcache and JCache (with a synchronized default for custom caches), and use it in the validator. This is the JAX-RS SAML SSO counterpart of the WS-Security JCacheReplayCache change in #3622. * reject null and empty ids in the default putIdIfAbsent, add timeouts to the cache concurrency test (cherry picked from commit d27cfb0)
|
Thanks for the review and merge, glad the SSO side is covered too. |
SAMLSSOResponseValidator.validateSubjectConfirmationreplay-checks a POST binding assertion with a non-atomiccontainsthenputIdon theTokenReplayCache, so concurrent submissions of one captured response all pass the lookup before any of them is cached and are all accepted (reproducer: 8 concurrent submissions of the same assertion id, accepted 8 times against bothEHCacheTokenReplayCacheandJCacheTokenReplayCache), found while reviewing the JAX-RS SAML SSO side of #3622, and fixed by addingTokenReplayCache.putIdIfAbsentbacked by the atomicputIfAbsentof Ehcache and JCache (synchronized default for custom caches) and using it in the validator, with regression tests for both caches and the validator.