Problem
The config/debug-enabled security pattern matches legitimate debug flags in development tooling, shell scripts, and configuration files.
Current Regex
regex: r"(?i)(?:DEBUG\s*=\s*True|debug:\s*true|--debug)",
The --debug alternative is too broad — it matches any occurrence of --debug in any context, including:
- CLI argument documentation
- Shell scripts that pass
--debug to subcommands
- Development configuration files
- Build scripts and Makefiles
False Positive Examples
| Input |
Why it matches |
Why it should not |
RUST_LOG=debug cargo run -- --debug |
--debug |
Dev tooling, not production code |
RUN cargo build -- --debug 2>/dev/null |
--debug |
Dockerfile build step |
# Use --debug for verbose output |
--debug |
Documentation comment |
args = parser.add_argument("--debug") |
--debug |
Argument parser definition |
Root Cause
Same architectural pattern as #483 and #485 — keyword-based matching without code context awareness.
Suggested Fix
- Remove bare
--debug from regex — it matches too many legitimate contexts
- Keep
DEBUG = True and debug: true — these are config assignments that are more likely real findings
- Add post-match filter for comment/argument-parser contexts
- Consider scoping to config files only (
.env, config.py, config.yml, settings.json)
Reproduction
echo "RUN cargo test -- --debug" > Dockerfile
cora review --format sarif # Reports config/debug-enabled on Dockerfile
Related
Problem
The
config/debug-enabledsecurity pattern matches legitimate debug flags in development tooling, shell scripts, and configuration files.Current Regex
The
--debugalternative is too broad — it matches any occurrence of--debugin any context, including:--debugto subcommandsFalse Positive Examples
RUST_LOG=debug cargo run -- --debug--debugRUN cargo build -- --debug 2>/dev/null--debug# Use --debug for verbose output--debugargs = parser.add_argument("--debug")--debugRoot Cause
Same architectural pattern as #483 and #485 — keyword-based matching without code context awareness.
Suggested Fix
--debugfrom regex — it matches too many legitimate contextsDEBUG = Trueanddebug: true— these are config assignments that are more likely real findings.env,config.py,config.yml,settings.json)Reproduction
Related