Enforce Android lifecycle and presentation security (#100)
This commit is contained in:
1 parent
c0ba6d43d8
commit
a06f39af23
37 files changed
+1129
-110
No files matched your search
@@ -165,6 +165,28 @@ fn clearing_clipboard_never_reads_or_restores_previous_secrets() -> TestResult {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn immediate_copy_revocation_clears_only_matching_content() -> TestResult {
|
||||
let backend = MemoryClipboard::with_text(b"copied secret");
|
||||
let mut manager = ClipboardManager::new(backend.clone(), ClipboardTimeout::default());
|
||||
let secret = SecretBytes::new(b"copied secret".to_vec());
|
||||
assert_eq!(
|
||||
manager.clear_current_copy(&secret)?,
|
||||
ClipboardDisposition::Cleared
|
||||
);
|
||||
assert_eq!(backend.text(), None);
|
||||
backend.set_text(b"new user value");
|
||||
assert_eq!(
|
||||
manager.clear_current_copy(&secret)?,
|
||||
ClipboardDisposition::PreservedNewer
|
||||
);
|
||||
assert_eq!(
|
||||
backend.text().as_deref(),
|
||||
Some(b"new user value".as_slice())
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn clipboard_validation_and_cleanup_failures_are_typed_and_redacted() -> TestResult {
|
||||
assert_eq!(
|
||||
|
||||
Reference in new issue
Block a user