Repository navigation
fix: address default execution tier security posture - #1271
Conversation
Signed-off-by: AngeloDanducci <[email protected]>
markstur
left a comment
There was a problem hiding this comment.
CI fail and I started a review which probably explains the CI fail.
Location: test/stdlib/tools/test_python_tool.py:546-564
Issue: Test test_python_tool_packages_plus_filesystem_policy_warns_once expects 1 warning during python_tool() call, but the warning is emitted during CapabilityPolicy construction (line 552), which happens before the warning capture context starts (line 553).
Fix needed: Wrap the CapabilityPolicy construction in the warning capture context:
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
policy = CapabilityPolicy(filesystem_read_roots=[Path("/tmp")])
python_tool(tier="local_unsafe", packages=["numpy"], policy=policy)
Signed-off-by: AngeloDanducci <[email protected]>
psschwei
left a comment
There was a problem hiding this comment.
did we fix this part of the issue?
- Example and documentation framing
Thepython_tool_example.pydocstring describeslocal_unsafeas chosen "so no Docker daemon is required", framing the tier as a deployment convenience rather than a trust decision. The tools README recommends usingcode_interpreterfor untrusted code but useslocal_code_interpreterwith an LLM in the quickstart example.
Signed-off-by: AngeloDanducci <[email protected]>
|
The docstring in Should be fixed 👍 |
|
Filed #1277 to migrate the remaining docs/examples ( |
| # Warn once at construction time when the caller passed a policy on a local tier | ||
| # whose boolean restriction fields are unenforced — do this before any replace() | ||
| # so the warning fires exactly once and points at the python_tool() call site. | ||
| if policy is not None and resolved_tier in _LOCAL_TIERS: |
There was a problem hiding this comment.
Nit: this only warns when a policy is explicitly passed — tier="local" with no policy uses the equally-unenforced LOCAL_POLICY silently. A one-line docstring note that default local-tier policies are also unenforced might close that gap.
| from mellea.stdlib.tools import python_tool | ||
|
|
||
| tool = python_tool(packages=["matplotlib", "numpy"]) | ||
| tool = python_tool(tier="local_unsafe", packages=["matplotlib", "numpy"]) |
There was a problem hiding this comment.
Nit: since the PR is about nudging conscious trust decisions, a short inline comment here (e.g. # explicit unsafe local execution) would keep copy-pasters from treating unsandboxed exec as the blessed default.
Signed-off-by: AngeloDanducci <[email protected]>
85c447e
Pull Request
Issue
Fixes #1232
Description
adds additional warning and handling around python tool sandboxing and default security
Testing
Attribution
Adding a new component, requirement, sampling strategy, or tool?
If your PR adds or modifies one of the types below, check the matching box. A checklist of type-specific review items will be posted as a comment.
NOTE: Please ensure you have an issue that has been acknowledged by a core contributor and routed you to open a pull request against this repository. Otherwise, please open an issue before continuing with this pull request.