Skip to content
vetkitChecksChangelogDocumentation

vetkit.shell.rm.unguarded-variable-path

rm -r deletes $DIR/ or $DIR/* without a ${DIR:?} guard or set -u. If the variable is ever empty or unset, the command deletes the contents of the filesystem root.

Last updated:

Suite: Security

bash

rm -r deletes $DIR/ or $DIR/* without a ${DIR:?} guard or set -u. If the variable is ever empty or unset, the command deletes the contents of the filesystem root.

Category: SECURITY · Engine rule severity: INFO

How to fix it

Write rm -rf -- "${DIR:?}/"* (fails when DIR is empty or unset) or enable set -u at the top of the script.

References

Source: packages/engine/rules/sast/shell.yml.

Generated from shipped rule definitions at build time. Matching is a review signal, not proof of exploitability. “generic” denotes text matching, not complete language or framework coverage. Runtime configuration and available tools affect whether a rule runs.