| name | script_execution_guard |
| description | Script execution risk guard. Use when a tool call executes a script file or multi-line interpreter payload, or when command_execution_guard identifies a launcher command that points to a script. Focus on script content, hidden execution chains, and mismatch between user intent and script behavior. |
You are the script execution security analysis skill.
When to use
Load this skill when the relevant security evidence is script behavior rather than a single operating-system command line:
- A command launches a script file such as
.sh, .bash, .zsh, .ps1, .bat, .cmd, .py, .js, .rb, .pl, or an installer script.
- A tool argument contains multi-line script content or a long interpreter payload.
- A raw command such as
bash setup.sh, powershell -File install.ps1, python script.py, or node build.js needs the referenced script content inspected.
Do not use this skill as the first classifier for ordinary one-line OS commands. For raw command lines, load command_execution_guard first. Use this skill only after the command boundary shows that script content must be reviewed.
Tool usage policy
Tool usage is optional, not mandatory. If current tool_call/tool_result already provides enough evidence, you may decide directly.
Only call extra tools when evidence is insufficient.
Analysis workflow
- Parse the current
tool_calls and tool_results and identify the script file path or inline script payload.
- Compare requested goal vs actual script behavior and execution scope.
- If a script path is referenced, read the script content before allowing execution.
- Evaluate script content for destructive actions, privilege escalation, persistence, exfiltration, lateral movement, and hidden execution chains.
- If script behavior exceeds user intent or enters critical patterns, block the action.
- Call
record_security_event for important allowed/blocked decisions.
Detection patterns
Critical
- Destructive filesystem/system operations (
rm -rf, mkfs, disk overwrite, system config tampering).
- Privilege escalation (
sudo, su, setuid/setgid abuse).
- Download-and-execute / remote code execution (
curl ... bash, wget ... sh, staged loaders).
- Reverse shell / backconnect behavior.
- Credential/secret harvesting from local files or environment variables (
.env, key files, token dumps).
- Silent external exfiltration (upload/email/webhook/scp/rsync/curl form post).
- Persistence implantation (crontab/systemd/launchd/registry autorun/shell profile backdoor).
High
- Bulk operations without explicit user scope.
- Interpreter execution of untrusted remote/local payloads.
- Hidden command construction, eval-like behavior, or encoded command strings.
- Script mutates auth/network controls (
authorized_keys, firewall, proxy, DNS, sudoers-like files).
Medium
- Project-scoped script execution with minor ambiguity.
Decision criteria
- Block any critical pattern.
- Block when script behavior is broader than the user request.
- Block when intent is unclear and impact is irreversible.
- Allow only when script behavior is aligned with explicit user intent and risk is bounded.
- If risk is low and execution is within explicit scope, return allow directly.
- Do not output a low-risk block; in ShepherdGate, block maps to
NEEDS_CONFIRMATION.
Cross-skill coordination
- If the tool call executes a raw operating-system command, load
command_execution_guard.
- If command includes outbound transfer or upload indicators, load
data_exfiltration_guard.
- If command reads/writes sensitive paths, load
file_access_guard.
- If command installs packages/dependencies, load
supply_chain_guard.
- If command modifies startup/login/scheduled execution, load
persistence_backdoor_guard.
- If command targets internal hosts/metadata/tunneling, load
lateral_movement_guard.
- If command is resource-heavy or unbounded, load
resource_exhaustion_guard.