From 5fcfddd754ab7b39edb079dcf2e1773b9b4fa2f3 Mon Sep 17 00:00:00 2001 From: Stephen Masters Date: Sun, 1 Nov 2026 18:27:23 +0000 Subject: [PATCH 1/2] feat(site): the security watch at /security/, and sillybos as a product A section built at build time from sillybos's advisory record: one page per advisory (/security/cve-2026-112403/), one per library, an index with the watchlist and every row, an RSS feed and a JSON export, plus a hand-written guide, Protecting yourself. The record is fetched from the sillybos repository through a content adapter rather than copied, so the site cannot drift from it; the fetch is the one URL the build may read (security.http.urls), and a failed fetch fails the build. A weekly workflow asks Cloudflare to rebuild after sillybos's Monday advisory run, once CLOUDFLARE_DEPLOY_HOOK is set. sillybos gets a product page and a card, and a Security entry joins the masthead. baseof now guards the edit link for pages that have no file. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_018UhHdevgBGz837t9dcHohQ --- .github/workflows/site-refresh.yml | 38 +++++++ site/assets/scss/_components.scss | 93 ++++++++++++++++ site/config/_default/hugo.toml | 18 ++++ site/config/_default/menus/menu.en.toml | 14 +++ site/content/products.md | 12 ++- site/content/security/_content.gotmpl | 84 +++++++++++++++ site/content/security/_index.md | 34 ++++++ site/content/security/protecting-yourself.md | 99 +++++++++++++++++ site/content/sillybos.md | 100 +++++++++++++++++ site/data/watch.toml | 65 +++++++++++ site/layouts/_default/baseof.html | 6 +- site/layouts/partials/advisory-verdict.html | 34 ++++++ site/layouts/security/list.html | 99 +++++++++++++++++ site/layouts/security/list.json | 12 +++ site/layouts/security/single.html | 107 +++++++++++++++++++ 15 files changed, 812 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/site-refresh.yml create mode 100644 site/content/security/_content.gotmpl create mode 100644 site/content/security/_index.md create mode 100644 site/content/security/protecting-yourself.md create mode 100644 site/content/sillybos.md create mode 100644 site/data/watch.toml create mode 100644 site/layouts/partials/advisory-verdict.html create mode 100644 site/layouts/security/list.html create mode 100644 site/layouts/security/list.json create mode 100644 site/layouts/security/single.html diff --git a/.github/workflows/site-refresh.yml b/.github/workflows/site-refresh.yml new file mode 100644 index 0000000..12bc011 --- /dev/null +++ b/.github/workflows/site-refresh.yml @@ -0,0 +1,38 @@ +# Rebuild tetrak.dev on a schedule, so the security watch at /security/ +# picks up sillybos's advisory record without a commit here. +# +# The site is built and published by Cloudflare Pages on every push to main. +# The watch is fetched from sillybos at build time, so a change to the +# record only reaches the site when something triggers a build. sillybos's +# advisory job runs on Mondays at 07:00 UTC; this runs two hours later and +# asks Cloudflare to build again, through a deploy hook. +# +# One secret: CLOUDFLARE_DEPLOY_HOOK, the hook's URL from the Pages +# project's settings (Builds & deployments → Deploy hooks). The URL is the +# credential, which is why it is a secret and never printed. Until it is +# set, the job says so and does nothing, so the workflow can land before +# the hook exists. +name: Refresh the site + +on: + schedule: + - cron: "0 9 * * 1" # Mondays 09:00 UTC, after sillybos's advisory run + workflow_dispatch: + +permissions: {} + +jobs: + refresh: + name: Ask Cloudflare to rebuild + runs-on: ubuntu-latest + steps: + - name: Trigger the deploy hook + env: + HOOK: ${{ secrets.CLOUDFLARE_DEPLOY_HOOK }} + run: | + if [ -z "$HOOK" ]; then + echo "::notice::CLOUDFLARE_DEPLOY_HOOK is not set; nothing to trigger" + exit 0 + fi + curl --fail --silent --show-error --request POST "$HOOK" --output /dev/null + echo "Rebuild requested." diff --git a/site/assets/scss/_components.scss b/site/assets/scss/_components.scss index a39db89..7d5ec5e 100644 --- a/site/assets/scss/_components.scss +++ b/site/assets/scss/_components.scss @@ -781,3 +781,96 @@ } } } + +// The security watch: the advisory table, the verdict label and the facts +// list on an advisory page. Same bargain as the article apparatus: mono +// labels, hairlines and air, no boxes and no second accent. A verdict is +// a mono label like a kicker; the modifiers change nothing but weight, so +// that "refused by default" and "needs decoding to detect" read as the same +// kind of thing and the sentence beside them does the work. +.watch { + &__date { + font-family: var(--font-mono); + font-variant-numeric: tabular-nums; + white-space: nowrap; + } + + &__key { + display: block; + font-family: var(--font-mono); + font-size: 0.75rem; + color: var(--ink-soft); + } + + &__counts { + font-family: var(--font-mono); + font-size: 0.75rem; + letter-spacing: 0.08em; + text-transform: uppercase; + color: var(--ink-soft); + } + + &__libraries { + display: grid; + gap: 0.4rem 1.5rem; + margin: 0 0 2.4rem; + + dt { + font-family: var(--font-display); + margin-top: 0.6rem; + } + + dd { + margin: 0; + max-width: var(--measure); + } + } + + &__package { + font-family: var(--font-mono); + font-size: 0.75rem; + color: var(--ink-soft); + margin-left: 0.6em; + } +} + +.verdict { + font-family: var(--font-mono); + font-size: 0.75rem; + letter-spacing: 0.06em; + text-transform: uppercase; + white-space: nowrap; + color: var(--ink-soft); + + &--default { + color: var(--clay-deep); + } +} + +.advisory { + &__facts { + display: grid; + grid-template-columns: max-content 1fr; + gap: 0.35rem 1.5rem; + margin: 0 0 2.4rem; + border-top: 2px solid var(--clay); + padding-top: 1rem; + + dt { + font-family: var(--font-mono); + font-size: 0.75rem; + letter-spacing: 0.08em; + text-transform: uppercase; + color: var(--ink-soft); + padding-top: 0.2rem; + } + + dd { + margin: 0; + } + } + + &__tests code { + font-size: 0.8rem; + } +} diff --git a/site/config/_default/hugo.toml b/site/config/_default/hugo.toml index 157713f..6959198 100644 --- a/site/config/_default/hugo.toml +++ b/site/config/_default/hugo.toml @@ -49,6 +49,15 @@ capitalizeListTitles = false [build] writeStats = true +# The one place the build fetches from at build time: the advisory record +# behind /security/ (params.advisoriesURL). An allow-list rather than Hugo's +# permissive default, so that a template cannot quietly start reading from +# somewhere else. Override with HUGO_SECURITY_HTTP_URLS to build against a +# local copy. +[security] + [security.http] + urls = ['^https://raw\.githubusercontent\.com/scattercode/sillybos/'] + [outputs] # index.json is the search index: built once at build time and filtered in # the browser, rather than a search service. Build time over runtime. @@ -78,6 +87,15 @@ capitalizeListTitles = false # describes several tools, each in its own repository under it. org = "https://github.com/scattercode" + # The security watch at /security/ is built from sillybos's advisory record + # (docs/advisories/record.json in that repository): one page per advisory + # and one per library, created at build time by content/security/ + # _content.gotmpl from this file. Fetched rather than copied, so the site + # cannot drift from the record; the weekly refresh workflow rebuilds the + # site after sillybos's Monday advisory run. Override with + # HUGO_PARAMS_ADVISORIESURL to build against a branch. + advisoriesURL = "https://raw.githubusercontent.com/scattercode/sillybos/main/docs/advisories/record.json" + # Plausible: privacy-friendly, no cookies, no consent banner needed. # # First-party path served by the Cloudflare Pages Function at diff --git a/site/config/_default/menus/menu.en.toml b/site/config/_default/menus/menu.en.toml index 2668250..fc915b3 100644 --- a/site/config/_default/menus/menu.en.toml +++ b/site/config/_default/menus/menu.en.toml @@ -41,6 +41,12 @@ pageRef = "/translit" weight = 3 +[[main]] + name = "sillybos" + parent = "products" + pageRef = "/sillybos" + weight = 4 + # Beside Products rather than at the end: the split between the free tools # and the paid work is the first thing a visitor should be able to see. [[main]] @@ -56,6 +62,14 @@ # Added August 2026 with the articles section. It sits next to Research # because it is the same kind of thing: writing about the problem and about # the tools' progress, alongside the fixed evidence. +# Added November 2026 with the security watch. A reference page rather than +# writing: the advisories on the image and PDF libraries everyone decodes +# with, what each one takes to trigger, and how to protect yourself. +[[main]] + name = "Security" + pageRef = "/security" + weight = 35 + [[main]] name = "Articles" pageRef = "/articles" diff --git a/site/content/products.md b/site/content/products.md index 834a5dd..9ef4b1c 100644 --- a/site/content/products.md +++ b/site/content/products.md @@ -1,8 +1,8 @@ --- title: "Products" kicker: "Open source" -standfirst: "Three tools, free and open source. Each works on its own, on your own machine, without us." -description: "Tetrak's open-source tools: Tetrak OCR for turning scans into searchable text, the Armenian text recogniser, and tetrak-translit for transliteration and cross-script search." +standfirst: "Four tools, free and open source. Each works on its own, on your own machine, without us." +description: "Tetrak's open-source tools: Tetrak OCR for turning scans into searchable text, the Armenian text recogniser, tetrak-translit for transliteration and cross-script search, and sillybos for checking a file before any decoder opens it." --- Everything here is published under an open licence, with the code, the @@ -33,4 +33,12 @@ what [our services]({{< relref "/services.md" >}}) are for. standard, and folds every spelling of a name to one form for searching. Armenian, Georgian, Russian and Syriac so far. +- **[sillybos]({{< relref "/sillybos.md" >}})** + + Decides, before any image library or PDF renderer opens a file, whether + it is one of the formats you meant to read and within the limits you + expect, and says why not in a sentence. No dependencies. The + [security watch]({{< relref "/security/_index.md" >}}) records which + published flaws it refuses. + diff --git a/site/content/security/_content.gotmpl b/site/content/security/_content.gotmpl new file mode 100644 index 0000000..42ddfbb --- /dev/null +++ b/site/content/security/_content.gotmpl @@ -0,0 +1,84 @@ +{{- /* + Content adapter for the security watch. + + Fetches sillybos's advisory record (site.Params.advisories_url, the + record.json that scripts/advisory_record.py in that repository generates) + and creates one page per advisory at /security// and one per library + at /security//. The pages carry the record's fields as params; + layouts/security/single.html renders them and layouts/security/list.html + lists them. Nothing is copied into this repository, so the site cannot + drift from the record. + + A fetch failure fails the build rather than publishing a watch with no + rows in it: a page that silently went empty is worse than a build that + says why. +*/ -}} +{{- $url := site.Params.advisoriesURL }} +{{- if not $url }}{{ errorf "security: site.Params.advisoriesURL is not set" }}{{ end }} +{{- $opts := dict "headers" (dict "Accept" "application/json") }} +{{- $attempt := try (resources.GetRemote $url $opts) }} +{{- if $attempt.Err }} + {{- errorf "security: could not fetch the advisory record from %s: %s" $url $attempt.Err }} +{{- else if not $attempt.Value }} + {{- errorf "security: nothing came back from %s" $url }} +{{- else }} + {{- with $attempt.Value.Content }} + {{- $record := . | transform.Unmarshal }} + {{- $generated := $record.generated }} + {{- $libraries := hugo.Data.watch.library }} + + {{- /* One page per advisory. The path is the key, lowercased, so a + reader who searches a CVE id lands on /security/cve-2026-112900/. + The date is when the advisory was published, or when it was + triaged if upstream gave no date, so the feed and the ordering + have something to go on. */ -}} + {{- $seen := dict }} + {{- range $record.records }} + {{- $key := .key }} + {{- $slug := lower $key }} + {{- $date := .published | default .triaged }} + {{- $libslug := lower .library }} + {{- $seen = merge $seen (dict $libslug true) }} + {{- $page := dict + "path" $slug + "kind" "page" + "title" .title + "date" $date + "description" .summary + "params" (dict + "kind" "advisory" + "advisory" . + "library_slug" $libslug + "generated" $generated + "kicker" (printf "Security · %s" .library) + "standfirst" .summary) + "content" (dict "mediaType" "text/markdown" "value" .summary) + }} + {{- $.AddPage $page }} + {{- end }} + + {{- /* One page per library that has at least one record. The watchlist + in data/watch.toml names the rest; the index lists them. */ -}} + {{- range $slug, $_ := $seen }} + {{- $lib := index $libraries $slug }} + {{- if not $lib }} + {{- errorf "security: the record names a library, %q, that data/watch.toml does not describe" $slug }} + {{- end }} + {{- $page := dict + "path" $slug + "kind" "page" + "title" (printf "%s advisories" $lib.name) + "description" (printf "Published security flaws in %s, what each one takes to trigger, and whether a check before decoding refuses the file." $lib.name) + "params" (dict + "kind" "library" + "library" $lib + "library_slug" $slug + "generated" $generated + "kicker" "Security" + "standfirst" $lib.what) + "content" (dict "mediaType" "text/markdown" "value" $lib.what) + }} + {{- $.AddPage $page }} + {{- end }} + {{- end }} +{{- end }} diff --git a/site/content/security/_index.md b/site/content/security/_index.md new file mode 100644 index 0000000..873db9f --- /dev/null +++ b/site/content/security/_index.md @@ -0,0 +1,34 @@ +--- +title: "Imaging security watch" +kicker: "Security" +standfirst: "The published security flaws in the libraries that decode images and PDFs, what each one takes to trigger, and how to protect a pipeline that opens files it did not make. Kept current from sillybos's advisory record, rebuilt weekly." +description: "A current record of security vulnerabilities (CVEs) in image and PDF libraries: Pillow, libtiff, libpng, libjpeg-turbo, poppler and others. For each: what triggers it, whether it is reached by opening a file, which are refused before decoding, and how to protect yourself." +outputs: [html, rss, json] +--- + +Every program that reads scans hands each file to a decoder, and decoders +have flaws. In October 2026 Pillow fixed more than thirty at once, several +of them reachable by opening a single crafted file. Anyone who runs an OCR +pipeline, a thumbnailer or an upload form has the same question each time +one is announced: *does this reach me, and what do I do?* + +This page is our answer, written down. It comes from the work behind +[sillybos]({{< relref "/sillybos.md" >}}), the library that decides whether +a file may be opened before any decoder sees it: every advisory on the +libraries we watch is fetched weekly, read by a person, and recorded with +what triggers it, whether opening a file reaches it, whether a check before +decoding would have refused the file, and how to protect yourself with or +without that check. The record is [public +data](https://github.com/scattercode/sillybos/tree/main/docs/advisories/record) +in the sillybos repository; this page is built from it. + +Three things it is not. It is not a vulnerability database: OSV.dev and the +GitHub Advisory Database are, and every row links to them. It is not a +claim that sillybos prevents everything: a row says **refused by default** +only where a test in the sillybos suite builds the triggering file and +proves it is refused, and many rows say plainly that nothing before the +decoder can help. And it is not advice to skip upgrading. The first line of +every "how to protect yourself" entry is the fixed version. + +If you only want the general advice, read [Protecting +yourself]({{< relref "/security/protecting-yourself.md" >}}). diff --git a/site/content/security/protecting-yourself.md b/site/content/security/protecting-yourself.md new file mode 100644 index 0000000..b41b48c --- /dev/null +++ b/site/content/security/protecting-yourself.md @@ -0,0 +1,99 @@ +--- +title: "Protecting yourself" +kicker: "Security" +standfirst: "What a pipeline that opens images and PDFs it did not make can do about the flaws in its decoders, in order of how much each step buys. None of it replaces upgrading; all of it helps when the next flaw has no fix yet." +description: "How to protect an OCR pipeline, thumbnailer or upload handler from vulnerabilities in image and PDF libraries: pin and scan, allow-list formats, set limits, check before decoding, decode in a boxed process, and keep a routine for the next advisory." +weight: 1 +--- + +Every row in the [watch]({{< relref "/security/_index.md" >}}) ends with +advice specific to that flaw. This page is the advice that applies to all +of them. It is written for someone who runs a pipeline rather than someone +who writes decoders: the steps are things you can do this week. + +## Upgrade, and know what you have + +The fixed version is the first line of every row for a reason: a flaw with +a fix is closed by installing the fix, and nothing below is as good. The +part people miss is knowing what to upgrade. An image library is several +libraries: Pillow carries libjpeg-turbo, libpng, libtiff, OpenJPEG and +zlib inside its wheels, and a Docker image carries the operating system's +copies of the same underneath. Pin exact versions in a lock file, scan the +lock file *and* the built image for published flaws (Trivy does both, for +free), and let a tool propose the updates so that you only have to read +them. + +## Allow-list the formats you mean to read + +A scan is a JPEG, a PNG, a TIFF or a PDF. A decoder that will also read +PostScript, FlashPix, Photoshop, SPIDER, XBM and forty other formats is +forty readers' worth of flaws you never needed, and in October 2026 two of +the three flaws that ran code on the computer were in readers of that +kind. Decoders choose the reader from the file's *contents*, so an +extension check does nothing; the allow-list has to be given to the +decoder. In Pillow that is one argument: + +```python +Image.open(path, formats=["JPEG", "PNG", "TIFF"]) +``` + +It costs nothing and removes most of the attack surface at a stroke. + +## Set limits from your own files + +A decompression bomb is a tiny file whose header claims a vast image; the +decoder allocates what the header says before it has read a pixel. The +limit to set is not a guess: take the largest real file you have, and the +longest, and allow two or three times that. Pixels per image, bytes per +file, pages per PDF, frames per TIFF, and the size of any block of +metadata (a scan carries kilobytes of it, not megabytes). Pillow's +`MAX_IMAGE_PIXELS` is a start, but it is a global another library can +raise, and it is checked on the first frame only. + +## Decide before decoding + +The three steps above are what [sillybos]({{< relref "/sillybos.md" >}}) +packages: it names the format from the first bytes, reads the header with +code of its own, applies your limits, and refuses with a sentence before +any decoder runs. It also refuses the rare codings a scanner never writes +(a lossless JPEG, a PixarLog TIFF, an interlaced PNG) that turn out to be +where decoders' least-exercised code lives. What it cannot do is protect +the readers you keep from a flaw in their own pixel decoding; the watch +says which rows those are. + +## Decode in a box + +For a flaw nobody has announced yet, the only defence is to make a crash +or a hang cost one file rather than the whole run. Decode in a separate +process with a memory limit and a time limit and no network: on Linux, +`subprocess` with `resource` limits, or `systemd-run`; a container is too +slow per file but fine per batch. Catch the failure, set the file aside +with a note, and carry on. Tetrak OCR's triage queue is this idea at the +pipeline level: a file the pipeline cannot trust goes to a folder with a +reason, for a person. + +## Never hand back what you decoded + +Several of the October flaws read past a buffer and copied what they found +into the pixels of the image returned. A service that returns thumbnails +of uploads returns fragments of its own memory. If you must return pixels +from an untrusted file, re-encode them, and never return the decoder's +buffer as it came. + +## Have a routine for the next one + +A flaw is announced on a Tuesday; the question is what you do on +Wednesday. Ours is four questions, in order, written down each time: *do +we use it* (search the lock files, the images and the extras, not just +the obvious package); *does the trigger reach us* (an opened file, or only +a save path or a drawing call); *is there a fix*; *where must it be +applied* (the lock file, the running image, the laptops, and any package +you publish that others install). The watch is that routine, done in +public, for the libraries we depend on. + +## What this page does not say + +It does not say which of these to skip. A pipeline that only does the +first step is in a much better place than one that does none, and a +pipeline that does all six still has decoders in it. The order above is +the order of return on effort; the first two are an afternoon. diff --git a/site/content/sillybos.md b/site/content/sillybos.md new file mode 100644 index 0000000..22fbca2 --- /dev/null +++ b/site/content/sillybos.md @@ -0,0 +1,100 @@ +--- +title: "sillybos" +kicker: "Open source" +standfirst: "A small library that decides, before any image library or PDF renderer opens a file, whether it is one of the formats you meant to read, within the limits you expect, and if not, why. Read the tag; don't unroll the scroll." +description: "sillybos: a dependency-free Python library and command that checks a JPEG, PNG, TIFF or PDF before any decoder opens it: format from the first bytes, header limits, rare codings refused, a plain reason for each refusal. MIT licensed." +--- + +## What it is for + +Every program that reads scans hands each file to a decoder: Pillow for +images, poppler for PDFs, then an OCR engine. Decoders are large, old +programs that read complicated formats, and they have flaws. In October +2026 Pillow fixed more than thirty at once; one of them ran commands on the +computer when an EPS file was opened, and a file's extension was no +protection, because Pillow decides what a file is from its contents, so a +PostScript file named `page.png` went straight to the PostScript reader. + +A σίλλυβος (*sillybos*, say it *SIL-lee-boss*; Latin *sittybus*) was the +little parchment tag that hung from a rolled scroll in an ancient library, +carrying its title and author, so that a reader could tell what a scroll +was without unrolling it. Cicero had them made for his books. This library +is that tag for the files a scanning or OCR pipeline is handed: it reads +the tag, and says whether the scroll should be unrolled at all. + +## Who it is for + +Anyone who runs Pillow or poppler over files they did not make: an OCR +pipeline, a digitisation workflow, a thumbnailer, an upload handler, a +service that converts documents. It came out of [Tetrak OCR]({{< relref +"/ocr" >}}), where it sits in front of every scan, and is a library of its +own because most of the people who need it will never install an OCR tool. +It has no dependencies, so it adds nothing to the attack surface it exists +to reduce. + +## What it does + +1. **Size**, from the file system, before anything reads the file. +2. **Format, from the first bytes.** JPEG, PNG, TIFF and PDF can pass. It + also recognises PostScript, GIF, BMP, WebP, HEIF, JPEG 2000, BigTIFF, + Photoshop, OLE (FlashPix, old Office), zip, gzip, icons and XML, so a + refusal can say *what* the file is. Everything else is "an unknown + format". Refused by name; no reader runs on it. +3. **Name against contents.** "Says PNG, is JPEG." +4. **The header, read with code of its own**, never a decoder's: the + dimensions, frame coding and colour profile size of a JPEG and every + picture of a multi-picture one; a PNG's whole header, its frame count, + and the size of every chunk; every directory of a TIFF, with its + compression, layout and colour model, all required to match from frame + to frame, and every tag's data checked to lie inside the file. For a + PDF, poppler's `pdfinfo` in a separate process with a time limit reports + the page count, encryption and every page's size. +5. **The limits**, against what the header said, from a policy you set from + your own largest real files. + +```python +>>> from sillybos import check +>>> verdict = check("scans/page-012.png") +>>> verdict.ok +False +>>> verdict.reasons +('says PNG, is PostScript',) +``` + +The refusals are sentences for the person running the batch, never codes. +With Pillow installed, `open_checked()` runs the check and then opens the +file with Pillow's own `formats=` list set from the policy, which is the +one-line fix for the October flaws, packaged. + +## What it does not do + +A security library carries an implied promise, so the README says this +first and so does this page. + +- **It does not protect against a flaw in the readers you do allow.** A + crafted JPEG that exploits your JPEG decoder is a JPEG of a sensible + size and passes. What it removes is every format you did not mean to + read, every file too big to be safe, and the rare codings a scanner + never writes. For the readers you keep: update them, and decode in a + boxed process. +- **It does not scan for malware**, repair or "sanitise" a file, validate + uploads, or read formats beyond the four. + +The [security watch]({{< relref "/security/_index.md" >}}) keeps the +record of which published flaws it would have refused, which it would not, +and why, each claim tied to a test. + +## Get it + +```bash +pip install sillybos # the check; no dependencies +pip install 'sillybos[pillow]' # plus open_checked() +sillybos scans/* # the command +``` + +| | | +|---|---| +| Code | [github.com/scattercode/sillybos](https://github.com/scattercode/sillybos) | +| Package | [sillybos on PyPI](https://pypi.org/project/sillybos/) | +| Documentation | [scattercode.github.io/sillybos](https://scattercode.github.io/sillybos/) | +| Licence | MIT | diff --git a/site/data/watch.toml b/site/data/watch.toml new file mode 100644 index 0000000..e912b0e --- /dev/null +++ b/site/data/watch.toml @@ -0,0 +1,65 @@ +# The security watch's watchlist: the libraries sillybos's weekly advisory +# job asks OSV.dev about, and a sentence on what each one is for a reader +# who has never installed it. The advisories themselves come from the record +# (params.advisories_url); this file only names the libraries and says what +# they are. Keys match the record's `library` field, lowercased. +# +# A library with no records yet still appears in the index's list, so the +# page says what is watched, not only what has been found. + +[library.pillow] +name = "Pillow" +what = "The Python image library. Most Python programs that open a JPEG, PNG or TIFF do it with Pillow, Tetrak OCR included; it wraps libjpeg-turbo, libpng, libtiff and the others below" +package = "pillow on PyPI" +upstream = "https://github.com/python-pillow/Pillow" + +[library.libtiff] +name = "libtiff" +what = "The C library that reads and writes TIFF, the format most archival scans are kept in. Pillow, poppler, ImageMagick and nearly everything else decode TIFF through it" +package = "tiff on Debian" +upstream = "https://gitlab.com/libtiff/libtiff" + +[library.libpng] +name = "libpng" +what = "The reference C library for PNG, used by Pillow, browsers and most image software" +package = "libpng1.6 on Debian" +upstream = "https://github.com/pnggroup/libpng" + +[library.libjpeg-turbo] +name = "libjpeg-turbo" +what = "The JPEG decoder nearly everything uses, Pillow included" +package = "libjpeg-turbo on Debian" +upstream = "https://github.com/libjpeg-turbo/libjpeg-turbo" + +[library.zlib] +name = "zlib" +what = "The compression library inside PNG and Deflate-compressed TIFF, so a flaw in it reaches every program that opens either" +package = "zlib on Debian" +upstream = "https://github.com/madler/zlib" + +[library.poppler] +name = "poppler" +what = "The PDF renderer behind pdftoppm and pdfinfo, which Tetrak OCR and most Python PDF tools call to turn pages into images" +package = "poppler on Debian" +upstream = "https://gitlab.freedesktop.org/poppler/poppler" + +[library.openjpeg] +name = "OpenJPEG" +what = "The JPEG 2000 codec, bundled inside Pillow's wheels and used by poppler for JPEG 2000 streams inside PDFs" +package = "openjpeg2 on Debian" +upstream = "https://github.com/uclouvain/openjpeg" + +[library.freetype] +name = "FreeType" +what = "The font renderer, which poppler uses for the text in a PDF and Pillow uses to draw text" +package = "freetype on Debian" +upstream = "https://gitlab.freedesktop.org/freetype/freetype" + +# How the triggering input reaches a flaw, in the words the record uses as +# keys and the words the pages show. +[reached_by] +open = "by opening a file" +save = "on a save path" +api = "through another call" +tool = "through a command-line tool" +other = "another way" diff --git a/site/layouts/_default/baseof.html b/site/layouts/_default/baseof.html index 6bdc967..12ad2f1 100644 --- a/site/layouts/_default/baseof.html +++ b/site/layouts/_default/baseof.html @@ -91,9 +91,13 @@ {{- end }} diff --git a/site/layouts/partials/advisory-verdict.html b/site/layouts/partials/advisory-verdict.html new file mode 100644 index 0000000..83408d9 --- /dev/null +++ b/site/layouts/partials/advisory-verdict.html @@ -0,0 +1,34 @@ +{{- /* + What the record says sillybos does about one advisory, as a label a reader + can scan and a sentence that says why. Takes the advisory dict from the + record and returns a dict: label, class (a modifier on .verdict), sentence. + + The label is the honest one. "Refused by default" is used only where the + record claims a refusal under the default policy and names the test that + proves it; "with a setting" where only a policy change refuses the file; + and the rest say that the check does not reach the flaw, which is the + more important thing to publish. +*/ -}} +{{- $a := . }} +{{- $bucket := $a.bucket }} +{{- $label := "" }}{{ $class := "" }}{{ $sentence := "" }} +{{- if and $a.refusal $a.refusal.default }} + {{- $label = "Refused by default" }}{{ $class = "default" }} + {{- $sentence = printf "sillybos refuses the triggering file under its default policy, through the %s check." $a.refusal.check }} +{{- else if $a.refusal }} + {{- $label = "Refused with a setting" }}{{ $class = "setting" }} + {{- $sentence = printf "sillybos refuses the triggering file when the policy says so (%s); the default policy lets it through." $a.refusal.setting }} +{{- else if eq $bucket "N" }} + {{- $label = "Not reached by opening a file" }}{{ $class = "none" }} + {{- $sentence = "Opening or reading a file never reaches this flaw, so a check before decoding has nothing to refuse. Listed so that nobody expects it to." }} +{{- else if eq $bucket "C" }} + {{- $label = "Needs decoding to detect" }}{{ $class = "beyond" }} + {{- $sentence = "The flaw is in the pixel data or the compressed stream, which only a decoder can see. Nothing before the decoder can refuse it; updating the decoder is the fix." }} +{{- else if eq $bucket "D" }} + {{- $label = "Reaches pdfinfo itself" }}{{ $class = "beyond" }} + {{- $sentence = "The flaw is in the PDF parser sillybos asks, in a separate process with a time limit, so a crash or a hang there is one file refused." }} +{{- else }} + {{- $label = "Not yet triaged" }}{{ $class = "none" }} + {{- $sentence = "The advisory has an identifier but no text yet, and is checked again weekly." }} +{{- end }} +{{- return (dict "label" $label "class" $class "sentence" $sentence) }} diff --git a/site/layouts/security/list.html b/site/layouts/security/list.html new file mode 100644 index 0000000..50f8efe --- /dev/null +++ b/site/layouts/security/list.html @@ -0,0 +1,99 @@ +{{- /* + The security watch index. + + Opens like every other page -- kicker, h1, standfirst, the section's own + prose -- then the watchlist, then every advisory the record holds, newest + first. The rows are the pages the content adapter created, so the table, + the per-advisory pages, the feed and the JSON export all come from the + one fetch and cannot disagree. + + No cards and no colour per verdict: the verdict is a mono label, the way + a kicker or a tag is, and the row is the same open sheet as an article row. +*/ -}} +{{ define "main" }} + {{- with .Params.kicker }}
{{ . }}
{{ end }} +

