Skip to content

Security: Unpinned CDN Dependency for marked.js (Supply Chain Risk)#625

Open
barttran2k wants to merge 1 commit intooffa:masterfrom
barttran2k:contribai/fix/security/unpinned-cdn-dependency-for-marked-js-su
Open

Security: Unpinned CDN Dependency for marked.js (Supply Chain Risk)#625
barttran2k wants to merge 1 commit intooffa:masterfrom
barttran2k:contribai/fix/security/unpinned-cdn-dependency-for-marked-js-su

Conversation

@barttran2k
Copy link
Copy Markdown
Contributor

Problem

The marked library is loaded from jsDelivr without a pinned version (https://cdn.jsdelivr.net/npm/marked/marked.min.js). This means the latest version is always fetched. If the npm package is compromised or a breaking/malicious update is published, users of this page would automatically receive the compromised code.

Severity: high
File: index.html

Solution

Pin the dependency to a specific version and add a Subresource Integrity (SRI) hash, e.g.: <script src="https://cdn.jsdelivr.net/npm/marked@12.0.0/marked.min.js" integrity="sha384-..." crossorigin="anonymous"></script>.

Changes

  • index.html (modified)

Testing

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

The `marked` library is loaded from jsDelivr without a pinned version (`https://cdn.jsdelivr.net/npm/marked/marked.min.js`). This means the latest version is always fetched. If the npm package is compromised or a breaking/malicious update is published, users of this page would automatically receive the compromised code.

Affected files: index.html

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

@offa offa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this fixes the pinning issue, how are these versions kept up to date? I'm not an experienced web developer, so any input is welcome.

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