Syntax
Description
Analyze shell scripts for security risks without executing them. This is a safe pre-check that scans scripts for dangerous patterns, risky commands, and policy violations using the same analyzer that powersvg exec.
Arguments
Path to the shell script to validate. Can be any script file (.sh, .bash, etc.)
Exit Codes
- 0: Script is clean (no violations found)
- 2: Security violations detected in the script
Examples
Validate a deployment script
Script with violations
Validate before CI deployment
Validate with JSON output
What It Detects
The validator checks for:- Critical dangers:
rm -rf /,rm -rf ~,mkfs,dd if= - Dangerous deletions: Attempts to delete system or protected directories
- Fork bombs:
:(){:|:&};:and similar patterns - Risky network commands:
curl | sh,wget | bash - Environment access: Reading
.envfiles, accessing$AWS_SECRET_ACCESS_KEY - Subprocess risks:
eval,exec, shell=True in Python - External HTTP: Non-localhost URLs that could be SSRF risks
Related Commands
- exec - Execute commands with protection
- scan-security - Scan source code for security issues