From 2c4a7a6d95f254eda95654751881dca655ac940a Mon Sep 17 00:00:00 2001 From: Stephen Masters Date: Wed, 4 Nov 2026 11:36:15 +0000 Subject: [PATCH 1/2] feat(imaging): refuse a TIFF whose tags contradict each other, with sillybos 5 Raises the pin from >=4,<5 to >=5,<6. sillybos 5.0.0 refuses by default a TIFF whose ColorMap does not fit its bit depth or whose Predictor is floating point on integer samples, which no scanner writes and which exist to reach an encoder that trusts the tag; such a file now goes to the triage queue with the reason. 4.2.0's tag sorting (standard, metadata, private) comes with it, allowing all three, as Tetrak reads scans and never saves a file back with its tag table. Every TIFF in this checkout passes under the new default. Co-authored-by: Yvette Mankerian Co-Authored-By: Claude Fable 5.1 --- pyproject.toml | 2 +- tests/ocr/test_input_limits.py | 24 ++++++++++++++++++++++++ uv.lock | 10 +++++----- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 9500b5e..efb708c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 diff --git a/tests/ocr/test_input_limits.py b/tests/ocr/test_input_limits.py index c6d7beb..04dd713 100644 --- a/tests/ocr/test_input_limits.py +++ b/tests/ocr/test_input_limits.py @@ -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(" None: diff --git a/uv.lock b/uv.lock index 94f61ac..e5424bc 100644 --- a/uv.lock +++ b/uv.lock @@ -1,5 +1,5 @@ version = 1 -revision = 5 +revision = 3 requires-python = ">=3.11" resolution-markers = [ "python_full_version >= '3.14' and sys_platform == 'darwin'", @@ -4231,11 +4231,11 @@ wheels = [ [[package]] name = "sillybos" -version = "4.0.0" +version = "5.0.0" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/62/b0/d81799aa58c1b6914409089de10f74ccd59e02157ace8e9e1afde27b8b13/sillybos-4.0.0.tar.gz", hash = "sha256:d267e6009b4e8e742e11c23d71f93e31c535efbea6502aa93f781b4638cf307d", size = 613210, upload-time = "2026-11-01T22:52:35.522Z" } +sdist = { url = "https://files.pythonhosted.org/packages/1e/4b/2afcb5f406492f7748f7053c3666be0bb9a75d98a57fe51f8d68c01d85a0/sillybos-5.0.0.tar.gz", hash = "sha256:f5f9b2f18dc0d396aacc3e1ad8ee7537749e6f67dfb42997a3a45863802e32d8", size = 655464, upload-time = "2026-11-03T17:11:19.194Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/8d/35/108931718880ef090b111582646e092bb0cb8010301f75ab94c2d15a4509/sillybos-4.0.0-py3-none-any.whl", hash = "sha256:85b6b438cc23065cd7e26374a20b200055b68b30f86ed37433353daa3ff80c9d", size = 38384, upload-time = "2026-11-01T22:52:34.173Z" }, + { url = "https://files.pythonhosted.org/packages/d9/dd/e066e4eca9f8d3dda19a1eb944eff4b024c5d12b05cf65eec7b782f0cec4/sillybos-5.0.0-py3-none-any.whl", hash = "sha256:46da1e20355490dfaf10944120a5c01b46b9436afdb3fcc4245f464bfee8b4d8", size = 43122, upload-time = "2026-11-03T17:11:17.484Z" }, ] [[package]] @@ -4660,7 +4660,7 @@ requires-dist = [ { name = "python-pptx", marker = "extra == 'docs'", specifier = ">=0.6" }, { name = "reportlab", specifier = ">=4.0" }, { name = "ruff", marker = "extra == 'dev'", specifier = ">=0.5" }, - { name = "sillybos", specifier = ">=4,<5" }, + { name = "sillybos", specifier = ">=5,<6" }, { name = "sphinx", marker = "extra == 'apidocs'", specifier = ">=8.0" }, { name = "sphinx-argparse", marker = "extra == 'apidocs'", specifier = ">=0.6.1" }, { name = "tetrak-easyocr-armenian", marker = "extra == 'armenian'", specifier = ">=0.8" }, From 59d3d5455f31aba9b7942b302b441ede2e0c41a9 Mon Sep 17 00:00:00 2001 From: Stephen Masters Date: Wed, 4 Nov 2026 11:44:45 +0000 Subject: [PATCH 2/2] fix(site): let the security watch's tests follow the completed record Two smoke tests broke once sillybos's record was complete. The watch test expected every row to link to a CVE page, and the record now holds one advisory keyed by its GHSA id, since no CVE was assigned; it accepts CVE, GHSA and PYSEC keys. The image walk visited every page under the tripled default of 90 s, and the 123 record pages took it past that; its budget now follows the page count, two seconds a page and never less than the old 90. Co-authored-by: Yvette Mankerian Co-Authored-By: Claude Fable 5.1 --- site/tests/site.spec.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/site/tests/site.spec.ts b/site/tests/site.spec.ts index 7e0abe1..0a51e75 100644 --- a/site/tests/site.spec.ts +++ b/site/tests/site.spec.ts @@ -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(); } @@ -327,9 +332,12 @@ async function allPages(request: APIRequestContext, baseURL: string): Promise { - // 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 @@ -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(() =>