parallaxsecond / parallaxsecond/rust-cryptoki
AuthPin forces conversions that can leak secret
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 115
- Forks
- 96
- Avg merge
- 22h 56m
- Merged PRs (30d)
- 2
Description
I have not experimented much with AuthPin but it is defined as SecretString, instead of just SecretBox, and this force callers that have a Vec into leaking conversion to a String.
Cryptoki never cares for using the pin as a string, all it does is to extract the String pointer as a *mut u8 to pass it to the pkcs11 token.
A better way to deal with AuthPin would be to make a trait and a default implementation.
The default implementation can probably use &str or String, but the trait would allow developers that already have a way to safely manage secret data to just return a slice of [u8] when needed.
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 by tracing AuthPin's use of SecretString and SecretBox through the Cryptoki PIN-handling path. Compare the current String-pointer conversion with the proposed trait and default implementation; done means callers can provide secret data as a byte slice without forcing a potentially leaking Vec-to-String conversion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cryptography, security
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100