sanitize peer chat/control/bidi before store and TUI render #21

Merged
sirius merged 3 commits from wt/t_6ddd495e into main 2026-09-12 03:59:46 +00:00
Owner

Summary

  • Strip C0 (except tab/newline), DEL, C1, and bidi/format marks (U+202A–U+202E, U+2066–U+2069, U+200E, U+200F, U+200B, U+200C) from untrusted peer chat at ingest and TUI render.
  • Keep U+200D ZWJ so emoji sequences stay intact; invalid UTF-8 becomes U+FFFD (chat is not dropped).
  • safe_name rejects the same control/bidi set (including tab/newline).
  • PROTOCOL.md and THREAT_MODEL.md document the policy.

Policy

display_text: lossy UTF-8, then strip the set above except \t/\n.
is_control_or_bidi (filenames): same set including tab/newline.

Tests

cargo test --locked green (sanitize 9/9; file bidi/controls rejected).
cargo clippy --locked --all-targets -- -D warnings green.

Do not merge; leaving for review.

## Summary - Strip C0 (except tab/newline), DEL, C1, and bidi/format marks (U+202A–U+202E, U+2066–U+2069, U+200E, U+200F, U+200B, U+200C) from untrusted peer chat at ingest and TUI render. - Keep U+200D ZWJ so emoji sequences stay intact; invalid UTF-8 becomes U+FFFD (chat is not dropped). - `safe_name` rejects the same control/bidi set (including tab/newline). - PROTOCOL.md and THREAT_MODEL.md document the policy. ## Policy `display_text`: lossy UTF-8, then strip the set above except `\t`/`\n`. `is_control_or_bidi` (filenames): same set including tab/newline. ## Tests `cargo test --locked` green (sanitize 9/9; file bidi/controls rejected). `cargo clippy --locked --all-targets -- -D warnings` green. Do not merge; leaving for review.
[verified] sanitize peer chat/control/bidi before store and TUI render
Some checks failed
ci / test (pull_request) Failing after 2m2s
e3738c51f7
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.
ci: retrigger Pi runner after shared target lock
All checks were successful
ci / test (pull_request) Successful in 2m43s
818cf5922f
Previous PR run waited on the cargo build-dir lock then compiled
tests against a stale rlib missing sanitize.
Merge branch 'main' into wt/t_6ddd495e
Some checks failed
ci / test (pull_request) Failing after 2m29s
0a888eced5
sirius merged commit 4457c7330c into main 2026-09-12 03:59:46 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
sirius/onionwire!21
No description provided.