Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 43 additions & 15 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ what has already shipped, and for nothing else. See `RELEASING.md`.

## [Unreleased]

### Security

- **opentelemetry-api 1.45.2** in `uv.lock`, from 1.45.1. The older release parses a `traceparent`
header in quadratic time, a denial of service (CVE-2026-126360, GHSA-mf5v-w3w3-f6cg, medium,
published 2026-11-13); 1.45.2, on PyPI since 2026-10-29, is the release the advisory names as fixed.
It arrives through fastapi, so `uv lock --upgrade-package opentelemetry-api` moved that one entry and
nothing else. Dependabot raised the alert on 2026-11-14 but opened no pull request.

### Changed

- **The sqlite3 findings say what Debian decided, and Trivy's two new ones are recorded.** On
Expand Down Expand Up @@ -45,6 +53,29 @@ what has already shipped, and for nothing else. See `RELEASING.md`.

### Fixed

- **The weekly mutation run gets past its stats phase again.** It had been red since 2026-10-24, four
Saturdays, on `assert [13226] == []` in `tests/test_sql_is_not_formatted.py`. mutmut runs the suite
from `mutants/`, where database.py holds every mutant beside the code, and one of them drops the
statement from `db.execute(sql, params)` and leaves the parameters, a tuple built with `*` and `+`,
where the check expects the statement; a few dozen more repeat the listings' ORDER BY, which another
test of the file counts. The three checks now read the database.py in the repository, the same path
without `mutants/`, so they hold or fail under mutmut exactly as they do in the ordinary run. The new
test has mutmut build its copy of the real database.py and reproduced the failure before the fix.

- **The README's badges render, and none states the version by hand.** The README is also the long
description on PyPI. The PyPI badge had been pasted into its own URL and showed as a broken image; it
is one badge again. The static `calver-2026.8.2` badge named a release two months old; it now says
the project uses CalVer, and the version is left to the PyPI badges, which ask PyPI.
`tests/test_readme_badges.py` holds both.

- **Changelog headings.** 2026.40 had two `### Changed` sections, now one; 2026.48 was dated
2026-10-23 with a hyphen, and is now dated 2026-10-24, the day of its tag, with the em dash the other
releases use.

- **The two CodeQL exceptions name the lines CodeQL reports.** Their `where` said `api/main.py:69` and
`ui_harness.js:45`; the open alerts are at lines 145 and 73, the same warning and the same setter,
moved by the code around them. Only the text changed: the gate matches an exception by rule and path.

- **Security Posture reads every page of alerts.** The code scanning API returns at most a hundred
alerts per call, and the gate read one page of each list. Found in cookieradar on 2026-11-13
(cookieradar #70): a pull request with 123 open alerts and main with 142, three exceptions whose
Expand Down Expand Up @@ -72,7 +103,7 @@ what has already shipped, and for nothing else. See `RELEASING.md`.
attempts, 30 s apart) until it succeeds or names the version it could not install: the same
script, and the same `tests/test_install_from_pypi.py`, in all six Radar.

## [2026.48] - 2026-10-23
## [2026.48] — 2026-10-24

### Security

Expand Down Expand Up @@ -1241,20 +1272,6 @@ what has already shipped, and for nothing else. See `RELEASING.md`.
done it. 2026 is a settling year; from 2027 the count moves when the code
moves.


### Fixed

- **An NVD API key, paced requests, and a scan that admits a source was
silent.** Without a key NVD allows five requests per rolling thirty seconds,
and the scanner sent them as fast as it could: the throttling that followed
came back as empty results, which the report presented as "no CVEs" — the
strongest possible claim, produced by not having asked. A key is read from the
environment when present, requests are paced to what the tier actually allows,
and a source that did not answer is reported as a source that did not answer
rather than as an absence of findings.

### Changed

