Rootsystem2101 Claude Sonnet 4.6 commited on
Commit
e3b8712
Β·
1 Parent(s): d0247f3

fix: storetest + sampledata false positives

Browse files

- Added storetest/testdata/testutil/mockstore to SKIP_TEST_INFRA_DIRS
- Hardcoded Secret in sample*/fixture*/seed*/fake* files β†’ INFO
(sampledata_util.go passwords are intentional test data)

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

Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -996,7 +996,8 @@ SKIP_FILE_SUFFIXES = frozenset({
996
  # Directories that are pure test infrastructure (no real code)
997
  SKIP_TEST_INFRA_DIRS = frozenset({
998
  "cypress", "__tests__", "__mocks__", "mocks", "stubs",
999
- "e2e", "jest", "jasmine",
 
1000
  })
1001
 
1002
  def _is_test_context(path):
@@ -2247,10 +2248,14 @@ def scan_file_content(content, filename):
2247
 
2248
  # ── Test-context: secrets β†’ INFO ─────────────────────────
2249
  test_note = ""
2250
- if test_ctx and actual_vuln == "Hardcoded Secret":
 
 
 
 
2251
  actual_sev = "INFO"
2252
  conf = "LOW"
2253
- test_note = "Test context β€” credential is likely mock/fixture data."
2254
 
2255
  # ── Nearby mitigation check ──────────────────────────────
2256
  ctx_conf = _context_confidence(lines, lineno, actual_vuln)
 
996
  # Directories that are pure test infrastructure (no real code)
997
  SKIP_TEST_INFRA_DIRS = frozenset({
998
  "cypress", "__tests__", "__mocks__", "mocks", "stubs",
999
+ "e2e", "jest", "jasmine", "storetest", "testdata", "testutil",
1000
+ "fakestore", "mockstore", "teststore",
1001
  })
1002
 
1003
  def _is_test_context(path):
 
2248
 
2249
  # ── Test-context: secrets β†’ INFO ─────────────────────────
2250
  test_note = ""
2251
+ _is_sample = re.search(
2252
+ r'(?i)(sample|fixture|seed|fake|mock|dummy|stub|sampledata)',
2253
+ filename
2254
+ )
2255
+ if (test_ctx or _is_sample) and actual_vuln == "Hardcoded Secret":
2256
  actual_sev = "INFO"
2257
  conf = "LOW"
2258
+ test_note = "Test/sample context β€” credential is likely mock/fixture data."
2259
 
2260
  # ── Nearby mitigation check ──────────────────────────────
2261
  ctx_conf = _context_confidence(lines, lineno, actual_vuln)