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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ dependencies = [
# TIFF or PDF within our limits (imaging.open_image and check_pdf). Grew
# out of this package; 0.x minor releases are additive, a breaking one
# becomes 1.0 and stops at the ceiling.
"sillybos>=4,<5",
"sillybos>=5,<6",
"python-dotenv>=1.0",
# Writes the searchable PDF. Core rather than an extra because the roadmap
# treats that as the flagship catalogue-ready output, and it should work on
Expand Down
18 changes: 13 additions & 5 deletions site/tests/site.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,12 @@ test("the security watch renders the advisory record everywhere it is promised",
const count = await rows.count();
expect(count).toBeGreaterThan(0);
for (const row of await rows.all()) {
await expect(row.locator("td:nth-child(2) a")).toHaveAttribute("href", /\/security\/cve-[\w-]+\/$/);
// A record is keyed by its CVE, or by the GHSA or PYSEC id when no CVE
// was assigned; the first GHSA-keyed record arrived with sillybos 4.2.0.
await expect(row.locator("td:nth-child(2) a")).toHaveAttribute(
"href",
/\/security\/(cve|ghsa|pysec)-[\w-]+\/$/
);
await expect(row.locator(".verdict")).not.toBeEmpty();
}

Expand Down Expand Up @@ -327,9 +332,12 @@ async function allPages(request: APIRequestContext, baseURL: string): Promise<st
}

test("every image on every page actually loads", async ({ page, request, baseURL }) => {
// Every page, with a wait for the network to go quiet on each: the security
// watch took the site past a hundred pages and past the default 30 s.
test.slow();
// Every page, with a wait for the network to go quiet on each. The security
// watch took the site past a hundred pages, and the completed backfill past
// the tripled default of 90 s, so the budget follows the page count: two
// seconds a page, and never less than the old 90.
const pages = await allPages(request, baseURL!);
test.setTimeout(Math.max(90_000, pages.length * 2_000));
// The migration published a site on which all 19 corpus images were dead
// links, behind a green build and a green test suite: the markdown still
// carried mkdocs-relative paths. Parsing the HTML for src attributes is what
Expand All @@ -338,7 +346,7 @@ test("every image on every page actually loads", async ({ page, request, baseURL
// bytes arrived cannot be fooled that way.
const broken: string[] = [];

for (const url of await allPages(request, baseURL!)) {
for (const url of pages) {
await page.goto(url);
// Lazy images below the fold never load in a short viewport, so force them.
await page.evaluate(() =>
Expand Down
24 changes: 24 additions & 0 deletions tests/ocr/test_input_limits.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,30 @@ def test_a_pdf_that_carries_javascript_is_refused(self, tmp_path: Path) -> None:
with pytest.raises(InputRefusedError, match="a PDF with JavaScript"):
check_pdf(path)

def test_a_tiff_whose_tags_contradict_each_other_is_refused(self, tmp_path: Path) -> None:
"""sillybos 5 refuses a floating-point Predictor on integer samples; the reason reaches triage."""
import struct

# One 8-bit greyscale LZW frame, 4 by 4, with Predictor 3, which only
# floating-point samples can carry (CVE-2026-112396).
entries = [
(256, 3, 1, 4), # ImageWidth
(257, 3, 1, 4), # ImageLength
(258, 3, 1, 8), # BitsPerSample
(259, 3, 1, 5), # Compression: LZW
(262, 3, 1, 1), # PhotometricInterpretation: black is zero
(317, 3, 1, 3), # Predictor: floating point
]
ifd = struct.pack("<H", len(entries))
for tag, kind, count, value in entries:
ifd += struct.pack("<HHIH2x", tag, kind, count, value)
ifd += struct.pack("<I", 0)
path = tmp_path / "contradicting.tif"
path.write_bytes(b"II*\x00" + struct.pack("<I", 8) + ifd)

with pytest.raises(InputRefusedError, match="tags contradict each other"):
open_image(path)


class TestPageSize:
def test_pillows_one_dpi_for_no_resolution_is_not_believed(self) -> None:
Expand Down
10 changes: 5 additions & 5 deletions uv.lock

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

Loading