{{ .Title }}

+ {{- with .Params.standfirst }}

{{ . }}

{{ end }} + {{ .Content }} + + {{- $advisories := where .RegularPages "Params.kind" "advisory" }} + {{- $libraries := where .RegularPages "Params.kind" "library" }} + {{- $generated := "" }} + {{- with index $advisories 0 }}{{ $generated = .Params.generated }}{{ end }} + +

What is watched

+

+ The libraries below are the ones sillybos's weekly job asks + OSV.dev about. A library with a page has + advisories in the record; the others are watched and have none recorded + yet. +

+
+ {{- range $slug, $lib := hugo.Data.watch.library }} + {{- $page := "" }} + {{- range $libraries }}{{ if eq .Params.library_slug $slug }}{{ $page = . }}{{ end }}{{ end }} +
{{ with $page }}{{ $lib.name }}{{ else }}{{ $lib.name }}{{ end }} + {{ $lib.package }}
+
{{ $lib.what }}.
+ {{- end }} +
+ +

The advisories

+

+ {{ len $advisories }} recorded + {{- $byDefault := 0 }} + {{- range $advisories }}{{ if and .Params.advisory.refusal .Params.advisory.refusal.default }}{{ $byDefault = add $byDefault 1 }}{{ end }}{{ end }} + · {{ $byDefault }} refused by sillybos's default policy + {{- with $generated }} · record generated {{ . }}{{ end }} +

+

+ Reaches you says how the triggering input gets to the flaw: + by opening a file is the one that matters for a pipeline that takes + files from outside. What sillybos does is the record's claim, + and "refused by default" is only written where a test proves it. Each + row links to a page with the trigger, the finding, the tests and the + advice in full. +

+ +
+ + + + + + + + + + + + {{- range $advisories.ByDate.Reverse }} + {{- $a := .Params.advisory }} + {{- $v := partial "advisory-verdict.html" $a }} + + + + + + + + {{- end }} + +
PublishedAdvisoryLibraryReaches youWhat sillybos does
{{ with $a.published }}{{ else }}triaged {{ $a.triaged }}{{ end }} + {{ .Title }} + {{ $a.key }} + {{ $a.library }}{{ index hugo.Data.watch.reached_by $a.reached_by | default $a.reached_by }}{{ $v.label }}
+
+ +

Follow it

+

+ {{- with .OutputFormats.Get "rss" }}New advisories turn up in the + RSS feed.{{ end }} + {{- with .OutputFormats.Get "json" }} The whole record is also published + as JSON, with a link to each page here, + for anyone who would rather read it by machine; the file it is built from + is in the sillybos repository.{{ end }} + The site is rebuilt every Monday after the weekly advisory run, and on + every change to the record. +

