Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

Merge upstream main into fix/non-ascii-input-panics

M3gA-Mind2baecc72737b
diff --cc crates/openhuman-core/src/security/secret_storage/crypto_tests.rs
index f716d13e72,0000000000..bc598e4308
mode 100644,000000..100644
--- a/crates/openhuman-core/src/security/secret_storage/crypto_tests.rs
+++ b/crates/openhuman-core/src/security/secret_storage/crypto_tests.rs
@@@ -1,39 -1,0 +1,9 @@@
+use super::*;
+
- #[test]
- fn roundtrip_encrypt_decrypt() {
- let key = [42u8; KEY_LEN];
- let plaintext = b"hello world";
- let blob = chacha20_encrypt(&key, plaintext).unwrap();
- let decrypted = chacha20_decrypt(&key, &blob).unwrap();
- assert_eq!(decrypted, plaintext);
- }
-
- #[test]
- fn decrypt_wrong_key_fails() {
- let key1 = [1u8; KEY_LEN];
- let key2 = [2u8; KEY_LEN];
- let blob = chacha20_encrypt(&key1, b"secret").unwrap();
- assert!(chacha20_decrypt(&key2, &blob).is_err());
- }
-
- #[test]
- fn decrypt_short_blob_fails() {
- let key = [0u8; KEY_LEN];
- assert!(chacha20_decrypt(&key, &[0u8; NONCE_LEN]).is_err());
- }
-
- #[test]
- fn hex_roundtrip() {
- let data = vec![0xde, 0xad, 0xbe, 0xef];
- assert_eq!(hex_encode(&data), "deadbeef");
- assert_eq!(hex_decode("deadbeef").unwrap(), data);
- }
-
+#[test]
+fn hex_decode_rejects_non_ascii_input_without_panicking() {
+ // Even byte length, but byte 2 falls inside 'é'.
+ let decoded = std::panic::catch_unwind(|| hex_decode("aéb"))
+ .expect("hex_decode panicked on non-ASCII input");
+ assert!(decoded.is_err());
+}