Add Subresource Integrity hash to Redoc CDN script#45
Open
dmchaledev wants to merge 1 commit into
Open
Conversation
The docs page loads redoc.standalone.js from jsDelivr with no SRI check, so a compromised or tampered CDN response would execute arbitrary JS on the API reference page — including inside Redoc's "Try it" console where users paste live API keys. Pin the script with a sha384 integrity hash (verified against jsDelivr's own published file hash for redoc@2.5.3) so the browser refuses to run the script if the served bytes ever differ. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ln27LeJd3LfFBkUaCQL6Er
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
docs/index.htmlloadsredoc.standalone.jsfrom the jsDelivr CDN with no Subresource Integrity (SRI) check. If that CDN response were ever tampered with (compromised CDN, cache poisoning, MITM), the browser would silently execute arbitrary JS on the API reference page — including inside Redoc's "Try it" console, where integrators paste live API keys.integrity="sha384-..."attribute pluscrossorigin="anonymous"so the browser refuses to execute the script if the served bytes ever differ from the known-good version.https://cdn.jsdelivr.net/npm/redoc@2.5.3/bundles/redoc.standalone.jsand cross-checked against jsDelivr's own published SHA-256 for that file (data.jsdelivr.compackage API) to confirm it's byte-for-byte correct before pinning.Test plan
redoc@2.5.3'sbundles/redoc.standalone.js, confirming the file used to derive the SRI hash is authentic and unmodified.integrityattribute.🤖 Generated with Claude Code
https://claude.ai/code/session_01Ln27LeJd3LfFBkUaCQL6Er
Generated by Claude Code