@@ -84,18 +84,45 @@ jobs:
8484 - name : Check for dangerous patterns
8585 run : |
8686 echo "==> Scanning for dangerous patterns..."
87- fail=0
88- # Check for eval with variables
89- if grep -rn 'eval.*\$' lib/ apotropaios.sh --include='*.sh' | grep -v 'eval "exec' | grep -v '#'; then
90- echo "::warning::Found eval with variable expansion (review required)"
87+ found=0
88+ # Check for eval with user-supplied data (exclude framework-internal eval)
89+ # Known-safe: security_scrub_vars (var scrubbing), _CLEANUP_STACK (cleanup),
90+ # error_with_fallback (primary/fallback), util_parallel_exec (framework cmd)
91+ matches=$(grep -rn 'eval.*\$' lib/ apotropaios.sh --include='*.sh' \
92+ | grep -v 'eval "exec' \
93+ | grep -v '^\s*#' \
94+ | grep -v 'security_scrub_vars\|_CLEANUP_STACK\|cleanup\|scrub\|error_with_fallback\|util_parallel' \
95+ || true)
96+ if [ -n "$matches" ]; then
97+ echo "$matches"
98+ echo "::warning::Found eval with variable expansion outside known-safe patterns (review required)"
99+ found=1
91100 fi
92- # Check for unquoted command substitution
93- if grep -rn '[^"]\$(' lib/ apotropaios.sh --include='*.sh' | grep -v '^\s*#' | grep -v 'readonly\|local\|export' | head -20; then
101+ # Check for unquoted command substitution in dangerous contexts
102+ # Exclude: variable assignments (local/readonly/export), arithmetic,
103+ # log messages, printf arguments, and string interpolation in quotes
104+ matches=$(grep -rn '\$(' lib/ apotropaios.sh --include='*.sh' \
105+ | grep -v '^\s*#' \
106+ | grep -v 'local \|readonly \|export \|="\$(\|="$(' \
107+ | grep -v 'log_\|printf\|echo' \
108+ | grep -v '\$((\|util_\|basename\|dirname\|date\|wc\|grep\|cat\|head\|cut' \
109+ || true)
110+ if [ -n "$matches" ]; then
111+ echo "$matches"
94112 echo "::notice::Found potentially unquoted command substitution (review recommended)"
113+ found=1
95114 fi
96115 # Check for /tmp without mktemp
97- if grep -rn '"/tmp/' lib/ apotropaios.sh --include='*.sh' | grep -v '#\|mktemp\|test\|TMPDIR'; then
116+ matches=$(grep -rn '/tmp/' lib/ apotropaios.sh --include='*.sh' \
117+ | grep -v '#\|mktemp\|test\|TMPDIR\|printf\|help\|echo' \
118+ || true)
119+ if [ -n "$matches" ]; then
120+ echo "$matches"
98121 echo "::warning::Found hardcoded /tmp paths — use mktemp instead"
122+ found=1
123+ fi
124+ if [ "$found" -eq 0 ]; then
125+ echo " ✓ No dangerous patterns found"
99126 fi
100127 echo "==> Pattern scan complete"
101128
@@ -262,7 +289,7 @@ jobs:
262289 if : always()
263290 steps :
264291 - name : Download all results
265- uses : actions/download-artifact@v4
292+ uses : actions/download-artifact@v6
266293 with :
267294 path : all-results/
268295
0 commit comments