Skip to content

Releases

v0.38.0

Choose a tag to compare

@tannevaled tannevaled released this 15 Nov 17:34
c8e8e9b

What's Changed

  • fork ribbon: the GitHub mark to the right of its words by @tannevaled in #55

Full Changelog: v0.37.0...v0.38.0

v0.37.0

Choose a tag to compare

@tannevaled tannevaled released this 15 Nov 15:29
0c1b3c0

The kit version in a landing's footer

A new opt-in partial, kit-version.html, prints the landingkit version a page was built with (#54). Add it to your own <footer> with {{ partial "kit-version.html" . }}:

  • a tagged version prints landingkit v0.37.0, linked to that release;
  • a pseudo-version prints as it is, linked to the commit;
  • a replace to a local directory, or no kit dependency, prints landingkit (local), with no link.

It reads hugo.Deps and never fails the build. Its colour is --slate: 7.58:1 on the light background and 7.66:1 on the dark one.

landingkit audit now prints the kit version it reads on each published page (none when the page has no such line), plus a tally. landingkit check warns when a built site has no version line, and does not fail.

To show it on a landing, bump the pin to v0.37.0 or later AND add the partial call to the footer. The bump alone shows nothing.

v0.36.0

Choose a tag to compare

@tannevaled tannevaled released this 15 Nov 14:18
0dbc8c1

wasmcache: cached responses carry only the headers the cache can vouch for (#53, closes #50).

Before: when a file was stored, the response kept whatever headers it came with. A file copied from an old build's cache (v0.33.0) kept the old entry's headers, which were never checked: only the bytes were hash-checked against the manifest.

Now: every response wasmcache-sw.js stores is built the same way, whether it comes from a cache hit, a network fetch, a hash-checked network fallback, or a copy from the old build:

  • Content-Type comes from the file extension: wasm, js/mjs, json, html (utf-8), css, otherwise application/octet-stream.
  • Security headers the host sent are kept, from a fixed list: Content-Security-Policy, Content-Security-Policy-Report-Only, X-Frame-Options, Permissions-Policy, Referrer-Policy, Cross-Origin-Opener-Policy, Cross-Origin-Embedder-Policy, Cross-Origin-Resource-Policy and X-Content-Type-Options. They are taken from the network response at store time, or from the old entry when copying, and only after the bytes pass the hash check.
  • Nothing else carries over.

The security list matters for hosts that send these as HTTP headers. A frame-ancestors CSP (which a <meta> tag cannot set) or COOP/COEP (which wasm threads need for crossOriginIsolated) must not be lost when a page is served from the cache.

Tests: the test kit plants an old entry with matching bytes, a wrong Content-Type and an extra x-planted header. It is reused without a download, with the extension's Content-Type and without x-planted. A CSP and a COOP header on the page survive a cache hit, a copy and a network store. Each check was proven by mutation: an empty list drops the CSP, and allowing every header lets x-planted through.

v0.35.0

Choose a tag to compare

@tannevaled tannevaled released this 15 Nov 13:20
d214c7e

wasmcache test kit: --network exempts only a Worker's versioned requests (#52).

The service worker is unchanged. This release changes the browser test kit (wasmcache/testkit), which consumers run in their own CI.

The problem in v0.34.0: a site with several language scopes failed the post-update check. go-slides hit it on its /fr/playground/ run:

FAIL the new build asked the server for unchanged files: /playground/wasm_exec.js

Cause: the /fr/ page starts a dedicated Worker whose script lives in /playground/. No service worker controls that Worker, so what it imports goes to the network by design. --network <paths> declares those files, but the post-update check added in v0.33.0 ignored the flag.

Now:

  • A --network path is exempt only for requests that carry a query, as a Worker's script and imports carry the deploy's ?v.
  • The same path asked without a query is still counted, in the second-load check and in the post-update check. For example, the page's own <script>, which the scope's worker must answer from its cache.
  • In v0.34.0 and earlier, the second-load check exempted a declared path for every request.
  • The kit's fixture gains a second scope (/fr/playground/) whose page loads a file from /playground/, and whose Worker script there imports it with ?v. The kit runs on both pages.
  • --network is documented in the README.

Proof:

  • With the v0.34.0 kit, the new fixture fails with the go-slides message, on /playground/glue.js.
  • With this release, it passes on both scopes.
  • Mutation: if the service worker sends the page's own unversioned request to the network, the /fr/ run fails with the second load asked the server for /playground/glue.js, even though that file is declared with --network.

v0.34.0

Choose a tag to compare

@tannevaled tannevaled released this 15 Nov 12:34
a3ccc46

wasmcache test kit: a simulated deploy now looks like a real one (#51).

The service worker is unchanged from v0.33.0. This release changes the browser test kit (wasmcache/testkit), which consumers run in their own CI.

The problem in v0.33.0's kit: the kit faked a newer build by changing only the worker and the manifest, while the pages it served kept the old ?v=. A site whose page requests a file with ?v= after the reload got a false failure: the worker sends a request carrying another deploy's ?v to the network by design. go-slides hit this on its video worker:

FAIL /playground/video-worker.wasm cached by the old build was requested 1 time(s) in the new one

In a real deploy, the pages' ?v and the worker's version change together, and the file is served from the copied cache entry.

Now:

  • The simulated build serves its pages with ?v= rewritten to its own version. Every request is still counted.
  • The "unchanged files" checked for 0 requests during an update are derived from the bytes, not from the file type.
  • The kit's own fixture has the shape of a real site: pages carrying ?v=, a lazy file fetched from a dedicated Worker at every load, and two scopes sharing one cache name.

Proof, each a mutation that fails by assertion:

  • With the page rewrite disabled, the test fails with the go-slides message above.
  • With the lazy copy removed from sw.js, it fails at /playground/fonts/f.ttf was stored by the old build and was not copied to the new build's cache.

Upgrade from v0.33.0 if you run the kit in CI.

v0.33.0

Choose a tag to compare

@tannevaled tannevaled released this 15 Nov 12:03
6a96bc6

wasmcache: an update no longer re-downloads unchanged files (#49).

Before: when a newer build was deployed, the new service worker fetched every listed file again, then deleted the old cache. For go-slides that meant about 10.3 MiB (playground.wasm, gzipped) per returning visitor on every deploy, even when only a 30 KB script changed. Lazy files, such as the 3.2 MiB video worker, were lost too and downloaded again on next use. This was measured in headless Chrome.

Now: at install, the worker copies a file from this playground's previous cache when its size and SHA-256 match the new manifest, and downloads it otherwise. Lazy files stored by the old build are copied the same way, and are never fetched at install.

  • Hash check: every copied file is hashed against the new manifest before it is stored. A tampered or truncated old entry is downloaded again instead of reused.
  • Scope: only caches named "<name>|" are read, so other playgrounds on the same origin are never touched.
  • Failure: any failure during the copy falls back to the network. If the install fails, the half-built cache is deleted and the old build keeps serving, so a new build never activates with a file missing.
  • Tests: a new step in the test kit (worker.js changed) asserts that unchanged files are requested 0 times, that a lazy file is copied with 0 requests, and that a tampered old entry is fetched and hash-checked. Removing the hash check, or the reuse itself, each fail that step by assertion.

Follow-up filed as #50: a copied entry still carries the old entry's headers. Only its bytes are checked against the manifest; the headers should be built from the manifest instead. This opens no new attack: only same-origin script can write Cache Storage, and such script could already write the live cache.

v0.32.0

Choose a tag to compare

@tannevaled tannevaled released this 15 Nov 10:44
6c4adef

What's Changed

  • check: a repeat is a strip fact standing alone, not a phrase inside a sentence by @tannevaled in #48

Full Changelog: v0.31.0...v0.32.0

v0.31.0

Choose a tag to compare

@tannevaled tannevaled released this 15 Nov 09:45
44062f1

wasmcache hardening (#47, closes #45).

  • The recovery page reloads at most once. The "Updating…" page that replaces a playground page failing its hash check now reloads a single time, marked with ?wasmcache-reset=1. If the page still fails, it shows a static "clear this site's data" message instead of reloading, even when removing the service worker keeps failing. Before, that case reloaded without end. The marker is removed from the address bar once the page is healthy.
  • Cache names are restricted (breaking). -name now accepts only [A-Za-z0-9._:/-], and anything else is refused at generation time. Before, only | was refused, and a name containing </script> could break out of the generated recovery script. < is also escaped as < where the name is embedded, as defense in depth.
  • Tests. The test kit makes removing the service worker always fail, and asserts exactly one reload followed by the message. It also checks that the restored page matches its manifest hash. Each check was proven by mutation: removing the bound gave 240 page requests against an expected 2.

Upgrade: if your -name uses characters outside the allowed set, rename it. go-slides uses go-slides-playground, which is unaffected.

v0.30.0

Choose a tag to compare

@tannevaled tannevaled released this 14 Nov 22:18
8e10cb8

New: wasmcache, a local cache for playground wasm with update detection (#41).

A playground no longer downloads its wasm on every visit. A service worker keeps the files listed in a build manifest, checked against their sha256, and reloads when a newer build is deployed. This release shares the cache code across playgrounds; it does not share one cache between them.

  • Hash-checked everywhere. A cached or network copy whose bytes do not match the manifest is never stored or run. If the playground page itself fails the check after a deploy, a fixed recovery page built by the worker removes the worker, deletes only this playground's caches, and reloads.
  • No version skew. Worker and loader URLs carry the build's ?v=, and a worker from another build never answers them.
  • Lazy files. -lazy <path> keeps a file out of the precache. It is fetched on first use and then cached under the same hash check.
  • Test kit. wasmcache/testkit runs a browser end to end. It covers first load, a cached reload, update detection, a tampered network copy, the recovery page, and lazy files: none requested from server start until use, cached after.

Hardening follow-ups from the review are filed as #45: a one-shot bound on the recovery page's reload, and a restricted character set for cache names.

v0.29.0

Choose a tag to compare

@tannevaled tannevaled released this 14 Nov 21:09
d5edaef

What's Changed

  • the band travels with fork-ribbon.html, because that is the call every landing makes by @tannevaled in #44

Full Changelog: v0.28.0...v0.29.0