-
-
Notifications
You must be signed in to change notification settings - Fork 25
Bump marked to 3.0.8 #553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
+5
−5
Closed
Bump marked to 3.0.8 #553
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
What is the latest stable release of the marked npm package, and does marked 3.0.8 work with a baremarked(markdownString)call returning a synchronous string?💡 Result:
The latest stable release of the marked npm package is 18.0.0, released on 2026-04-07. Marked 3.0.8 works with a bare marked(markdownString) call, which returns a synchronous HTML string. This API has been consistent since at least version 3.0.0 (2021), where marked is the default export functioning as the synchronous parser. The async: false default (since v4.1.0) ensures synchronous string output unless async extensions are used.
Citations:
🏁 Script executed:
Repository: emuflight/EmuConfigurator
Length of output: 217
🌐 Web query:
GHSA-rrrm-qjm4-v8hf marked ReDoS block.def vulnerability💡 Result:
GHSA-rrrm-qjm4-v8hf is a high-severity (CVSS 7.5) Regular Expression Denial of Service (ReDoS) vulnerability in the npm package 'marked' (a Markdown parser), corresponding to CVE-2022-21680. It affects versions < 4.0.10 and was patched in 4.0.10. The vulnerability is due to inefficient regular expression complexity (catastrophic backtracking) in the block.def regex, which can be triggered by specially crafted Markdown strings, such as [x]:${' '.repeat(1500)}x ${' '.repeat(1500)} x. This leads to denial of service by excessive CPU usage when processing untrusted input without time limits or worker threads. Impact: Anyone parsing untrusted Markdown with vulnerable versions of marked. Workarounds: Avoid untrusted Markdown or use worker threads with time limits. Official advisory last updated November 29, 2023. Upgrade to marked >= 4.0.10 to remediate.
Citations:
🌐 Web query:
GHSA-5v2h-r2cx-5xgj marked ReDoS inline.reflinkSearch vulnerability patched version💡 Result:
GHSA-5v2h-r2cx-5xgj is a ReDoS (Regular Expression Denial of Service) vulnerability in the marked npm package due to inefficient regular expression complexity in inline.reflinkSearch, which can cause catastrophic backtracking on certain strings, leading to denial of service. Affected versions are marked < 4.0.10 (or < 4.0.9 per some sources). The patched version is 4.0.10.
Citations:
🏁 Script executed:
Repository: emuflight/EmuConfigurator
Length of output: 1634
marked@3.0.8ships with known ReDoS advisories — upgrade to 4.0.10 or later.Two published GitHub advisories affect
markedversions prior to 4.0.10, including 3.0.8:block.def.inline.reflinkSearch.In this app,
marked()is called on GitHub release notes insrc/js/tabs/firmware_flasher.js(line 72). While the source is semi-trusted, a compromised or malicious release body could trigger catastrophic backtracking and hang the renderer. Upgrade to marked>= 4.0.10to resolve both vulnerabilities (or jump to the latest 18.0.0).🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@coderabbitai, fine, but you will need to scour the codebase and offer compatibility upgrades to accommodate newer
marked.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
I'll scour the codebase for every
markedusage and simultaneously check the breaking-change history so I can propose precise compatibility patches.🏁 Script executed:
Length of output: 6392
🌐 Web query:
💡 Result:
marked (markedjs/marked) major-version migration highlights (v3 → v4 → v5 → v6)
v5 → v6 (6.0.0)
v4 → v5 (5.0.0)
v3 → v4 (4.0.0)
Sources
Citations:
The
markedcall is aliased — I need to trace the import and check all HTML entry points and build scripts.🏁 Script executed:
Length of output: 11507
🌐 Web query:
💡 Result:
marked v4 (from v3): breaking changes
import { marked } from 'marked'(ESM) orconst { marked } = require('marked')(CJS). [1]/lib/marked.jswas removed (use/marked.min.jsinstead). [1]marked.parse(...)instead ofmarked(...). [1]“Deprecated options” (what to expect around v4 → v5)
Starting in v5.0.0, marked began logging deprecation warnings (some are on by default) and recommends extensions instead, e.g.:
mangle→marked-mangleheaderIds/headerPrefix→marked-gfm-heading-idhighlight/langPrefix/callback→marked-highlightbaseUrl,smartypants,xhtmlreplacements. [2](Those options are later listed as removed in the docs, with the same “use an extension / external lib” guidance.) [3]
Async renderer support (“async renderer”)
Marked’s async mode is not “async renderer methods”. Instead:
async: truemakesmarked.parse()return a Promise, and marked will await asyncwalkTokensbefore rendering. [4]So if you need async work (fetching, DB lookups, etc.), do it in
walkTokens(or an extension’swalkTokens) withasync: true, not by making renderer methods async. [4]Example
[4]
Sources
[1] marked v4.0.0 release notes (breaking changes) (github.com)
[2] marked v5.0.0 release notes (deprecated-option warnings + replacements) (github.com)
[3] marked “Using Advanced” options list (removed options + recommended replacements) (marked.js.org)
[4] marked docs: “Async Marked” (
async: true+ awaitswalkTokens) (marked.js.org)Citations:
Good — I can see
marked(formattedNotes)at line 72. Now let me inspect exactly howmarkedis loaded/exposed as a global inmain.html.🏁 Script executed:
Length of output: 28726
@nerdCopter, I've traced everymarkedreference in the codebase. There is one call site and one loading point — both are simple to patch. Here is everything that needs to change for full compatibility withmarkedv4+ (through the current latest, 18.0.0):Root cause of the incompatibility
In marked v4, the default export was removed. You must now use
const { marked } = require('marked')(CJS) instead of treating the whole module as the function, andmarked.parse(...)replaces the directmarked(...)call in script-tag contexts.Change 1 —
package.jsonBump to at least
4.0.10(the ReDoS fix floor) or jump straight to latest:Change 2 —
src/main.htmlThe current loader uses the v3 default-export pattern. In v4+
require('marked')returns the module object, not the function itself, sowindow.markedwould be set to a plain object and the call infirmware_flasher.jswould throwmarked is not a function. Fix by destructuring:try { - window.marked = require('marked'); + window.marked = require('marked').marked; console.log('[OK] marked loaded'); } catch(e) { console.error('ERROR: Failed to load marked:', e.message); }Change 3 —
src/js/tabs/firmware_flasher.js(line 72)The preferred synchronous API from v4 onward is
marked.parse(). The baremarked()call became the deprecated form, andmarked.parse()is the consistent entry point across v4–v18.Summary
package.json3.0.8→^18.0.0src/main.htmlrequire('marked')→require('marked').markedsrc/js/tabs/firmware_flasher.jsmarked(formattedNotes)→marked.parse(formattedNotes)No other files reference
marked. Because the project sets no custom options, renderers, or extensions, there are no further deprecation concerns from marked v5's removed options (mangle,headerIds,highlight, etc.) — none of those are used here.✏️ Learnings added
🧠 Learnings used