Skip to content

⬆️(dependencies) update serialize-javascript to v7.1.3 [SECURITY] - #2912

Merged
lunika merged 1 commit into
mainfrom
renovate/npm-serialize-javascript-vulnerability
Oct 26, 2026
Merged

lunika merged 1 commit into
mainfrom
renovate/npm-serialize-javascript-vulnerability

Conversation

@renovate

@renovate renovate Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

This PR contains the following updates:

Package Change Age Confidence
serialize-javascript 7.1.2 → 7.1.3 age confidence

Serialize JavaScript: Cross-site scripting (XSS) via unescaped </script at the end of a serialized function body

CVE-2026-115897 / GHSA-m5mm-p8h7-m29v

More information

Details

Impact

serialize-javascript escapes its output so it is safe to embed inside a
<script> element. Before 7.1.3 that guarantee did not hold for a function
value whose source ends in a bare </script
.

Each function body is escaped on its own, and a bare </script was only
neutralized when followed — within the same body — by a character the HTML
tokenizer treats as ending the tag name (TAB, LF, FF, CR, SPACE, / or >).
A body ending exactly at </script has no following character, so it was
emitted unescaped. The delimiter is then supplied by the surrounding output
(for example the newline the space option emits after the value), and a
later serialized value can supply the closing > followed by markup:

const serialize = require('serialize-javascript');
function f() {} f.toString = () => 'function f(){ return 1 }//</script';
function g() {} g.toString = () => 'function g(x){ return x } > <img src=x onerror=alert(1)>';
serialize({ a: { f }, g }, { space: 2 });
// {
//   "a": {
//     "f": function f(){ return 1 }//</script
//   },
//   "g": function g(x){ return x } > <img src=x onerror=alert(1)>
// }

Embedded in a <script> element, the script ends at the injected tag and the
<img> becomes a live element in the page.

Exploitation requires an attacker to control the source text of a
serialized function, in practice through a spoofed toString(). Real
functions always end in }, so ordinary function values are not affected,
and non-function values (including strings containing </script) are
escaped correctly.

Patches

Fixed in 7.1.3 (#​235). The bare </script form is now also matched at
the end of the function body, so it is escaped regardless of what follows it
in the output.

Workarounds

Upgrade to 7.1.3. If you cannot upgrade, do not serialize function values
whose source text (or toString()) can be influenced by an attacker.

Credits

Reported by ha_kr25 via the Yahoo bug bounty program.

Severity

  • CVSS Score: 2.1 / 10 (Low)
  • Vector String: CVSS:4.0/AV:N/AC:H/AT:P/PR:L/UI:P/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Release Notes

yahoo/serialize-javascript (serialize-javascript)

v7.1.3

Compare Source

See: GHSA-m5mm-p8h7-m29v

What's Changed

Note on ignoreFunction

With ignoreFunction: true, function values are now omitted the same way JSON.stringify omits them, without deleting them from the input object. Functions inside arrays are emitted as null (previously this produced Array.prototype.slice.call(...) output).

New Contributors

Full Changelog: yahoo/serialize-javascript@v7.1.2...v7.1.3


Configuration

📅 Schedule: (UTC)

  • Branch creation
    • At any time (no schedule defined)
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate Bot added automated Pull request created automatically dependencies Pull requests that update a dependency file noChangeLog labels Oct 26, 2026
@lunika
lunika enabled auto-merge (squash) October 26, 2026 10:49
@github-actions

Copy link
Copy Markdown
Contributor

Size Change: 0 B

Total Size: 4.08 MB

📦 View Changed
Filename Size Change
apps/impress/out/_next/static/33ba503b/_buildManifest.js 0 B -737 B (removed) 🏆
apps/impress/out/_next/static/ac6fed9f/_buildManifest.js 737 B +737 B (new file) 🆕

compressed-size-action

@lunika
lunika merged commit 00d8f23 into main Oct 26, 2026
54 checks passed
@lunika
lunika deleted the renovate/npm-serialize-javascript-vulnerability branch October 26, 2026 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automated Pull request created automatically dependencies Pull requests that update a dependency file noChangeLog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant