Repository navigation
Fix #159: Allow browsing home dir when it lives under a blocked path (WSL/root) - #341
Open
zwanski-start wants to merge 1 commit into
Open
zwanski-start wants to merge 1 commit into
zwanski-start wants to merge 1 commit into
Conversation
…der a blocked path When the server runs as root (common in WSL and containers), Path.home() is /root, which is in LINUX_BLOCKED. The folder browser defaults to home, so every new-project attempt hit 'Blocked access to restricted path: /root' with a 403. is_path_blocked() now treats the user's own home directory as browsable even if it sits under a blocked system path; inside home only the sensitive credential directories (~/.ssh, ~/.aws, ...) remain blocked. Other system paths stay blocked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Problem
When AutoForge runs as root (the default user in many WSL distros and containers),
Path.home()is/root./rootis inLINUX_BLOCKEDinserver/routers/filesystem.py. The folder browser opens on the home directory by default, soGET /api/filesystem/listreturned 403 "Blocked access to restricted path: /root" and users could not pick or create a project folder.Fix
is_path_blocked()now always lets users browse their own home directory, even if it sits inside a blocked system path. This covers/root, and also a home nested under a blocked root such as/var/lib/svc. Inside home, only the blocked paths nested in home still apply: the sensitive credential dirs fromSENSITIVE_DIRECTORIES(~/.ssh,~/.aws,~/.gnupg, ...). Other system paths (/etc,/var,/proc, ...) stay blocked. Project registration (projects.py) and scaffolding (scaffold.py) also callis_path_blocked, so they get the same fix.Verification
test_filesystem_blocklist.py(6 tests, all passing):~/.sshis still blockedlist_directory()with no path returns the home listingruff checkpasses.python test_security.pypasses.filesystem.py. The only errors there are the existing Windows-onlyctypes.windllones.Assumptions
autoforge --workspace, but the CLI has no such flag. The failure comes from the default home listing, which this PR fixes./root, so letting them browse it in the UI exposes nothing new. Credential subdirectories stay hidden.Closes #159
🤖 Generated with Claude Code