fix(cli): sanitizePathForDisplay keeps Unicode format characters such as bidi overrides

Open Beginner friendly
#173 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
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
go
Domain
cli

Research direction

Start with sanitizePathForDisplay in internal/cli/uninit.go, which removes runes where unicode.IsControl is true, and with the duplicate sanitizeControl in internal/cli/present/sanitize.go. Add a unicode.Cf or bidi-control check to both, then add a Cf case to each helper's test. Done when U+202E and U+200B are stripped from the output and the existing tests still pass.

Written by the indexing model from the issue text.

Description

bug priority:low

sanitizePathForDisplay (internal/cli/uninit.go) removes the runes for which unicode.IsControl is true. That is Unicode category Cc only. Category Cf runes pass through, for example U+202E RIGHT-TO-LEFT OVERRIDE and U+200B ZERO WIDTH SPACE. A path that holds them can display as a different path from the one on disk.

Every CLI path display goes through this helper, including the skipped-registry-file warning that the #155 change adds. internal/cli/present/sanitize.go keeps a duplicate, sanitizeControl, with the same rule.

Severity

Low. Display only, and the helper was written this way before #155. Someone who can name a file the CLI prints can already show the user a misleading name. The fix stops the display from hiding it.

What to do

  • Also drop unicode.Is(unicode.Cf, r) runes, or at least the bidi controls (U+202A–U+202E, U+2066–U+2069), in both helpers.
  • Add a Cf case to each helper's test.

Found by the security reviewer in the suite review of the #155 implementation branch (information level).

🤖 Generated with Claude Code

https://claude.ai/code/session_016kpFpXsCNuZSmh5X7ebdwU

Dominant language
Go
Stars
0
Forks
0
Avg merge
5h 16m
Merged PRs (30d)
107

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 seanb4t/codegraph-go

All issues in seanb4t/codegraph-go

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.