Rootsystem2101 Claude Sonnet 4.6 commited on
Commit
0650784
Β·
1 Parent(s): 1d6ebcd

Fix over-aggressive Open Redirect suppression

Browse files

Previous rule suppressed ALL variable assignments from req.query which
would hide real Open Redirect vulnerabilities in other repos.

Replaced with targeted suppression: only suppress res.redirect() calls
that use explicit relative paths (./callback, etc.) which are safe by
definition. Variable assignments are now correctly flagged with LOW
confidence and require context analysis to determine if validation exists.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -1561,11 +1561,11 @@ _FP_SUPPRESSIONS = [
1561
  re.compile(r'CREATE\s+\$\{\s*\w+\s*\?\s*[\'"]UNIQUE\s*[\'"]\s*:\s*[\'"][\'"]', re.IGNORECASE),
1562
  "CREATE INDEX with internal boolean flag β€” not user-controlled"),
1563
 
1564
- # ── Open Redirect: variable assigned but not yet used ───
1565
- # let redirect = req.query[...] β€” assignment line alone is not a redirect
1566
  ("Open Redirect",
1567
- re.compile(r'^\s*(let|const|var)\s+\w+\s*=\s*req\.(query|body|params)', re.IGNORECASE),
1568
- "Variable assignment only β€” redirect not issued on this line"),
1569
  ]
1570
 
1571
 
 
1561
  re.compile(r'CREATE\s+\$\{\s*\w+\s*\?\s*[\'"]UNIQUE\s*[\'"]\s*:\s*[\'"][\'"]', re.IGNORECASE),
1562
  "CREATE INDEX with internal boolean flag β€” not user-controlled"),
1563
 
1564
+ # ── Open Redirect: res.redirect() with a SAFE internal URL ─
1565
+ # res.redirect(303, `./callback?${...}`) β€” relative URL, safe
1566
  ("Open Redirect",
1567
+ re.compile(r'res\.redirect\s*\(\s*\d+\s*,\s*[\'"`]\./|res\.redirect\s*\(\s*[\'"`]\./', re.IGNORECASE),
1568
+ "Redirect target is a relative path β€” not user-controlled"),
1569
  ]
1570
 
1571