Skip to content

Add SRI hashes to external CDN script and link tags#7041

Open
arijitroy003 wants to merge 1 commit into
duckdb:mainfrom
arijitroy003:security/add-sri-hashes-external-scripts
Open

Add SRI hashes to external CDN script and link tags#7041
arijitroy003 wants to merge 1 commit into
duckdb:mainfrom
arijitroy003:security/add-sri-hashes-external-scripts

Conversation

@arijitroy003

Copy link
Copy Markdown
Contributor

Summary

Adds Subresource Integrity (SRI) hashes to all external CDN resources loaded in _layouts/default.html:

  • mapbox-gl.css (v3.17.0-beta.1) from api.mapbox.com
  • mapbox-gl.js (v3.17.0-beta.1) from api.mapbox.com
  • swiper-bundle.min.css (@12) from cdn.jsdelivr.net
  • swiper-bundle.min.js (@12) from cdn.jsdelivr.net

Each tag now includes integrity="sha384-..." and crossorigin="anonymous" attributes. This ensures the browser verifies the fetched resource against the expected hash before executing it, mitigating supply-chain attacks where a CDN serves tampered content.

_layouts/docu.html was also reviewed and contains no external CDN resources.

Test plan

  • Verify DuckCon pages load correctly (these are the only pages that use the affected resources, gated behind page.body_class contains "duckcon")
  • Confirm Mapbox GL map renders on DuckCon pages
  • Confirm Swiper carousel functions on DuckCon pages
  • Check browser console for SRI-related errors on non-DuckCon pages (there should be none, since these tags are conditionally included)

Add integrity="sha384-..." and crossorigin="anonymous" attributes to
all external resources loaded from api.mapbox.com and cdn.jsdelivr.net
in the default layout. This prevents tampering with third-party scripts
and stylesheets served from CDNs (supply-chain attack mitigation).

Resources covered:
- mapbox-gl.css (v3.17.0-beta.1)
- mapbox-gl.js (v3.17.0-beta.1)
- swiper-bundle.min.css (@12)
- swiper-bundle.min.js (@12)
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.

1 participant