rustls / rustls/rustls-platform-verifier
Could we cache `rustls-native-certs::load_native_certs()`?
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 158
- Forks
- 60
- Avg merge
- 5d 10h
- Merged PRs (30d)
- 3
Description
When creating a new verifier, on certain OSs, rustls_native_certs::load_native_certs is called, which is documented to be potentially expensive, since it probes for certificates, and loads each file.
Would it be possible to cache the result (static LazyLock), and ideally expose a function to initialize the cache?
/// ## Caveats
///
/// This function can be expensive: on some platforms it involves loading
/// and parsing a ~300KB disk file. It's therefore prudent to call
/// this sparingly.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in rustls-platform-verifier/src/verification/others.rs at the referenced call to rustls_native_certs::load_native_certs(), then read how new verifiers reach it. Determine how the result can be cached and how an initialization function should be exposed. Done means repeated verifier creation reuses the cached result and the requested initializer is available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- security
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100