Repository navigation
🐛 fix(unix): ignore inherited media vars for root - #661
Merged
Merged
Conversation
With use_site_for_root, root skipped the inherited XDG user variables only for directories with a site equivalent. The media directories still read XDG_*_DIR and user-dirs.dirs, and created that path under ensure_exists, and user_fonts_dir still read XDG_DATA_HOME. They now return their default under root's home. Fixes #659 Discovered by Anthropic's OSS Scanner, as bug ANT-2026-EKT01S9H.
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.
Fixes #659. With
use_site_for_root=True, root ignores the invoking user's XDG variables for every directory that has a site equivalent. The media directories anduser_fonts_dirhave none, so they still followed the inheritedXDG_*_DIR,$XDG_CONFIG_HOME/user-dirs.dirsandXDG_DATA_HOME, and underensure_existsroot created the media path it read. 🔒 As redirected root they now return their default under root's home, such as/root/Documents, and create nothing.The redirect stays in the Unix class, next to the other
use_site_for_rootbranches, so macOS and non-root callers keep their current behavior. A redirected root also stops reading its own/root/.config/user-dirs.dirs, and the parameter reference and the explanation page now say so.Reported by Anthropic's OSS Scanner: ANT-2026-EKT01S9H.