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

Move certificate cache into new package #12367

Merged
merged 3 commits into from
Oct 12, 2023

Conversation

markylaing
Copy link
Contributor

For #12313 we need to access the certificate cache from the auth package for the TLS driver. While making this change I also noticed that the certificate cache is not strictly thread safe since the certificates and projects are stored in maps. E.g. It would be possible to get the certificate map within a lock, unlock it, then read/write from/to the map and cause a panic. Additionally, here the length of the certificate map is read without a lock which is may be thread safe but could also be a race condition.

This PR moves the certificate cache logic into a new package and adds methods for writing/reading from it safely. The returns maps are copies.

Copy link
Member

@tomponline tomponline left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks!

@markylaing markylaing self-assigned this Oct 11, 2023
@markylaing markylaing merged commit 35860e8 into canonical:main Oct 12, 2023
25 checks passed
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