Skip to content

Fix token dictionary in authentication token cache to be concurrency r/w safe #336

Description

@akashsinghal

TryGetToken reads from CacheEntry.Tokens without taking the per-key lock, while SetCache mutates that Dictionary under the lock. Dictionary is not safe for concurrent read/write, so this can throw or corrupt state under concurrency. Consider synchronizing reads using the same per-key lock, or switching Tokens to a thread-safe/immutable structure (e.g., ConcurrentDictionary or replace the dictionary on updates).

Originally posted by @Copilot in #331 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions