T09 · Insecure Skill Coding Practices
- Location
scripts/script.sh:5- Finding
Persistent Plaintext Logging of Unsanitized Command-Line Arguments
- Content
View full analysis
> "$DATA_DIR/history.log"; } ``` ```bash cmd_init() { echo " Project initialized in $(pwd)" _log "init" "${1:-}" } cmd_check() { echo " Running lint + type check + tests..." _log "check" "${1:-}" } cmd_build() { echo " Building..." _log "build" "${1:-}" } cmd_test() { echo " Running test suite..." _log "test" "${1:-}" } cmd_deploy() { echo " Deploy: build -> test -> stage -> prod" _log "deploy" "${1:-}" } cmd_config() { echo " Config: $DATA_DIR/config.json" _log "config" "${1:-}" } cmd_status() { echo " Status: checking project health..." _log "status" "${1:-}" } cmd_template() { echo " Template for: $1" _log "template" "${1:-}" } cmd_docs() { echo " Generating docs..." _log "docs" "${1:-}" } cmd_clean() { echo " Cleaned build artifacts" _log "clean" "${1:-}" } ``` ### Technical Analysis The script creates a persistent data directory and writes the first argument supplied to each operational command directly to `history.log`. The argument is not redacted, validated, length-limited, or escaped before it is stored. If a caller supplies an API token, password, internal URL containing credentials, customer data, or another secret as the first command argument, that value will be retained in plaintext. The script does not set a restrictive `umask` or explicitly assign `0700` permissions to the directory and `0600` permissions to the log. Effective access therefore depends on the invoking environment's existing umask and filesystem controls. The direct use of `echo` ...[truncated 2065 chars]- Remediation
View remediation
