Skip to content

security: pin CDN versions + add SRI integrity hashes#1

Merged
kvnaust merged 1 commit into
kvnaust:mainfrom
sworrl:security/sri-hashes
Jun 4, 2026
Merged

security: pin CDN versions + add SRI integrity hashes#1
kvnaust merged 1 commit into
kvnaust:mainfrom
sworrl:security/sri-hashes

Conversation

@sworrl

@sworrl sworrl commented Jun 4, 2026

Copy link
Copy Markdown

What this fixes

The three CDN <script> tags in index.html load React, ReactDOM, and Babel Standalone from unpkg.com with:

  • No integrity= attribute (no SRI protection)
  • Floating version tags (@18, no patch pin) — a version bump on unpkg could silently change the code being served

If unpkg.com were compromised, or if a new semver-compatible version introduced malicious code, every visitor's browser would execute it with full access to their YouTube API key stored in localStorage.

Changes

Script Before After
React react@18 (unpinned, no SRI) react@18.3.1 + sha384-...
ReactDOM react-dom@18 (unpinned, no SRI) react-dom@18.3.1 + sha384-...
Babel standalone @babel/standalone (unpinned, no SRI) @babel/standalone@7.29.7 + sha384-...
Tailwind Play CDN unchanged unchanged + comment explaining why SRI can't apply

Tailwind CDN note: cdn.tailwindcss.com is the JIT/Play CDN — it generates CSS dynamically based on the page's class names and cannot carry a fixed SRI hash. A future hardening step would switch to a static pre-built tailwind.css, which would also unlock a proper Content-Security-Policy header. Left as-is here to keep this PR minimal/non-breaking.

SRI hash verification

Hashes computed from the live unpkg responses at the pinned versions:

react@18.3.1       sha384-DGyLxAyjq0f9SPpVevD6IgztCFlnMF6oW/XQGmfe+IsZ8TqEiDrcHkMLKI6fiB/Z
react-dom@18.3.1   sha384-gTGxhz21lVGYNMcdJOyq01Edg0jhn/c22nsx0kyqP0TxaV5WVdsSH1fSDUf5YJj1
babel@7.29.7       sha384-ezQ6HS3FLspd9te19o2McUV6FAK091+GG7KO54f/R8DKgCDi7fULhapNrd5LY+vG

Verify with: curl -sf <url> | openssl dgst -sha384 -binary | openssl base64 -A


This change was identified while hardening the Falcon Technix community mirror at nbvs.falcontechnix.com. Submitting back upstream so users of the original tool benefit too.

React 18 and Babel standalone were loaded from unpkg.com with no integrity
attribute and floating version tags (@18, no patch pin). A CDN compromise or
version flip would silently execute attacker code with access to the user's
YouTube API key stored in localStorage.

Changes:
- Pin React and ReactDOM to 18.3.1 (latest 18.x)
- Pin @babel/standalone to 7.29.7 (latest)
- Add sha384 integrity= + crossorigin=anonymous to all three
- Add comment on cdn.tailwindcss.com: the JIT Play CDN cannot carry SRI
  (dynamic response); a future improvement would be switching to a static
  pre-built tailwind.css

SRI hashes verified against the unpkg-served files at these exact versions.
@kvnaust kvnaust merged commit 0751993 into kvnaust:main Jun 4, 2026
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