Skip to content

sanitize filesystem strings before terminal output#1205

Open
curious-rabbit wants to merge 3 commits intolsd-rs:mainfrom
curious-rabbit:sanitize
Open

sanitize filesystem strings before terminal output#1205
curious-rabbit wants to merge 3 commits intolsd-rs:mainfrom
curious-rabbit:sanitize

Conversation

@curious-rabbit
Copy link
Copy Markdown

@curious-rabbit curious-rabbit commented Apr 18, 2026

Attacker-controlled filenames, symlink targets and paths could inject ANSI sequences when lsd rendered them to stdout or stderr.

Adds a sanitize_for_terminal helper and a SafePath display wrapper in a new display_util module. Applies them to symlink rendering, folder header output, error messages and the name escape path. Also covers bidi formatting characters used for filename spoofing

Update:
The patch now also sanitizes xattr contexts and replaces two panic sites for non-utf8 symlink targets and non-utf8 filennames in git status that were reachable via filesystem input.

Attacker-controlled filenames, symlink targets and paths could
inject ANSI sequences when lsd rendered them to stdout or stderr.

Adds a sanitize_for_terminal helper and a SafePath display wrapper
in a new display_util module. Applies them to symlink rendering,
folder header output, error messages and the name escape path.
Also covers bidi formatting characters used for filename spoofing
@curious-rabbit curious-rabbit requested a review from zwpaper as a code owner April 18, 2026 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant