[verified] sanitize peer chat/control/bidi before store and TUI render
Some checks failed
ci / test (pull_request) Failing after 2m2s

Strip C0 (except tab/newline), DEL, C1, and bidi/format marks at ingest
and render; keep ZWJ; lossy UTF-8 stays U+FFFD. Reject the same set in
fil names. Docs match the policy.
This commit is contained in:
Sirius DevOps 2026-09-11 23:42:48 -04:00
commit e3738c51f7
No known key found for this signature in database
9 changed files with 181 additions and 5 deletions

View file

@ -34,6 +34,15 @@ fn name_with_dotdot_or_slash_rejected() {
assert!(file::safe_name("ok.txt").is_ok());
}
#[test]
fn name_with_bidi_or_controls_rejected() {
assert!(file::safe_name("ok.txt").is_ok());
assert!(file::safe_name("safe.txt\u{202e}gpj.exe").is_err());
assert!(file::safe_name("a\u{1b}b.txt").is_err());
assert!(file::safe_name("a\u{009b}b.txt").is_err());
assert!(file::safe_name("a\tb.txt").is_err());
}
#[test]
fn oversize_rejected_before_send() {
let too_big = vec![0u8; MAX_BYTES + 1];