fix(deps): patch brace-expansion and js-yaml DoS advisories in TS SDK dev tree#141
Open
adnanrhussain wants to merge 2 commits into
Open
fix(deps): patch brace-expansion and js-yaml DoS advisories in TS SDK dev tree#141adnanrhussain wants to merge 2 commits into
adnanrhussain wants to merge 2 commits into
Conversation
… dev tree Resolves Dependabot alerts 25, 26, 27 (GHSA-3jxr-9vmj-r5cp, GHSA-52cp-r559-cp3m).
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
Updates the TypeScript SDK’s dev dependency tree to remediate three high-severity Dependabot advisories (brace-expansion and js-yaml DoS), primarily via lockfile bumps plus a targeted npm overrides pin for a transitive constraint in @redocly/openapi-core.
Changes:
- Add a scoped
overridesrule to force@redocly/openapi-coreto usejs-yaml@^4.3.0. - Update resolved versions in
package-lock.jsonforbrace-expansion(2.1.2, 5.0.8) andjs-yaml(4.3.0), plus an incidental nestedesbuildpatch bump undertsx.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| sdks/typescript/package.json | Adds a scoped npm override to lift js-yaml for @redocly/openapi-core to a patched version. |
| sdks/typescript/package-lock.json | Locks patched versions of brace-expansion and js-yaml (and an incidental esbuild patch) in the TypeScript SDK dev dependency tree. |
Files not reviewed (1)
- sdks/typescript/package-lock.json: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…reserve libc metadata
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Resolves Dependabot alerts #25, #26, #27 (all High).
The advisories
GHSA-3jxr-9vmj-r5cp —
brace-expansion(alerts #25, #26), CVE-2026-13149expand_()computespostby recursing over the entire remaining input before the early-return branches that discard it. For input made of consecutive non-expanding{}groups, every level spawns two recursions over the same tail —T(n) = 2·T(n−1), i.e. O(2ⁿ). A ~90-byte / 30-group input blocks the calling thread for ~2 minutes; slightly longer hangs it indefinitely. Themaxoption does not help — it only bounds the output-building loops, not either recursion. Reachable transitively through anyminimatch/globbrace pattern.GHSA-52cp-r559-cp3m —
js-yaml(alert #27), CVE-2026-59869A chain of mappings where each merges the previous (
a1: &a1 { <<: *a0, ... }) forces the loader to re-enumerate inherited keys at every link: 1 + 2 + … + N merged-key visits, so O(N²) CPU for O(N) input. At N=4000 (<100 KB of YAML) parse time exceeds 1s and grows quadratically from there.Both are CPU-exhaustion / DoS classes — no data exposure, no code execution.
Do they need fixing?
Not exploitable as we use them, but worth patching. All three are
devDependencies, transitive, and confined tosdks/typescript/package-lock.json:brace-expansioneslint/@typescript-eslint/typescript-estree→minimatchnpm run lintbrace-expansionopenapi-typescript→@redocly/openapi-core→minimatchnpm run generate:kg-typesjs-yamlopenapi-typescript→@redocly/openapi-corenpm run generate:kg-typesWhy the practical risk is low:
tsupdoes not bundle either package intodist/(verified — no references in the build output), and neither appears independenciesorpeerDependencies. SDK consumers installing@learning-commons/evaluatorsnever resolve them.brace-expansioninputs are our own ESLint glob patterns and in-repo file paths. Thejs-yamlinput is a single first-party document,https://docs.learningcommons.org/api-reference/knowledge-graph-api/openapi.yaml.generate:kg-typesis not invoked by any workflow; it is a manual, developer-run script.So: not urgent, not a live vulnerability for this repo. We're fixing it anyway because the change is dev-tree-only, behaviour-preserving, and leaving three High alerts open makes real alerts harder to spot.
How this fixes it
brace-expansion→ 5.0.8 and 2.1.2 (patched at 5.0.7 / 2.1.2) vianpm audit fix. Both requirers use caret ranges (^5.0.5,^2.0.1), so this is a lockfile-only bump with no manifest change. The upstream fix defers computingpostuntil after the early-return branches, and converts the{a},b}rewrite from recursion to an in-function loop.js-yaml→ 4.3.0 (first patched version) via a scopedoverridesentry inpackage.json.@redocly/openapi-core@1.34.16pins js-yaml to an exact4.2.0, andopenapi-typescript@7.13.0— the current latest — pins@redocly/openapi-core: ^1.34.6, so there is no upstream release to upgrade into. The override is deliberately scoped to@redocly/openapi-corerather than applied tree-wide:The version is pinned exactly rather than caretted.
@redocly/openapi-coredeliberately pins js-yaml to an exact4.2.0; a caret override would replace that pin with a floating range and let future 4.x minors drift into the one dependency this override exists to control. An exact pin holds the security floor and routes any further movement through Dependabot.The upstream fix caps total merged keys per parse (default 10K), which closes this and related merge edge cases. Our only js-yaml consumer parses one small first-party OpenAPI document, well under that cap.
This override should be removed once
openapi-typescriptships a release depending on@redocly/openapi-core2.x (which already usesjs-yaml@^5.2.1).Also picked up incidentally by
npm audit fix:tsx's nestedesbuild0.28.0 → 0.28.1. No other resolved versions changed.Lockfile regenerated on Linux
The lockfile is regenerated in a
node:24container rather than on macOS. npm only writes thelibcfilter arrays (["glibc"]/["musl"]) for platform-specific optional deps when it resolves on Linux, so regenerating on macOS silently drops them from 10 packages —@rolldown/binding-linux-*andlightningcss-linux-*.main's lockfile was last written by Dependabot (#136), which runs on Linux, so a macOS regeneration would have deleted that metadata and the next Dependabot PR would have re-added it, flip-flopping the diff indefinitely. This is platform-driven, not npm-version-driven: npm 10.9.4 and 11.6.2 both drop the fields on darwin even from a clean slate with correct registry metadata.Regenerating under Linux keeps all 10
libcarrays intact and confines the diff to the intended version bumps — 117 insertions / 117 deletions, all pure replacements.npm auditnow reports 0 high, 0 moderate. One Low remains — GHSA-g7r4-m6w7-qqqr, top-levelesbuild, arbitrary file read via the dev server on Windows. It is out of scope for these three alerts, requires a breaking upgrade, and we do not run the esbuild dev server; leaving it for a separate change.Verification
npm audit— 3 High resolved; only the unrelated Low remainsnpm run test:unit— 318/318 pass (22 files)npm run lint— 0 errorsnpm run typecheck— cleannpm run build— succeedsjs-yaml behaviour equivalence: ran
generate:kg-typesunder js-yaml 4.2.0 and 4.3.0 against the same spec URL and diffed the outputs — byte-identical. (The generatedkg-api.d.tsdoes drift againstmain, but that is upstream OpenAPI spec drift unrelated to this bump; it is deliberately not included here.)libcmetadata: all 10libcarrays preserved; the only resolved-version changes vsmainare the three intended bumps plustsx's nested esbuildOverride is honoured: there is no
package.jsonor workspace root abovesdks/typescript, sooverridesapplies. (In a non-root workspace package npm would ignore it silently.)demos/typescript/package-lock.jsonresolves neither package, so no change is needed there.Follow-ups (not blocking)
overridesentry onceopenapi-typescriptships a release depending on@redocly/openapi-core2.x, which already usesjs-yaml@^5.2.1. Left in place, the override would eventually pin js-yaml down against what redocly actually wants and mask a legitimate resolution.packageManagerinpackage.json, so lockfile regeneration is reproducible regardless of who runs it and on what platform.esbuildLow (GHSA-g7r4-m6w7-qqqr) still needs a breaking upgrade; out of scope here.