Skip to content

Fix decode-uri-component DoS in Gatsby example (CVE-2026-118664) - #120

Merged
miguelcalderon merged 1 commit into
mainfrom
support-agent/linear-b10492e5-679f-4157-ba27-6a54bf18540d-32808992-3eb4-4b3d-893b-7ea84cb6e4cc
Nov 16, 2026
Merged

miguelcalderon merged 1 commit into
mainfrom
support-agent/linear-b10492e5-679f-4157-ba27-6a54bf18540d-32808992-3eb4-4b3d-893b-7ea84cb6e4cc

Conversation

@robocop-the-helper

Copy link
Copy Markdown
Contributor

Summary

Fixes SECSLOP-8 / Dependabot alert #1863. In examples/gatsbyjs, decode-uri-component@0.2.2 came in through gatsby@5.16.1 → query-string@6.14.1. It is affected by GHSA-qr28-fpjm-wq7f (CVE-2026-118664, high, quadratic replacement) and GHSA-vcc3-ghjq-m6fr (moderate). gatsby 5.16.1 is the latest release, so there is no upstream fix to upgrade to.

This PR adds two overrides to examples/gatsbyjs/package.json:

"query-string": "^9.5.1",
"decode-uri-component": "^0.5.1"

Lockfile changes:

  • query-string 6.14.1 → 9.5.1
  • decode-uri-component 0.2.2 → 0.5.1
  • filter-obj 1.1.0 → 5.1.0
  • split-on-first 1.1.0 → 3.0.0
  • strict-uri-encode removed

Why not override only decode-uri-component?

That was the suggested fix, but it breaks Gatsby. decode-uri-component 0.4+ is published as an ES module only (export default). query-string 6.x is CommonJS and calls require('decode-uri-component')(value). With only that override, queryString.parse('?a=1') throws TypeError: decodeComponent is not a function, both in Node 24 and in a webpack bundle.

Gatsby uses query-string in exactly one place: the develop-only dev 404 page (import queryString from "query-string", calling .parse and .stringify). query-string 9.5.1 provides that default export and depends on decode-uri-component ^0.5.0. The second override keeps decode-uri-component at 0.5.1 or later.

Exposure

The vulnerable code never shipped in production builds: the dev 404 page is only created when NODE_ENV !== 'production'. Under gatsby develop it parses the developer's own URL in their browser. There is no server-side path that feeds request data to it.

Verification

  • npm ci and npm ls decode-uri-component --all: the only copy is 0.5.1.
  • npm run build: passes, as it did before the change.
  • npm test: 7/7 pass, as before.
  • npm audit: no decode-uri-component or query-string findings. Highs went from 5 to 4; the rest are follow-redirects/axios, webpack-dev-middleware and the gatsby entry that rolls them up, all out of scope.
  • pnpm exec biome check .: clean.
  • gatsby develop builds the development bundle. The dev 404 page code it serves includes query-string 9.5.1 and decode-uri-component 0.5.1, and webpack resolves query-string's default export (.parse / .stringify).
  • Bundled with the project's webpack, query-string 9.5.1 gives the same parse/stringify output as 6.14.1 on malformed, UTF-8 and + input.
  • Reproduced the DoS: 40,000 distinct runs take about 36.8 s on 0.2.2 and about 0.13 s on 0.5.1.
  • New package versions were published between 2021 and 2026-10-23 and all carry registry signatures. The newest, decode-uri-component 0.5.1, was published 19 days before this change.

The lockfile was generated with npm 11.21.2 so the diff has no unrelated peer flag changes.

Not verified: I couldn't load the dev 404 page in a real browser because the sandbox lacks Chromium's system libraries. gatsbyjs is also excluded from the Playwright e2e suite.

Follow-up

Remove both overrides once Gatsby ships a release with a fixed query-string.

🤖 Generated with Claude Code

gatsby@5.16.1 pins query-string@^6.14.1, which pulls in
decode-uri-component@0.2.2 (GHSA-qr28-fpjm-wq7f, GHSA-vcc3-ghjq-m6fr).
No gatsby release ships a fixed query-string.

Override query-string to ^9.5.1, which depends on decode-uri-component
^0.5.0, and floor decode-uri-component at ^0.5.1. Overriding only
decode-uri-component is not enough: 0.5.x is ESM-only, so the CommonJS
query-string 6.x gets a namespace object and throws "decodeComponent is
not a function". Gatsby's only consumer is the develop-only dev 404 page,
which webpack bundles via a default import that query-string 9 provides.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@robocop-the-helper
robocop-the-helper Bot requested a review from a team as a code owner November 11, 2026 18:51

@miguelcalderon miguelcalderon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, this looks good. I checked Gatsby 5.16.1: the dev 404 page is the only place that uses query-string, it's only created outside production builds, and version 9.5.1 still provides the parse and stringify calls that page relies on. No other package here depends on query-string, so the overrides don't affect anything else. The explanation of why overriding decode-uri-component alone breaks Gatsby is really helpful. Approving. Please remember to remove both overrides once Gatsby releases a fixed version.

@miguelcalderon
miguelcalderon merged commit 14d71d5 into main Nov 16, 2026
3 checks passed
@miguelcalderon
miguelcalderon deleted the support-agent/linear-b10492e5-679f-4157-ba27-6a54bf18540d-32808992-3eb4-4b3d-893b-7ea84cb6e4cc branch November 16, 2026 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant