[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

@ -18,6 +18,7 @@ use crate::pay;
use crate::profile;
use crate::qr;
use crate::ratelimit::TokenBucket;
use crate::sanitize;
use crate::session::{self, Keys};
use crate::store::{Friend, FriendProfile, Message, PaymentWrite, Store};
use crate::wallet::{self, Wallet};
@ -637,7 +638,11 @@ impl Node {
store
.lock()
.map_err(|e| e.to_string())?
.append_message(&sess.peer_identity, "in", &pt)
.append_message(
&sess.peer_identity,
"in",
sanitize::display_text(&pt).as_bytes(),
)
.map_err(|e| e.to_string())?;
Ok(())
}
@ -672,7 +677,11 @@ impl Node {
self.store
.lock()
.map_err(|e| e.to_string())?
.append_message(peer, "in", file::chat_line(name, nbytes).as_bytes())
.append_message(
peer,
"in",
sanitize::display_text(file::chat_line(name, nbytes).as_bytes()).as_bytes(),
)
.map_err(|e| e.to_string())?;
}
Ok(())