Skip to content

Feature/sandbox permissions#6

Merged
linuxdevel merged 3 commits intomainfrom
feature/sandbox-permissions
Mar 5, 2026
Merged

Feature/sandbox permissions#6
linuxdevel merged 3 commits intomainfrom
feature/sandbox-permissions

Conversation

@linuxdevel
Copy link
Copy Markdown
Owner

This pull request introduces a development-friendly sandbox policy system and enhances security and usability for command execution within the agent runtime. The main changes are the addition of a PolicyBuilder for constructing robust sandbox policies (especially for development), advisory command validation in the bash tool, and updates to documentation and tests to reflect these improvements.

Sandbox Policy System Enhancements

  • Added PolicyBuilder with a forDevelopment(cwd, options?) method to create a development-ready sandbox policy. This policy expands syscall and filesystem access to support compilers, package managers, and dev tools, while maintaining kernel-level security. It supports customization via DevelopmentPolicyOptions for extra allowed paths. [1] [2] [3] [4]
  • The CLI now uses PolicyBuilder.forDevelopment() instead of DEFAULT_POLICY, and passes the resulting allowed command paths to built-in tools for validation. [1] [2] [3] [4]

Bash Tool Security Improvements

  • The bash tool now performs advisory command validation: it warns if a binary is outside the allowed execution paths, based on the sandbox policy, before execution. This is enforced in the tool factory (createBashTool) and is advisory only—Landlock provides the real enforcement. [1] [2] [3]
  • Comprehensive tests added for bash tool command validation, covering cases for binaries both inside and outside allowed paths, shell builtins, and missing allowed paths.

Documentation Updates

  • Expanded documentation to describe the new development policy, its syscall and filesystem allowances, and how it improves the developer experience while maintaining security. [1] [2] [3] [4] [5]

Native Sandbox Helper

  • Minor fix to the Landlock helper to include directory read rights when granting execute access, ensuring better compatibility with real-world binaries.

Testing and Refactoring

  • CLI and core tests updated to mock and verify the new policy builder and bash tool validation logic, ensuring correct integration and behavior. [1] [2] [3]

These changes collectively make the sandbox more practical for development workflows, improve command execution transparency, and reinforce the security model.

…sh command validation

- Add PolicyBuilder class with fluent API and forDevelopment(cwd, options?) static
  factory that creates policies with allowlisted system paths, compiler toolchains
  (JVM, GCC, libexec), /usr/include, /usr/share, and ~120 syscalls
- Support DevelopmentPolicyOptions for extraExecutePaths and extraReadWritePaths
- Convert bashTool to createBashTool(options?) factory with advisory command
  validation (warns when binary is outside allowed paths; Landlock enforces)
- Wire bootstrap to use PolicyBuilder.forDevelopment() and pass allowedCommandPaths
  to createBuiltinTools
- Update docs (architecture, security-model, AGENTS, README) and mark roadmap
  feature 1 as done
- 28 PolicyBuilder tests + 6 bash validation tests (669 total, all passing)
…yBuilder paths

Landlock requires LANDLOCK_ACCESS_FS_READ_DIR on directories to traverse
them during execve(). Without it, sandboxed commands like gcc failed with
EACCES. Also adds /sbin, /usr/sbin, and /usr/lib64 to the development
policy for broader system tool and library coverage.
Mirrors /usr structure for /usr/local so compilers and libraries installed
from source (or via tools like brew) work inside the sandbox: lib, lib64,
libexec as execute; include, share as read-only.
@linuxdevel linuxdevel merged commit 557cf83 into main Mar 5, 2026
2 checks passed
@linuxdevel linuxdevel deleted the feature/sandbox-permissions branch March 5, 2026 19:58
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