- **The Docker image builds from this repository instead of from a published
release.** The Dockerfile could only install `patchradar==${PATCHRADAR_VERSION}`
from PyPI, with a default of `2026.8.33` — an August release, while the package
Expand All @@ -1267,6 +1284,17 @@ what has already shipped, and for nothing else. See `RELEASING.md`.
database where the volume actually is, which is the failure that once emptied
the watchlist on every container recreation.

### Fixed

- **An NVD API key, paced requests, and a scan that admits a source was
silent.** Without a key NVD allows five requests per rolling thirty seconds,
and the scanner sent them as fast as it could: the throttling that followed
came back as empty results, which the report presented as "no CVEs" — the
strongest possible claim, produced by not having asked. A key is read from the
environment when present, requests are paced to what the tier actually allows,
and a source that did not answer is reported as a source that did not answer
rather than as an absence of findings.

## [2026.9.6] — 2026-09-24

### Fixed
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ PatchRadar checks the CVE feeds for the software on your watchlist, most urgent
Scans run when you start one — `patchradar scan`, or **Scan** in the web UI. There is no scheduler and no notification inside PatchRadar: to scan on a schedule, run `patchradar scan` from cron or the Windows Task Scheduler.

![Python](https://img.shields.io/badge/python-3.11+-blue?style=flat-square)
![CalVer](https://img.shields.io/badge/calver-2026.8.2-green?style=flat-square)
![CalVer](https://img.shields.io/badge/versioning-CalVer-green?style=flat-square)
![License](https://img.shields.io/badge/license-MIT-blue?style=flat-square)
![PyPI](https://img.shields.io/pypi/v/patchradar?style=flat-square![PyPI](https://img.shields.io/pypi/v/patchradar?style=flat-square)label=pypi)
![PyPI](https://img.shields.io/pypi/v/patchradar?style=flat-square&label=pypi)
[![CodSpeed](https://img.shields.io/endpoint?url=https://codspeed.io/badge.json)](https://app.codspeed.io/maksimtech/patchradar?utm_source=badge)

---
Expand Down
4 changes: 2 additions & 2 deletions SECURITY-EXCEPTIONS.toml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ review_by = "2026-12-31"
id = "py/clear-text-logging-sensitive-data"
source = "CodeQL"
path = "src/patchradar/api/main.py"
where = "api/main.py:69, the warning logged when no API key is configured"
where = "api/main.py:145, the warning logged when no API key is configured"
why = """
The expression logs API_KEY_ENV, which is the *name* of the environment variable \
("PATCHRADAR_API_KEY"), never its value — and it is only reached when \
Expand All @@ -139,7 +139,7 @@ review_by = "2026-12-31"
id = "js/incomplete-multi-character-sanitization"
source = "CodeQL"
path = "tests/js/ui_harness.js"
where = "ui_harness.js:45, the innerHTML setter of the fake DOM"
where = "ui_harness.js:73, the innerHTML setter of the fake DOM"
why = """
It is not a sanitizer. The harness models a browser for the UI tests, and its \
innerHTML setter strips tags to record what the page assigned; no untrusted input \
Expand Down
45 changes: 45 additions & 0 deletions tests/test_readme_badges.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
"""The README's badges are well formed, and none of them states the version by hand.

The README is also the long description on PyPI, so what is broken here is broken
there too. On 2026-11-16 one badge held another inside its URL, the PyPI one pasted
into itself, and rendered as a broken image; another, a static `calver-2026.8.2`,
named a release that had been out of date for two months. A version belongs in a
badge that asks PyPI for it, which cannot fall behind.
"""

from __future__ import annotations

import re
from pathlib import Path

README = Path(__file__).resolve().parents[1] / "README.md"

# `![alt](url)`, the URL up to the first closing parenthesis or space.
IMAGE = re.compile(r"!\[[^\]]*\]\(([^)\s]*)")

# A CalVer number of this project's shape: 2026.48, 2026.8.2.
VERSION = re.compile(r"\b20\d\d\.\d+(?:\.\d+)?\b")


def _image_urls() -> list[str]:
return IMAGE.findall(README.read_text(encoding="utf-8"))


def test_no_image_link_holds_another():
assert [url for url in _image_urls() if "![" in url] == []


def test_no_static_badge_states_a_version():
static = [url for url in _image_urls() if "img.shields.io/badge/" in url]
assert static, "the README has no static badge left to check"
assert [url for url in static if VERSION.search(url)] == []


def test_the_patterns_recognise_what_was_broken():
pasted = (
"![PyPI](https://img.shields.io/pypi/v/patchradar?style=flat-square"
"![PyPI](https://img.shields.io/pypi/v/patchradar?style=flat-square)label=pypi)"
)
assert "![" in IMAGE.findall(pasted)[0]
assert VERSION.search("https://img.shields.io/badge/calver-2026.8.2-green?style=flat-square")
assert not VERSION.search("https://img.shields.io/badge/python-3.11+-blue?style=flat-square")
52 changes: 48 additions & 4 deletions tests/test_sql_is_not_formatted.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,31 @@
import patchradar.db.database as database
from patchradar.priority import sql_order

SOURCE = pathlib.Path(database.__file__).read_text(encoding="utf-8")
DML = re.compile(r"^\s*(SELECT|INSERT|UPDATE|DELETE)\b", re.I)


def _formatted_statements() -> list[int]:
def _repository_file(path: pathlib.Path) -> pathlib.Path:
"""The file in the repository that `path` stands for.

mutmut copies the repository into `mutants/` and imports the package from
there, so `database.__file__` is its copy, with every mutant beside the code;
the file the checks are about is the same path without that component. The
claims are about what is written, which a mutant does not change: under mutmut
they hold or fail exactly as they do in the ordinary run.
"""
parts = path.parts
if "mutants" not in parts:
return path
cut = len(parts) - 1 - parts[::-1].index("mutants")
return pathlib.Path(*parts[:cut], *parts[cut + 1 :])


SOURCE = _repository_file(pathlib.Path(database.__file__)).read_text(encoding="utf-8")


def _formatted_statements(source: str) -> list[int]:
lines = []
for node in ast.walk(ast.parse(SOURCE)):
for node in ast.walk(ast.parse(source)):
if not (isinstance(node, ast.Call) and getattr(node.func, "attr", "") in {"execute", "executemany"}):
continue
if not node.args:
Expand All @@ -43,7 +61,33 @@ def _formatted_statements() -> list[int]:


def test_no_select_insert_update_or_delete_is_a_formatted_string():
assert _formatted_statements() == []
assert _formatted_statements(SOURCE) == []


def test_under_mutmut_the_checks_read_the_repository_not_its_copy(tmp_path):
"""mutmut runs the suite from `mutants/`, a copy of the repository in which
database.py holds, beside every function, each of its mutated variants. One
of them drops the statement from `db.execute(sql, params)` and leaves the
parameters first, a tuple built with `*` and `+`, which is a formatted
statement to the check above; another few dozen repeat the listings' ORDER
BY. Read there, the checks fail on code nobody wrote, and the weekly mutation
run stopped in its stats phase on 2026-10-24 and every Saturday since.

The copy is made by mutmut itself, from the real database.py, in a tree laid
out as mutmut lays out its own.
"""
from mutmut.mutation.file_mutation import mutate_file_contents

source = _repository_file(pathlib.Path(database.__file__)).read_text(encoding="utf-8")
original = tmp_path / "src" / "patchradar" / "db" / "database.py"
copy = tmp_path / "mutants" / "src" / "patchradar" / "db" / "database.py"
for path in (original, copy):
path.parent.mkdir(parents=True)
original.write_text(source, encoding="utf-8")
copy.write_text(mutate_file_contents(str(original), source).code, encoding="utf-8")

assert _formatted_statements(copy.read_text(encoding="utf-8")) != []
assert _formatted_statements(_repository_file(copy).read_text(encoding="utf-8")) == []


def test_the_listings_are_ordered_by_what_priority_ranks_by():
Expand Down
6 changes: 3 additions & 3 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.