fix(security): handle few security issues#8
Open
seqre wants to merge 6 commits into
Open
Conversation
Some deserializing libraries embed the (secret) input in their error
messages. Drop the `{error}` interpolation from the three byte
deserialization paths so password fragments cannot leak via serde errors.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
`mlock` now returns whether the region was actually locked (it can fail, e.g. on RLIMIT_MEMLOCK). Each secure type stores an `is_locked` flag and only calls the paired `munlock` when locking succeeded, avoiding munlock on a region this type never locked. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The previous SecureArray stored `[T; LENGTH]` inline and mlocked the local before moving it into the returned value, so the lock applied to a stale address; any later move of the SecureArray relocated the bytes and left the lock behind. Wrap a `SecureBox<[T; LENGTH]>` instead so the data has a stable heap address and the mlock stays valid across moves. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
`unsecure_mut` returns a borrow of the secret; ignoring it is a no-op. Annotate it across SecureString, SecureVec, and SecureBox for parity with the already-annotated `unsecure`/`into_unsecure`. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Use `PhantomData` directly instead of `Default::default()` (default_trait_access) and elide the `'de` lifetime on the SecureStringVisitor Visitor impl (elidable_lifetime_names). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.