Skip to content

security: add SRI hash to Redoc CDN script tag#36

Open
dmchaledev wants to merge 1 commit into
mainfrom
claude/elegant-edison-9y7oct
Open

security: add SRI hash to Redoc CDN script tag#36
dmchaledev wants to merge 1 commit into
mainfrom
claude/elegant-edison-9y7oct

Conversation

@dmchaledev

Copy link
Copy Markdown
Contributor

Summary

  • docs/index.html loads redoc.standalone.js from jsdelivr with a plain <script src> tag and no Subresource Integrity check.
  • Since this script runs on hailbytes.github.io/hailbytes-api-docs, a compromised CDN edge or MITM response would execute unmodified in every visitor's browser — SRI is the standard mitigation.
  • Added integrity="sha384-..." and crossorigin="anonymous" for the pinned redoc@2.5.3 bundle. The hash was computed locally from the fetched file and cross-checked against jsdelivr's own published sha256 for the same file (data.jsdelivr.com/v1/package/npm/redoc@2.5.3) — both point at identical bytes, confirming the pin is correct.
  • No functional change: the version is already pinned in the URL, so the hash simply guarantees the bytes served match what was reviewed.

Test plan

  • Verified the downloaded redoc.standalone.js matches jsdelivr's published content hash for redoc@2.5.3.
  • Confirmed the computed sha384 SRI value in the diff.
  • After merge, load the deployed docs page and confirm Redoc still renders both the ASM and SAT tabs (CI environment here has restricted outbound TLS to CDNs, so this couldn't be verified live in-session).

Generated by Claude Code

The docs site loads redoc.standalone.js from jsdelivr with no integrity
check, so a compromised or MITM'd CDN response would run unmodified in
visitors' browsers. Pin it with a sha384 SRI hash (verified against
jsdelivr's published sha256 for the same file) and crossorigin="anonymous".
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