Skip to content

fix(server): Redact home directory paths from dev-server error responses - #1685

Merged
RandomByte merged 1 commit into
mainfrom
fix/server-redact-home-dir-paths
Oct 30, 2026
Merged

RandomByte merged 1 commit into
mainfrom
fix/server-redact-home-dir-paths

Conversation

@RandomByte

Copy link
Copy Markdown
Member

The error handler rendered err.message and err.stack verbatim into the HTML and plain-text 500 responses, so absolute stack-frame paths exposed the OS username to any HTTP caller.

Redact home-directory prefixes to ~ before rendering, in both response formats. The current user's home, the /Users, /home and /root shapes, and Windows C:\Users\<name>\ are covered, so redaction holds regardless of the host OS. File names, directories below the home, and line and column positions stay readable. When the home lookup fails, the handler returns a safe placeholder rather than raw text.

Non-home paths such as /opt and /var, and resource URLs like /resources/..., stay intact: they carry no username, and on POSIX a filesystem path and a URL path are indistinguishable, so redacting them would drop references developers need.

The error handler rendered err.message and err.stack verbatim into the
HTML and plain-text 500 responses, so absolute stack-frame paths exposed
the OS username to any HTTP caller.

Redact home-directory prefixes to ~ before rendering, in both response
formats. The current user's home, the /Users, /home and /root shapes, and
Windows C:\Users\<name>\ are covered, so redaction holds regardless of the
host OS. File names, directories below the home, and line and column
positions stay readable. When the home lookup fails, the handler returns a
safe placeholder rather than raw text.

Non-home paths such as /opt and /var, and resource URLs like /resources/...,
stay intact: they carry no username, and on POSIX a filesystem path and a
URL path are indistinguishable, so redacting them would drop references
developers need.
@RandomByte
RandomByte requested a review from a team October 30, 2026 09:24
@RandomByte
RandomByte merged commit ded7e44 into main Oct 30, 2026
77 checks passed
@RandomByte
RandomByte deleted the fix/server-redact-home-dir-paths branch October 30, 2026 20:45
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.

2 participants