Skip to content

fix(environment): protect the dynamic-tool-loading control variable#526

Draft
yonib05 wants to merge 1 commit into
strands-agents:mainfrom
yonib05:fix/environment-protect-load-tool-var
Draft

fix(environment): protect the dynamic-tool-loading control variable#526
yonib05 wants to merge 1 commit into
strands-agents:mainfrom
yonib05:fix/environment-protect-load-tool-var

Conversation

@yonib05

@yonib05 yonib05 commented Jun 30, 2026

Copy link
Copy Markdown
Member

Description

The environment tool can set and delete arbitrary environment variables, but its PROTECTED_VARS set did not include STRANDS_DISABLE_LOAD_TOOL. This variable is the control that operators use to disable dynamic tool loading. Because it was not protected, it could be modified or removed through the environment tool, re-enabling dynamic tool loading after an operator had turned it off.

This change adds STRANDS_DISABLE_LOAD_TOOL to PROTECTED_VARS. Both the set and delete paths in the tool check membership in PROTECTED_VARS before mutating, so a single addition protects both operations.

Changes

  • Add STRANDS_DISABLE_LOAD_TOOL to PROTECTED_VARS in src/strands_tools/environment.py.
  • Add regression tests verifying that set and delete of STRANDS_DISABLE_LOAD_TOOL via the environment tool are refused and the value is left unchanged.

Testing

  • pytest tests/test_environment.py -> 19 passed (including 2 new tests).
  • ruff format --check and ruff check pass on the changed files.

Add STRANDS_DISABLE_LOAD_TOOL to the environment tool's PROTECTED_VARS so
it cannot be set or deleted through the tool. The set and delete paths both
check PROTECTED_VARS, so this covers both operations.

Add regression tests confirming that set and delete of
STRANDS_DISABLE_LOAD_TOOL are refused.
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