zotero/app/scripts/fetch_onecrl
Dan Stillman e470557ff8 Apply Mozilla's OneCRL certificate revocations
Mozilla sends CRL updates via Remote Settings, which we don't use, so we
continue to trust revoked CA and intermediate certificates, including
the compromised eMudhra intermediates. Fetch the current list from
Mozilla at build time and apply the changes to the list on the first run
of each build.

Updating to the latest 153 ESR will also remove the eMudhra roots, which
will invalidate the intermediates as well, but that won't help Zotero
10, since 140 ESR is EOL, and most revoked intermediates are blocked
only via OneCRL without a root removal.
2026-10-26 12:18:37 -04:00

24 lines
715 B
Bash
Executable file

#!/bin/bash
set -euo pipefail
# Replace Firefox's bundled OneCRL list with the current one from Remote Settings
#
# Usage: fetch_onecrl FILE
URL="https://firefox.settings.services.mozilla.com/v1/buckets/security-state/collections/onecrl/changeset?_expected=0"
file="$1"
tmp_file="$file.tmp"
curl -sSf --retry 3 "$URL" -o "$tmp_file"
python3 -c '
import json, sys
with open(sys.argv[1]) as f:
changeset = json.load(f)
if not changeset["changes"]:
raise Exception("OneCRL list is empty")
with open(sys.argv[2], "w") as f:
json.dump({"data": changeset["changes"], "timestamp": changeset["timestamp"]}, f)
print("Fetched {} OneCRL records".format(len(changeset["changes"])))
' "$tmp_file" "$file"
rm "$tmp_file"