parallaxsecond / parallaxsecond/rust-cryptoki

AuthPin forces conversions that can leak secret

Open
#353 10 comments 0 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.