Skip to content

feat: add directory scope enforcement to block out-of-scope file access#6

Merged
ehsaniara merged 1 commit into
mainfrom
allow_dir
Apr 3, 2026
Merged

feat: add directory scope enforcement to block out-of-scope file access#6
ehsaniara merged 1 commit into
mainfrom
allow_dir

Conversation

@ehsaniara
Copy link
Copy Markdown
Owner

Summary

  • Adds allowed_directories policy that blocks requests containing file references outside configured directories
  • Prevents LLM tools from scanning files beyond the intended project scope (e.g. ~/.ssh, /etc/passwd, ~/.aws/credentials)
  • Scope check runs before deny pattern check, resolves relative paths and ../ traversals
  • Desktop UI updated with an "Allowed Directories" section in the Policy tab
  • 6 new test cases covering in-scope, out-of-scope, multi-dir, bypass, and path traversal

Test plan

  • All existing tests pass (24 policy, full suite green)
  • New scope tests cover: absolute paths, relative paths, ../ traversal, multiple allowed dirs, bypass mode, empty config
  • Frontend builds successfully
  • Production binary builds and runs

- Add allowed_directories policy that prevents LLM tools from sending
- files outside configured project directories. Resolves relative paths and ../traversals. Includes desktop UI support and 6 new test cases.
@ehsaniara ehsaniara self-assigned this Apr 3, 2026
@ehsaniara ehsaniara merged commit 3bb09fb into main Apr 3, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant