Understand the Makefile Extractor v1 behavior
mainThe dcg scan Makefile extractor (ID: makefile.recipe) analyzes recipe lines in Makefiles to extract executable commands for security scanning. It follows a conservative approach, preferring silence over false positives.
Key behavior rules:
- File Detection: It only matches files named
Makefile,makefile, orMAKEFILE(case-insensitive). It does not support.mkinclude files,GNUmakefile,makefile.in, orMakefile.am. - Recipe Identification: Only lines starting with a literal TAB character are treated as recipe lines containing shell commands.
- Variable Handling: The v1 extractor does NOT expand variables. It extracts literal syntax like
$(VAR),${VAR}, or$$HOME. This means dangerous commands hidden behind variables will not be detected. - Extraction Scope: It extracts commands from recipe lines but ignores variable assignments, target definitions, directives (like
.PHONY), and conditionals (likeifeq).