Repository navigation
fix: isolate in-memory key store per container - #83
Merged
Merged
Conversation
System.Security.Cryptography.Xml/Pkcs 10.0.12 (pulled by 10.0.0) have high severity advisories. Pin the patched versions per TFM (8.0.5/8.0.2, 9.0.23, 10.0.15) and bump the Microsoft.* packages to the latest patch of each line (8.0.34, 9.0.23, 10.0.15). The PR vulnerability check now ignores only the accepted IdentityServer4 advisory (ADR-002).
PersistKeysInMemory kept the keys in a static list, so every host in the same process (e.g. parallel integration tests) shared and overwrote the same keys. The store is now a singleton with an instance list guarded by a lock, so scopes of one application still share keys and different service providers don't.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
PersistKeysInMemory()stored keys in a staticList<KeyMaterial>. Every host in the same process shared the same keys: two apps (or parallel integration tests, as seen in NetDevPack.Identity) overwrote and validated against each other's keys. TheSemaphoreSlimwas per instance while the list was static, so writes weren't really synchronized either.Fix
InMemoryStorekeeps an instance list guarded by alock.PersistKeysInMemory()registers it as a singleton: scopes of the same application still share keys (same behaviour as before inside one app), different service providers no longer do.docs/Architecture/Stores.mdupdated.Tests
InMemoryStoreIsolationTests: two service providers don't share keys (fails on the old code), and scopes of one provider do.Releases as 10.0.1 (
fix:).