Skip to content

fix: clear the 12 high code-scanning alerts - #12

Merged
georgiedekker merged 2 commits into
mainfrom
lane/scan-highs
Nov 15, 2026
Merged

georgiedekker merged 2 commits into
mainfrom
lane/scan-highs

Conversation

@georgiedekker

Copy link
Copy Markdown
Contributor

What

Clears the 12 open HIGH code-scanning alerts (CodeQL default setup, Python): 2 are real and fixed in code; 10 are proven false positives / test-only and were dismissed with per-alert evidence.

Alert Rule Location (as reported) Classification One-line reason
1 py/clear-text-logging-sensitive-data src/services/security_detector.py:1021 false positive (dismissed) logs name, a ScanEngine enum id, never a secret; SARIF taint source is the enum member NAME DETECT_SECRETS
2 py/clear-text-logging-sensitive-data src/services/security_detector.py:1030 false positive (dismissed) same: flagged argument is name (engine id)
3 py/clear-text-logging-sensitive-data src/services/security_detector.py:1040 false positive (dismissed) same: name (engine id)
4 py/path-injection src/routers/security/vulnerabilities.py:287 false positive (dismissed) request paths are realpath + commonpath-contained before the flagged isfile; ../NUL rejected earlier by _escaping_paths
5 py/incomplete-url-substring-sanitization src/services/dependency_inventory.py:357 false positive (dismissed) "crates.io" in ecosystems is set membership over ecosystem ids, not URL validation
6 py/incomplete-url-substring-sanitization (cve.mitre.org) src/services/osv_scanner.py:321 real — fixed compare urlsplit(url).hostname with the catalogue host, not a substring
7 py/incomplete-url-substring-sanitization (nvd.nist.gov) src/services/osv_scanner.py:321 real — fixed same fix
8 py/incomplete-url-substring-sanitization tests/unit/test_dependency_visualization.py:178 used in tests (dismissed) list-membership assertion on parsed references
9 py/incomplete-url-substring-sanitization tests/unit/test_trivy_image_scanner.py:228 used in tests (dismissed) substring assertion on a human-readable refusal reason
10 py/incomplete-url-substring-sanitization tests/unit/test_trivy_image_scanner.py:321 used in tests (dismissed) substring assertion on an exception message
11 py/incomplete-url-substring-sanitization tests/unit/test_trivy_image_scanner.py:324 used in tests (dismissed) substring assertion on coverage error text
12 py/incomplete-url-substring-sanitization tests/unit/test_trivy_image_scanner.py:348 used in tests (dismissed) substring assertion on per-image error text

Fix (alerts 6–7)

src/services/osv_scanner.py decided whether a reference URL carried a CVE id with if "cve.mitre.org" in url or "nvd.nist.gov" in url:. A URL that only embeds a catalogue name in its path (https://evil.example/nvd.nist.gov/CVE-…) or as a host prefix (https://nvd.nist.gov.evil.example/…) was accepted as a catalogue reference. _is_cve_reference_url() now compares the parsed urlsplit(url).hostname against the catalogue hosts, and tests/unit/test_osv_scanner.py covers both bypass shapes plus a legitimate mitre URL.

Alerts 1–3 and 8–12 are dismissed with per-alert comments quoting the exact flagged expression. Alerts 6–7 remain open until this fix is on main and the next default-branch CodeQL analysis runs — a PR analysis does not close default-branch alerts. The fix does not weaken any security behaviour; the reference check is strictly more precise.

Gate

  • uv run ruff check . — exit 0
  • uv run ruff format --check . — exit 0
  • uvx ty@0.0.104 check src — exit 0
  • uv run pytest — exit 0 (2911 passed, 5 skipped, 66 deselected; coverage 93.18%)

🤖 Generated with Claude Code

georgiedekker and others added 2 commits November 15, 2026 08:18
The OSV reference check used `"cve.mitre.org" in url` / `"nvd.nist.gov" in url`,
so a URL that merely embeds a catalogue name in its path (or a host prefix like
nvd.nist.gov.evil.example) was accepted as a CVE catalogue reference. Compare
urlsplit(url).hostname against the catalogue hosts instead, and add a
regression test covering both bypass shapes plus the legitimate mitre URL.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@georgiedekker
georgiedekker merged commit 0801925 into main Nov 15, 2026
7 checks passed
@georgiedekker
georgiedekker deleted the lane/scan-highs branch November 15, 2026 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant