google / google/native-pkcs11

macOS keychain thread safety

Open
#302 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
74
Forks
23
Avg merge
1d 14h
Merged PRs (30d)
3

Description

> In macOS, some of the functions of this API block while waiting for input from the user (for example, when the user is asked to unlock a keychain or give permission to change trust settings). In general, it is safe to use this API in threads other than your main thread, but avoid calling the functions from multiple operations, work queues, or threads concurrently. Instead, serialize function calls or confine them to a single thread.
>
> In iOS, all the functions in this API are thread-safe and reentrant.

From [Certificate, Key, and Trust Services / Working with Concurrency](https://developer.apple.com/documentation/security/certificate_key_and_trust_services/working_with_concurrency).

Currently macOS keychain calls are not serialized, which can cause failures during high load situations. This is mostly observed as test flakes.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the macOS keychain call sites and how concurrent operations reach them. Reproduce the high-load test flakes, then verify that keychain calls are serialized and that the affected tests pass reliably.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, rust
Domain
operating-systems, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.