+{{ end }} diff --git a/site/layouts/security/list.json b/site/layouts/security/list.json new file mode 100644 index 0000000..515d91b --- /dev/null +++ b/site/layouts/security/list.json @@ -0,0 +1,12 @@ +{{- /* + The watch as JSON: the record's entries with this site's page for each, + for anyone who would rather read it by machine. The fields are the + record's own; only `url` is added. Built from the same pages as the HTML. +*/ -}} +{{- $rows := slice }} +{{- $generated := "" }} +{{- range (where .RegularPages "Params.kind" "advisory").ByDate.Reverse }} + {{- $generated = .Params.generated }} + {{- $rows = $rows | append (merge .Params.advisory (dict "url" .Permalink)) }} +{{- end }} +{{- dict "generated" $generated "source" "https://github.com/scattercode/sillybos/blob/main/docs/advisories/record.json" "records" $rows | jsonify (dict "indent" " ") }} diff --git a/site/layouts/security/single.html b/site/layouts/security/single.html new file mode 100644 index 0000000..a4c37a6 --- /dev/null +++ b/site/layouts/security/single.html @@ -0,0 +1,107 @@ +{{- /* + A page in the security section. Three kinds share it: + + advisory created by the content adapter from one record; the whole + page is rendered from params.advisory + library created by the adapter for each library with records; lists + that library's advisories + (neither) an ordinary markdown page in the section, such as + protecting-yourself.md, rendered as _default/single does + + One template rather than three, so the section's pages open the same way + and a reader moving between them is never surprised. +*/ -}} +{{ define "main" }} + {{ partial "breadcrumbs.html" . }} + {{- with .Params.kicker }}
{{ . }}
{{ end }} +

{{ .Title }}

+ {{- with .Params.standfirst }}

{{ . }}

{{ end }} + + {{- if eq .Params.kind "advisory" }} + {{- $a := .Params.advisory }} + {{- $v := partial "advisory-verdict.html" $a }} + {{- $lib := index hugo.Data.watch.library .Params.library_slug }} + {{- $libPage := "" }} + {{- range where .Parent.RegularPages "Params.kind" "library" }}{{ if eq .Params.library_slug $.Params.library_slug }}{{ $libPage = . }}{{ end }}{{ end }} + +
+
Advisory
+
{{ $a.key }}{{ with $a.aliases }} (also {{ delimit . ", " }}){{ end }}
+
Library
+
{{ with $libPage }}{{ $a.library }}{{ else }}{{ $a.library }}{{ end }}, {{ $a.package }} on {{ $a.ecosystem }}
+
Published
+
{{ with $a.published }}{{ else }}not given by the upstream record{{ end }}
+
Severity
+
{{ with $a.severity }}{{ . }} out of 10, as published{{ else }}not scored upstream{{ end }}
+
Affected
+
{{ $a.affected }}
+
Fixed in
+
{{ with $a.fixed }}{{ . }}{{ else }}see the upstream record{{ end }}
+
Reaches you
+
{{ index hugo.Data.watch.reached_by $a.reached_by | default $a.reached_by }}
+
+ +

What triggers it

+

{{ $a.trigger }}

+ +

What sillybos does

+

{{ $v.label }}

+

{{ $v.sentence }}

+

{{ $a.finding }}

+ {{- with $a.notes }}

{{ . }}

{{ end }} + {{- with $a.verified_by }} +

Proved by {{ if gt (len .) 1 }}these tests in the sillybos suite, each of which builds{{ else }}this test in the sillybos suite, which builds{{ end }} the triggering file from bytes and checks that it is refused:

+
    + {{- range . }} + {{- $file := index (split . "::") 0 }} +
  • {{ . }}
  • + {{- end }} +
+ {{- end }} + +

How to protect yourself

+

In general. {{ $a.protect.general }}

+

Specifically. {{ $a.protect.specific }}

+

The general advice applies to every row here.

+ +

Sources

+
    + {{- range $a.sources }}
  • {{ . }}
  • {{ end }} +
  • The record entry, triaged {{ $a.triaged }}, last checked {{ $a.checked }}
  • +
+ + {{- else if eq .Params.kind "library" }} + {{- $lib := .Params.library }} + {{- $slug := .Params.library_slug }} + {{- $rows := where (where .Parent.RegularPages "Params.kind" "advisory") "Params.library_slug" $slug }} +

+ {{ len $rows }} {{ if eq (len $rows) 1 }}advisory{{ else }}advisories{{ end }} recorded for + {{ $lib.name }} ({{ $lib.package }}); + the project is at {{ $lib.upstream }}. + Newest first. +

+
+ + + + + + {{- range $rows.ByDate.Reverse }} + {{- $a := .Params.advisory }} + {{- $v := partial "advisory-verdict.html" $a }} + + + + + + + {{- end }} + +
PublishedAdvisoryReaches youWhat sillybos does
{{ with $a.published }}{{ else }}triaged {{ $a.triaged }}{{ end }}{{ .Title }} {{ $a.key }}{{ index hugo.Data.watch.reached_by $a.reached_by | default $a.reached_by }}{{ $v.label }}
+
+

Back to the whole watch.

+ + {{- else }} + {{ .Content }} + {{- end }} +{{ end }} From d145ccdede03cc8ec75c3c75fe0dcc13ea5a5a76 Mon Sep 17 00:00:00 2001 From: Stephen Masters Date: Sun, 1 Nov 2026 19:17:50 +0000 Subject: [PATCH 2/2] fix(site): date the watch's pages, stop caching the record, and test the watch The content adapter set the advisory date under a top-level `date` key, which Hugo does not read, so every page it made sat at year 1: the table was not newest first, the feed went out undated and the sitemap had no lastmod. The date now goes in the `dates` map, a library page takes the date of its newest advisory, and the guide page has a date of its own, so nothing in the section's feed is undated. Hugo keeps a fetched remote resource for ever by default, so a machine that had built the site once would never see a changed record and the weekly rebuild could publish a stale watch. The remote-resource cache now expires at once; the record is the only remote fetch the build makes. The browser tests learn that sillybos makes four products, give the whole-site image walk the time a hundred pages need, and gain a check that the watch renders the record everywhere it is promised: rows that link to dated advisory pages, newest first, a JSON export and a feed that carry the same rows, and a verdict on the page behind each row. Co-authored-by: Yvette Mankerian Co-Authored-By: Claude Fable 5.1 --- site/config/_default/hugo.toml | 10 +++++ site/content/security/_content.gotmpl | 16 +++++-- site/content/security/protecting-yourself.md | 1 + site/tests/site.spec.ts | 46 ++++++++++++++++++-- 4 files changed, 65 insertions(+), 8 deletions(-) diff --git a/site/config/_default/hugo.toml b/site/config/_default/hugo.toml index 6959198..9212424 100644 --- a/site/config/_default/hugo.toml +++ b/site/config/_default/hugo.toml @@ -58,6 +58,16 @@ capitalizeListTitles = false [security.http] urls = ['^https://raw\.githubusercontent\.com/scattercode/sillybos/'] +# The advisory record is the one remote resource the build reads, and the +# point of reading it at build time is to publish the current one. Hugo's +# default keeps a fetched resource for ever (maxAge -1), so a machine that +# had built the site once would keep showing the record as it was that +# day: a weekly rebuild would fetch nothing new. No caching, so every +# build reads the record as it is. +[caches] + [caches.getresource] + maxAge = 0 + [outputs] # index.json is the search index: built once at build time and filtered in # the browser, rather than a search service. Build time over runtime. diff --git a/site/content/security/_content.gotmpl b/site/content/security/_content.gotmpl index 42ddfbb..365fbc9 100644 --- a/site/content/security/_content.gotmpl +++ b/site/content/security/_content.gotmpl @@ -31,19 +31,26 @@ reader who searches a CVE id lands on /security/cve-2026-112900/. The date is when the advisory was published, or when it was triaged if upstream gave no date, so the feed and the ordering - have something to go on. */ -}} + have something to go on. It goes in the `dates` map: a top-level + `date` key is not one the adapter reads, and Hugo ignores it + without a word, leaving every page at year 1. */ -}} + {{- /* $seen maps each library's slug to the date of its newest advisory, + which becomes the library page's own date, so the feed and the + sitemap can say when it last gained a row. */ -}} {{- $seen := dict }} {{- range $record.records }} {{- $key := .key }} {{- $slug := lower $key }} {{- $date := .published | default .triaged }} {{- $libslug := lower .library }} - {{- $seen = merge $seen (dict $libslug true) }} + {{- $newest := index $seen $libslug | default "" }} + {{- if gt $date $newest }}{{ $newest = $date }}{{ end }} + {{- $seen = merge $seen (dict $libslug $newest) }} {{- $page := dict "path" $slug "kind" "page" "title" .title - "date" $date + "dates" (dict "date" (time.AsTime $date)) "description" .summary "params" (dict "kind" "advisory" @@ -59,7 +66,7 @@ {{- /* One page per library that has at least one record. The watchlist in data/watch.toml names the rest; the index lists them. */ -}} - {{- range $slug, $_ := $seen }} + {{- range $slug, $newest := $seen }} {{- $lib := index $libraries $slug }} {{- if not $lib }} {{- errorf "security: the record names a library, %q, that data/watch.toml does not describe" $slug }} @@ -68,6 +75,7 @@ "path" $slug "kind" "page" "title" (printf "%s advisories" $lib.name) + "dates" (dict "date" (time.AsTime $newest)) "description" (printf "Published security flaws in %s, what each one takes to trigger, and whether a check before decoding refuses the file." $lib.name) "params" (dict "kind" "library" diff --git a/site/content/security/protecting-yourself.md b/site/content/security/protecting-yourself.md index b41b48c..ec704bb 100644 --- a/site/content/security/protecting-yourself.md +++ b/site/content/security/protecting-yourself.md @@ -3,6 +3,7 @@ title: "Protecting yourself" kicker: "Security" standfirst: "What a pipeline that opens images and PDFs it did not make can do about the flaws in its decoders, in order of how much each step buys. None of it replaces upgrading; all of it helps when the next flaw has no fix yet." description: "How to protect an OCR pipeline, thumbnailer or upload handler from vulnerabilities in image and PDF libraries: pin and scan, allow-list formats, set limits, check before decoding, decode in a boxed process, and keep a routine for the next advisory." +date: 2026-11-01 weight: 1 --- diff --git a/site/tests/site.spec.ts b/site/tests/site.spec.ts index 1cfb75a..fd3e5a7 100644 --- a/site/tests/site.spec.ts +++ b/site/tests/site.spec.ts @@ -53,8 +53,9 @@ test("the products dropdown opens and closes from the keyboard", async ({ page } await page.keyboard.press("Enter"); await expect(button).toHaveAttribute("aria-expanded", "true"); await expect(submenu).toBeVisible(); - await expect(submenu.locator("a")).toHaveCount(3); + await expect(submenu.locator("a")).toHaveCount(4); await expect(submenu.locator("a").first()).toHaveText("Tetrak OCR"); + await expect(submenu.locator("a").last()).toHaveText("sillybos"); // Tab moves into the list; Escape closes it and hands focus back. await page.keyboard.press("Tab"); @@ -68,7 +69,7 @@ test("the products dropdown opens and closes from the keyboard", async ({ page } // hanging over the page for a keyboard user who moved on. await page.keyboard.press("Enter"); await expect(submenu).toBeVisible(); - for (let n = 0; n < 4; n++) await page.keyboard.press("Tab"); + for (let n = 0; n < 5; n++) await page.keyboard.press("Tab"); await expect(submenu).toBeHidden(); }); @@ -81,15 +82,49 @@ test("the phone menu shows the products under Products", async ({ page }) => { await page.locator("[data-menu-toggle]").click(); await expect(nav).toBeVisible(); - // No disclosure on a phone: the three products are simply listed, indented + // No disclosure on a phone: the four products are simply listed, indented // under their parent, which still links to the overview. await expect(page.locator("[data-submenu-toggle]")).toBeHidden(); const products = nav.locator(".masthead__submenu a"); - await expect(products).toHaveCount(3); + await expect(products).toHaveCount(4); for (const link of await products.all()) await expect(link).toBeVisible(); await expect(nav.locator('.masthead__group > a[href$="/products/"]')).toBeVisible(); }); +test("the security watch renders the advisory record everywhere it is promised", async ({ page, request, baseURL }) => { + // The rows, the per-advisory pages, the feed and the JSON export all come + // from one fetch of sillybos's record at build time. A fetch that fails + // fails the build; this checks that one that succeeded reached the page. + await page.goto("security/"); + const rows = page.locator("table.watch tbody tr"); + 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-]+\/$/); + await expect(row.locator(".verdict")).not.toBeEmpty(); + } + + // Newest first. The adapter set the date under the wrong key once, and + // every page sat at year 1: the table shuffled, the feed went out undated. + const shown = await rows.locator("td.watch__date").allInnerTexts(); + const dates = shown.map((t) => t.match(/\d{4}-\d{2}-\d{2}/)![0]); + expect(dates).toEqual([...dates].sort().reverse()); + + const json = await (await request.get(new URL("security/index.json", baseURL!).href)).json(); + expect(json.records).toHaveLength(count); + expect(json.generated).toMatch(/^\d{4}-\d{2}-\d{2}/); + + const feed = await (await request.get(new URL("security/index.xml", baseURL!).href)).text(); + expect((feed.match(//g) ?? []).length).toBeGreaterThanOrEqual(count); + expect(feed).not.toContain("0001 00:00:00"); + + // The first row's own page carries the verdict and links back to the record. + await rows.first().locator("td:nth-child(2) a").click(); + await expect(page.locator("main h1")).not.toBeEmpty(); + await expect(page.locator(".verdict").first()).toBeVisible(); + await expect(page.locator('a[href*="scattercode/sillybos"]').first()).toBeVisible(); +}); + test("every old URL still lands on its page", async ({ request, baseURL }) => { // Brief 017 moved the tutorial and the reference under /ocr/. PyPI, the // READMEs, the user guide and published articles link to the old paths, so @@ -291,6 +326,9 @@ 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(); // 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