Skip to content

fix(deps): bump soupsieve to 4.1 to fix CSS selector DoS CVEs - #140

Open
HC-ONLINE wants to merge 1 commit into
mainfrom
fix/soupsieve-python-floor
Open

HC-ONLINE wants to merge 1 commit into
mainfrom
fix/soupsieve-python-floor

Conversation

@HC-ONLINE

Copy link
Copy Markdown
Owner

Summary

Resolves the 4 open Dependabot alerts on soupsieve (#26–#29: 2 high, 2 moderate) — and unlike the previous dev-only bumps, these are real runtime vulnerabilities in the product.

Alert CVE Severity Vulnerability Fix
#27 CVE-2026-126190 high Polynomial-time DoS in the descendant combinator 4.0.0
#29 CVE-2026-126191 high Exponential ReDoS in selector compilation (\9-run) 3.0.2
#28 CVE-2026-126193 medium Uncontrolled CSS parser recursion exhausts the call stack 3.0.2
#26 CVE-2026-126192 medium Quadratic :has() general sibling matching on untrusted HTML 2.10.0

Why this one matters

soupsieve is a runtime transitive dependency of beautifulsoup4==4.15.0, and the scraper runs .select() / .select_one() in 21 places (extractor.py, helpers.py, static.py, dynamic.py, scrape_service.py) against attacker-controlled HTML — that is the tool's core function. A malicious target page could hang or CPU-exhaust the scanner (DoS), which is exactly what these advisories describe.

Root cause of the floor change

Fixing all four alerts requires soupsieve >= 4.0.0 (latest: 4.1). Every soupsieve release from 3.0 onward requires Python >= 3.11.5, while the project had requires-python = ">=3.11" (3.11.0+).

The dry run showed the consequence — the same split-lock pattern seen earlier with filelock/3.10:

Update soupsieve v2.9.2 -> v2.10, v4.1

2.10 (selected for 3.11.0–3.11.4) is still vulnerable to 3 of the 4 advisories, so Dependabot would have kept them open. Narrowing the floor to >=3.11.5 yields a single soupsieve 4.1 entry and closes all 4.

Scope of the narrowing: it only excludes Python 3.11.0–3.11.4 (2022–2023 patches that have their own known CVEs, e.g. CVE-2023-40217). CI's 3.11 matrix entry installs the latest patch (3.11.17) and Docker already ships python:3.14-slim.

Changes

  • pyproject.toml: requires-python = ">=3.11.5"
  • uv.lock: soupsieve 2.9.2 -> 4.1 (single entry, no split); drops tomli (a <3.11 backport no longer reachable)
  • Docs: README badge, docs/INSTALLATION.md, docs/DEVELOPMENT.md, AGENTS.md

Validation

  • uv sync --extra api --extra dev — clean, soupsieve==4.1 installed
  • uv run ruff check . — all checks pass
  • uv run pyright — 0 errors, 0 warnings
  • uv run pytest -m "not slow and not network" — 2126 passed, 3 failed; the 3 are the pre-existing network-fixture failures that reproduce identically on main. The passing suite includes the scraping tests that exercise BeautifulSoup CSS selectors against soupsieve 4.1.

Notes

Resolves 4 open Dependabot alerts on soupsieve (a runtime transitive
dependency of beautifulsoup4, used by the scraper's 21 .select()/
.select_one() calls against attacker-controlled HTML):

- CVE-2026-126190 (high): polynomial DoS in the descendant combinator
- CVE-2026-126191 (high): exponential ReDoS in selector compilation
- CVE-2026-126193 (medium): uncontrolled CSS parser recursion
- CVE-2026-126192 (medium): quadratic :has() sibling matching

soupsieve 3.x/4.x require Python >= 3.11.5, so the previous floor of
>=3.11 made uv resolve a split lock (2.10 for 3.11.0-3.11.4) that would
leave 3 of the 4 alerts open. Narrow requires-python to >=3.11.5 to get
a single soupsieve 4.1 entry; this only excludes 3.11.0-3.11.4 (2022-2023
patches that have their own known CVEs). CI's '3.11' installs the latest
patch (3.11.17) and Docker already ships 3.14.

Also drops tomli, a <3.11 backport no longer reachable.

Validated with ruff, pyright (0 errors) and pytest: 2126 passed; the 3
failures are the pre-existing network-fixture ones that also fail on
main.
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