Repository navigation
fix(server): Redact home directory paths from dev-server error responses - #1685
Merged
Merged
Conversation
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.
matz3
approved these changes
Oct 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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,/homeand/rootshapes, and WindowsC:\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
/optand/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.