Spaces:
Sleeping
Sleeping
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>
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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)
|