Repository navigation
fix(captions): derive preview GSAP integrity - #3631
Merged
Merged
Conversation
Co-authored-by: miguel.sierra <[email protected]>
miga-heygen
approved these changes
Sep 4, 2026
miga-heygen
left a comment
Contributor
There was a problem hiding this comment.
Reviewed at 2e630d3. Clean fix for the preview SRI mismatch.
What it does: The preview interceptor serves the locally installed GSAP bundle but the HTML still carried the CDN SRI hash — browser blocks the script, gsap is undefined, previews break. Fix computes sha384 from the actual served bytes and rewrites the GSAP <script> tag's integrity attribute to match.
Verified:
sriSha384()hashes the raw Buffer (correct — SRI is byte-level, not encoding-level)withPreviewGsapSri()regex targets only GSAP script tags (positive lookahead forgsapin src), strips the old integrity, inserts the computed one- Non-GSAP scripts are untouched (test verifies
app.jskeeps its original integrity) gsapSourcechanged from string to Buffer (readFileSyncwithout encoding) — bothcrypto.createHashand Puppeteer'sreq.respondaccept Buffers, and this avoids a decode/re-encode roundtrip that could flip the hash- Navigation interception serves the rewritten HTML so the browser sees the correct SRI on first parse
require.main === moduleguard makes the script importable for testing without side-effecting on import- Manifest updated (139 files, new hash)
LGTM.
— Miga
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.
Fixes #3629
Summary
crossorigin; only the in-memory document served to the offline preview is updated.Root cause
make-theme.cjsemits a pinned GSAP 3.14.2 CDN tag with SRI, whilepreview-frames.cjsresolves and serves the locally installed bundle (currently[email protected]). Chromium correctly blocked those mismatched bytes.Evidence
node /tmp/hf3629-e2e/sri-browser-check.cjscompleted withbrowser preview loaded; no SRI console error; it asserted thatwindow.__timelines.mainregistered and that the page emitted no integrity/SRI console errors.Tests
bun test skills/embedded-captions/scripts/preview-frames.test.mjsbun run lintCommit-pinned links
hyperframes/skills/embedded-captions/scripts/make-theme.cjs
Line 561 in 05b57f9
hyperframes/skills/embedded-captions/scripts/preview-frames.cjs
Lines 64 to 91 in 05b57f9
hyperframes/skills/embedded-captions/scripts/preview-frames.cjs
Lines 26 to 40 in 2e630d3
hyperframes/skills/embedded-captions/scripts/preview-frames.cjs
Lines 79 to 114 in 2e630d3
hyperframes/skills/embedded-captions/scripts/preview-frames.test.mjs
Lines 1 to 24 in 2e630d3
hyperframes/skills-manifest.json
Lines 4 to 7 in 2e630d3
No #3628 changes and no production/config changes.