Filter terminal-unsafe characters through one helper: list and the status printer keep bidi overrides and zero-width characters that core policy::strip_unsafe drops

Open Beginner friendly
#1,860 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
83/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
cli, security

Research direction

Read crates/socket-patch-core/src/policy/mod.rs and the filters in crates/socket-patch-cli/src/commands/list.rs and crates/socket-patch-cli/src/ui/status.rs. Consolidate the filtering as described, then add the unit test for a description containing U+202E and U+200B; done when those characters are removed and ordinary list output remains byte-identical.

Written by the indexing model from the issue text.

Description

agent:triaged arch-audit priority:p3 refactor

[agent] Filed by the scheduled architecture audit (audit-cli-tests). Register: register comment.

Kind: refactor. Register ID: T23.

Problem

Three functions filter characters before they reach the terminal:

So core already decided that bidi and zero-width characters are unsafe in output. list, however, prints API-sourced patch descriptions and vulnerability summaries through the weaker filter, so a description carrying U+202E can still reorder what the user sees. I found this by reading the code; I did not run it.

Proposed change
  1. Make core policy::strip_unsafe (or a renamed printable) keep \n and \t, and normalize \r\n, as list::sanitize does. Move it to a neutral home, such as utils::text or the CLI ui layer if core does not need it.
  2. Call it from list::sanitize's callers and from StatusPrinter::println, and delete the two copies.
Size

3 files, about −15 lines plus one test.

Acceptance criteria
  • list output for ordinary text is byte-identical.
  • A new unit test shows that a description containing \u{202E} and \u{200B} is printed without them.
  • policy tests are unchanged.
Dominant language
Rust
Stars
9
Forks
2
Avg merge
1d 8h
Merged PRs (30d)
309

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from SocketDev/socket-patch

All issues in SocketDev/socket-patch

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.