Skip to content

Commit 9395bd4

Browse files
committed
0.14.0
1 parent 202bf81 commit 9395bd4

3 files changed

Lines changed: 20 additions & 65 deletions

File tree

.github/workflows/publish.yml

Lines changed: 0 additions & 63 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
tags:
66
- 'v*.*.*'
77

8+
permissions:
9+
contents: read
10+
811
jobs:
912
build-and-publish:
1013
runs-on: ubuntu-latest

sploitscan/cli.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,29 @@ def _public_exploits_bundle(cve_id: str, *, config: Dict[str, Any], cve_data: Di
7373
github_data, _ = fetch_github_pocs(cve_id)
7474

7575
# Fallback: if PoC-in-GitHub API returns nothing, derive GitHub entries from CVE references
76+
# Use strict URL parsing and host allow‑list to avoid substring-based checks.
7677
if not (github_data and isinstance(github_data, dict) and github_data.get("pocs")):
7778
try:
79+
from urllib.parse import urlparse
7880
refs = (cve_data or {}).get("containers", {}).get("cna", {}).get("references", [])
7981
fallback: list[dict] = []
82+
allowed_hosts = {
83+
"github.com",
84+
"www.github.com",
85+
"gist.github.com",
86+
"raw.githubusercontent.com",
87+
}
8088
for ref in refs or []:
8189
url = (ref or {}).get("url", "")
82-
if "github.com/" in url:
83-
fallback.append({"html_url": url, "created_at": "N/A"})
90+
try:
91+
parsed = urlparse(url)
92+
host = (parsed.hostname or "").lower()
93+
scheme_ok = parsed.scheme in {"http", "https"}
94+
if scheme_ok and host in allowed_hosts:
95+
fallback.append({"html_url": url, "created_at": "N/A"})
96+
except Exception:
97+
# Ignore malformed URLs
98+
continue
8499
if fallback:
85100
github_data = {"pocs": fallback}
86101
except Exception:

0 commit comments

Comments
 (0)