Skip to content

Security: External scripts loaded without Subresource Integrity (SRI)#628

Open
barttran2k wants to merge 1 commit intooffa:masterfrom
barttran2k:contribai/fix/security/external-scripts-loaded-without-subresou
Open

Security: External scripts loaded without Subresource Integrity (SRI)#628
barttran2k wants to merge 1 commit intooffa:masterfrom
barttran2k:contribai/fix/security/external-scripts-loaded-without-subresou

Conversation

@barttran2k
Copy link
Copy Markdown
Contributor

Problem

The marked.min.js and marked-gfm-heading-id libraries are loaded from cdn.jsdelivr.net without integrity attributes. If the CDN is compromised or serves tampered content (supply chain attack), malicious JavaScript could be injected and executed in visitors' browsers.

Severity: medium
File: index.html

Solution

Add integrity and crossorigin="anonymous" attributes to both <script> tags. For example: <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js" integrity="sha384-<hash>" crossorigin="anonymous"></script>. Generate the hash using openssl dgst -sha384 -binary <file> | openssl base64 -A.

Changes

  • index.html (modified)

Testing

  • Existing tests pass
  • Manual review completed
  • No new warnings/errors introduced

The `marked.min.js` and `marked-gfm-heading-id` libraries are loaded from `cdn.jsdelivr.net` without `integrity` attributes. If the CDN is compromised or serves tampered content (supply chain attack), malicious JavaScript could be injected and executed in visitors' browsers.

Affected files: index.html

Signed-off-by: Trần Bách <45133811+barttran2k@users.noreply.github.com>
@offa
Copy link
Copy Markdown
Owner

offa commented Apr 7, 2026

Can someone with more experience in web development have a look at this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants