typress
An editorial workshop.日本語

Publish a threat feed

How to run your own threat feed. A feed is a signed JSON file; host it anywhere you can serve https.

Source file

{
  "format": "typress.threatfeed/1",
  "sequence": 1,
  "entries": [
    {
      "sha256": "e874f5c7... (64 hex digits)",
      "kind": "plugin",
      "label": "Example 1.0.0",
      "reason": "Sends session cookies to a third party",
      "severity": "high"
    }
  ]
}
  • sequence: version number. Raise it whenever the contents change.
  • kind: plugin or theme
  • severity: low, medium, high or critical
  • reference: an https URL with details (optional)

Sign it

bun tools/tpkg/src/main.ts keygen --label feed       # once
bun tools/tpkg/src/main.ts feed-sign feed.json --key feed --expires 7d

This writes feed.signed.json; publish that. Give subscribers the public key printed at the end.

Expiry and renewal

Each signature carries an expiry (--expires, default 7 days, at most 90). When it passes, every subscribed site shows a warning, so re-sign before then even if nothing changed. --bump raises the sequence and writes it back to the source file, so a cron job is all you need.

0 */6 * * * cd /srv/feed && bun /path/to/tpkg feed-sign feed.json --key feed --expires 1d --bump && rsync feed.signed.json web:/var/www/feed/
  • The validity period is the longest time a blocked feed can go unnoticed. Shorter is safer, but a missed re-sign warns every site.
  • Re-sign much more often than the validity period (for a 1-day validity, every few hours).
  • Keep the signing key off the web server. Sign on another machine and copy only the file.

Limits

  • Up to 100,000 entries and 5 MiB
  • Refused: a lower sequence than before, the same sequence with different contents, and expired feeds.
  • Only exact file fingerprints are stopped. A modified build isn't stopped until it's listed too.