ArcticLampyrid on X asked for Settings to say why automatic updates are safe. Two lines now join the Automatic updates row's explanation. Like every Settings line, they show only in the row's hover card (or on focus, or inline where there is no hover), and a small info mark goes on the row's name where there is hover. There is no new section or row. - Every update is signed: its SHA-256 checksums carry an ed25519 signature, checked against a key built into magpie (internal/update/signed.go). - Its SLSA build attestation, signed through Sigstore, is checked too: it shows magpie's release workflow on GitHub built those exact files. An update that fails a check is not installed (internal/update/attest.go). The lines are added by updatetrust.js, a module settingshints.js loads on demand. It watches #about and adds them each time About is drawn. They live there and not in app.js because the core scripts' budget (TestCoreScriptBudget) has no room. old-webkit's list of on-demand scripts names it. Translated in zh, zh-TW, ja and de. update-auto.test.cjs: at rest the two lines are out of sight; hovering the name shows the card with the row's line, "ed25519" and "Sigstore"; the mark is there; and the card goes once the pointer leaves. The existing check of the switch's own line now reads the first line only. Run (mote-run, at this commit rebased on414517ccf): node --test old-webkit phone-no-sideways settings-hints settings-lines-wrap settings-search update-auto (Chromium + WebKit) 66 pass, 26 fail. The 26 are the same tests, failing the same way, on plain414517ccf: #6467 (appearance.js), #5919 (:has), #5869 (de 375), #6107 (settings-hints ja/de 420px), #6353 and #6133 (settings-search /api/update/using, settings-lines-wrap de 440px). update-auto passes in both engines. The first run, ate5b8f381d, covered 38 update-*, settings-*, about-*, i18n-keys, i18n-en-no-cjk, remote-update, whats-new and uninstall-settings files: 720 of 746 passed, and the 26 reds are the ones above. go test ./internal/gui/... (TestCoreScriptBudget included): ok. Broken by hand: without the import in settingshints.js, update-auto goes red (no .update-trust lines within 5s). Not tried: the real app window; only the faked API in Playwright.
23 lines
1.4 KiB
JavaScript
23 lines
1.4 KiB
JavaScript
// Why an update magpie puts in by itself can be trusted (ArcticLampyrid
|
|
// on X): two lines in the Automatic updates row's hover card
|
|
// (settingshints.js keeps a row's .sub lines out of sight and shows them
|
|
// there), and a mark by the row's name that says the card is there. A
|
|
// touch screen, with no hover, keeps the lines in place and no mark. What
|
|
// the lines say is internal/update's signed.go and attest.go.
|
|
// settingshints.js imports this, so the core doesn't carry it; Settings'
|
|
// About is drawn again whole, so each drawing of the row is watched for.
|
|
const about = document.getElementById("about");
|
|
const mark = () => {
|
|
const row = about?.querySelector(":scope > .update-auto-row");
|
|
const who = row?.querySelector(":scope > .who");
|
|
if (!who || who.querySelector(".update-trust")) return;
|
|
who.append(el("div", "sub update-trust", t("Every update is signed: its SHA-256 checksums carry an ed25519 signature, checked against a key built into magpie")),
|
|
el("div", "sub update-trust", t("Its SLSA build attestation, signed through Sigstore, is checked too: it shows magpie's release workflow on GitHub built those exact files. An update that fails a check is not installed")));
|
|
const tip = el("span", "as-tip");
|
|
tip.setAttribute("aria-hidden", "true"); // a screen reader reads the lines
|
|
tip.append(svg(INFO_I, 12, 1.6));
|
|
who.querySelector(".name")?.append(tip);
|
|
};
|
|
if (about) new MutationObserver(mark).observe(about, { childList: true });
|
|
mark();
|