Repository navigation
Description
Context
We load the web tracker from the collector's own endpoint (/d/wt.min.js on a first-party tracking domain, CNAME to d8a) instead of jsDelivr. For public-sector sites this is the preferred setup: first-party, no third-party CDN in the CSP.
The downside is that /d/wt.min.js has no version in the path. The file is embedded in the server binary (pkg/protocol/d8a/protocol.go, //go:embed static/wt.min.js), so it changes with every server release, without notice to the sites that load it.
Problem
- No Subresource Integrity possible. An
integrityhash on/d/wt.min.jsbreaks tracking on every site as soon as the server is updated. So today we load it without SRI. - No control over which tracker runs. A tracker change goes live on all sites at once, without a chance to test it first. Our implementation has a privacy layer around the tracker (URL and query parameter scrubbing); a change in tracker behaviour can bypass it without us noticing.
- The served file doesn't identify its version. The file served today reports
_dtv = "dev-26-09", while the server runs a v1.5.x release, and the bytes don't match any published@d8a-tech/wtnpm release. There are noETag,Last-Modifiedor version headers either. So we can't tell which tracker version is live, or when it changed.
Proposal
Any of these would solve it, in order of preference:
- Versioned path next to the current one, for example
/d/wt.1.5.4.min.jsor/d/1.5.4/wt.min.js, kept available for at least a few releases after a new one ships./d/wt.min.jsstays as the "latest" alias. - Release builds only: the embedded tracker is built from the tagged
@d8a-tech/wtrelease,_dtvreports that release version, and the SHA-384 hash is listed in the release notes. - Version header on
/d/wt.min.js(for exampleX-D8a-Tracker-Version) plus anETag, so changes can at least be detected and monitored.
Also helpful: a short note in the release notes whenever the embedded tracker changes behaviour.
Why it matters
With a versioned URL we can pin the tracker with SRI, test a new version before switching, and roll out per site. That is what government CSP and security reviews ask for.
Happy to test a build against our test kit (Playwright e2e, 46 checks) before release.
Activity