Repository navigation
fix(client): keep zone keys out of the debug output of a snapshot - #133
Merged
Merged
Conversation
Snapshot and ZoneSnapshot derived Debug and so printed every zone key
and record. Both now print counts and ids only. A test checks that {:?}
and {:#?} never show a key in hex, base64 or array form, or a record.
Password was Zeroizing<String>, whose Debug prints the contents under
zeroize 1.8 and Zeroizing { .. } under 1.9. It is now its own type that
wipes on drop and prints Password(..) whatever the zeroize version.
| format!("{:?}", Some(&password)), | ||
| format!("{:?}", vec![password.clone()]), | ||
| ] { | ||
| assert!(!text.contains(secret), "{text}"); |
| format!("{:?}", vec![password.clone()]), | ||
| ] { | ||
| assert!(!text.contains(secret), "{text}"); | ||
| assert!(!text.contains("horse"), "{text}"); |
| ] { | ||
| assert!(!text.contains(secret), "{text}"); | ||
| assert!(!text.contains("horse"), "{text}"); | ||
| assert!(text.contains("Password(..)"), "{text}"); |
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.
Summary
SnapshotandZoneSnapshotderivedDebugand printed every zone key and record. Both are now manual:Snapshotshows account, device and zone count;ZoneSnapshotshows key and record counts.{:?}and{:#?}of a snapshot (also nested, inOption, and the zones map) never contain a known zone key in hex, upper hex, base64 (std, url, padded or not) or array form, nor a record's text. Mutations (derive restored on either type) fail it.StoredIdentity,StoredSession,SecondFactorChallenge,PendingSignUp,SymmetricKey,RecoveryKeyalready manual;DeviceKeys,Engine,ApproverPairing,DevicePairing,SecondFactor,ApproverApproval,JoinedApprovalhave noDebug; the rest hold ids or public keys.Passwordis now its own type (orbyn_device_client::Password, inpassword.rs):new,as_str,as_bytes,is_empty,From<String>,Clone, wiped on drop,DebugprintsPassword(..)whatever zeroize version resolves (1.9 printsZeroizing { .. }, 1.8 prints the contents). API break: it was the aliasZeroizing<String>, so a host now builds it withPassword::new(text)instead ofZeroizing::new(text);SignUpRequest.password,sign_inandreauthenticatetake it unchanged otherwise. Re-export story:Passwordis the crate's own type,Zeroizingstays re-exported forStoredIdentityandSecondFactor; docs andsingle_crate.rsupdated.Local,Trashed,Quarantinedprint the cached record (content, not key material); the code insideSecondFactor::Codeis a bareZeroizing<String>butSecondFactorhas noDebug.Testing
{:?},{:#?}, inOptionand in aVecof aPasswordnever show the text; restoring a printingDebugfails it.Co-authors
none
AI usage
Checklist
docs/architecture.mdwith any rule change; generated wire types with any contract change