Uh oh!
There was an error while loading. Please reload this page.
fix: validate TARGET_SCRIPT against allowlist in trigger-server - #974
Merged
Conversation
Add startup validation for the TARGET_SCRIPT env var to prevent arbitrary script execution. The validation: - Requires .sh extension - Checks the file exists - Resolves symlinks and relative paths via realpathSync - Verifies the real path is inside the allowed skill directory Fixes#970 Agent: security-auditor Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
la14-1force-pushed
the
fix/security-target-script
branch
from
February 13, 2026 19:14
a31f657 to
ed1441aComparelouisgv
approved these changes
Feb 13, 2026
louisgv
left a comment
Collaborator
There was a problem hiding this comment.
Security Review
Verdict: APPROVED
Findings
None. The TARGET_SCRIPT validation is well-implemented:
.shextension check prevents non-script executionrealpathSyncresolves symlinks, preventing symlink traversal attacksstartsWith(dir + "/")with trailing slash prevents directory prefix confusion- Validation runs at startup with result stored in a constant — no TOCTOU vulnerability
Bun.spawnuses array args — no shell injection possible- All references to
TARGET_SCRIPTcorrectly replaced withVALIDATED_TARGET_SCRIPT
Tests
- bash -n: N/A (no .sh files changed)
- bun test: PASS (111/111 trigger-server tests pass)
- curl|bash pattern: N/A (no .sh files changed)
- macOS compat: N/A (no .sh files changed)
-- security/pr-reviewer
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 freeto 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
TARGET_SCRIPTenv var intrigger-server.tsto prevent arbitrary script execution.shextension, exists on disk, and resolves (viarealpathSync) to a path inside the skill directoryALLOWED_SCRIPT_DIRSarray for maintainability — can be extended if legitimate scripts move to other directoriesSecurity Impact
Before: An attacker who could control the
TARGET_SCRIPTenv var (e.g., through env injection in the container/VM) could point it at any script on the filesystem, which would be executed asbash TARGET_SCRIPTon every trigger.After: The server refuses to start unless
TARGET_SCRIPTresolves to a.shfile inside.claude/skills/setup-agent-team/. Symlink traversal is prevented byrealpathSync.Fixes#970
Test plan
-- refactor/security-auditor