-
Notifications
You must be signed in to change notification settings - Fork 112
fix: add cwd to sandbox read allowlist #835
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v3
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -139,6 +139,13 @@ def _get_common_read_paths() -> list[str]: | |
|
|
||
| candidates = [sys.prefix, sys.base_prefix, "/usr", "/lib"] | ||
|
|
||
| # Current working directory: sandboxed scanning runs from wherever the | ||
| # user's shell happens to be, and tarsafe calls os.getcwd() during | ||
| # extraction to bound path-traversal checks. Without READ access here | ||
| # that call fails with PermissionError, which tarfile misreports as | ||
| # "not a gzip file". | ||
| candidates.append(os.getcwd()) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When the process's working directory has been renamed or deleted after startup, Useful? React with 👍 / 👎. |
||
|
|
||
| # SSL certificate directories: pygit2 initializes OpenSSL at import time and | ||
| # reads the system CA bundle. On Linux (Landlock), only explicitly listed paths | ||
| # are readable — unlike macOS (Seatbelt) which includes system paths by default. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When GuardDog is launched from a sensitive directory such as the user's home or a repository root,
allow_pathgrants recursive READ access to that entire tree in bothapply_sandboxandextract_sandboxed. This defeats the documented filesystem isolation for archive/parser exploits and can expose credentials or source files unrelated to the scan; satisfy tarsafe'sgetcwd()requirement by changing into an already-allowed temporary/extraction directory rather than globally allowlisting the caller's cwd.Useful? React with 👍 / 👎.