Skip to content

Serve diff2html from the proxy instead of jsDelivr - #471

Merged
andrew merged 1 commit into
git-pkgs:mainfrom
simonchrz:fix/diff2html-pin
Oct 14, 2026
Merged

andrew merged 1 commit into
git-pkgs:mainfrom
simonchrz:fix/diff2html-pin

Conversation

@simonchrz

Copy link
Copy Markdown
Contributor

The compare page loaded diff2html from cdn.jsdelivr.net/npm/diff2html/... with no version and no integrity hash. Whatever jsDelivr serves as the latest release ran with the proxy origin's privileges, and the page broke wherever the proxy can't reach the internet.

Changes

  • Vendor diff2html 3.4.56 (MIT) under internal/server/static/vendor/, like tailwind and lucide, with a one-line license banner as lucide's file has. The tarball's sha512 matched the registry's dist.integrity.
  • compare_versions.html loads the script and stylesheet from /ui/static/vendor/.

Testing

  • New TestTemplatesLoadNoThirdPartyAssets fails when any embedded template loads a script or stylesheet from another origin. Before this change it flagged the two jsDelivr tags.
  • TestStaticFiles covers the two new files.
  • go test -race ./internal/server/..., go vet and golangci-lint v2.13.1 pass.

The compare page loaded diff2html from cdn.jsdelivr.net without a version
or integrity hash, so whatever jsDelivr served as the latest release ran
with the proxy origin's privileges, and the page broke where the proxy
cannot reach the internet.

- Vendor diff2html 3.4.56 (MIT) under static/vendor like tailwind and lucide
- Load its script and stylesheet from /ui/static/vendor
- Fail a test when any template loads a script or stylesheet from another origin
@andrew
andrew merged commit 65ffb7c into git-pkgs:main Oct 14, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants