fix(openclaw): enforce scan_directory sandbox to demo_projects only#120
Open
sanjaysaini383 wants to merge 1 commit into
Open
fix(openclaw): enforce scan_directory sandbox to demo_projects only#120sanjaysaini383 wants to merge 1 commit into
sanjaysaini383 wants to merge 1 commit into
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
Author
|
Hii @gautammanak1 |
|
Hey @sanjaysaini383! Saw your work on GSSoC 2026. We are building TermUI, a TypeScript terminal UI framework with React-style hooks and JSX, rendered entirely in the terminal. We have 67 unassigned GSSoC issues open. 19 are marked Karanjot, TermUI maintainer |
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.
Summary
Fixes a medium-severity information disclosure in the OpenClaw weekly report workflow:
scan_directorycould be steered (via LLM planning or prompt injection on ASI:One) to scan broad local paths such as~/Documentsor~/projects, exposing git repo names and recent commit messages to cloud chat.This PR enforces
DEMO_PROJECTS_DIRonly by default across four layers:scan_directorypaths outside the demo sandbox~/Documents, CWD,/tmp)scan_directorypaths after LLM/keyword planningweekly_report.scan_directory()uses shared path normalization at runtimeAdds
shared/paths.pyfor centralized sandbox helpers. Operators can opt into legacy broad paths for local dev withOPENCLAW_EXTENDED_PATHS=true.CHANGELOG.mdupdated. 75/75 OpenClaw tests pass.Type of Change
Checklist
ruff check ..ruff format ..README.mdfor changed example(s). (.env.exampledocuments new flag; README behavior unchanged for default demo flow.).env.exampleif environment variables are required. (DocumentedOPENCLAW_EXTENDED_PATHS.)CHANGELOG.md(required for non-doc changes).Related Issue
Closes #112
Notes for Reviewers
Problem (before)
./demo_projectsFetchPolicypathchecksLocalPolicy~/Documents,~/projects,/tmp, CWDscan_directory()~prefixes; absolute paths could still scan user foldersSolution (after)
shared/paths.pyis_path_under_demo(),normalize_scan_directory_path(),default_allowed_scan_paths()orchestrator/policy.pycheck_scan_paths()→PATH_NOT_ALLOWEDconnector/policy.pyallowed_paths=[demo_projects_dir()]onlyorchestrator/planner.py_enforce_scan_directory_paths()after planningconnector/workflows/weekly_report.pyOpt-in extended mode (local dev only)