Skip to content

fix(security): drop sprintf-js via global-agent 4; accept unpatched braces - #261

Merged
rkorszun merged 1 commit into
developfrom
cursor/security-braces-sprintf-7d28
Oct 12, 2026
Merged

rkorszun merged 1 commit into
developfrom
cursor/security-braces-sprintf-7d28

Conversation

@rkorszun

Copy link
Copy Markdown
Collaborator

Summary

Addresses Dependabot braces (GHSA-vfj7-8cjw-p6xm, stack exhaustion on deeply nested patterns) and sprintf-js alert #273 (GHSA-hp3w-g68c-fv3c, unbounded precision).

Neither package has a patched npm release (braces latest 3.0.3, sprintf-js latest 1.1.3). This PR:

  • Drops the production sprintf-js@1.1.3 chain by overriding global-agent → >=4.1.3 (4.x removed roarr / sprintf-js; API still exports CJS bootstrap(), which is all onnxruntime-node@1.24.3 script/install.js uses).
  • Leaves braces at 3.0.3 and keeps the existing pnpm audit ignore for GHSA-vfj7-8cjw-p6xm (no compatible replacement; build/test only).

Overrides live in pnpm-workspace.yaml (this repo’s pnpm 10 location, same as #245). A partial package.json pnpm.overrides replaces the workspace override set in the lockfile rather than merging — verified; doing that would drop the existing transitive security pins.

Dependency chains (pnpm why -r)

braces@3.0.3 — dev / build only

  • client (dev): tailwindcss → chokidar / fast-glob / micromatch → braces@3.0.3
  • server (dev): jest / ts-loader (and Nest CLI tooling) → micromatch → braces@3.0.3
  • Not in the server/worker production graph or the client production bundle.

sprintf-js (before) — server production tree, not inference runtime

@huggingface/transformers@4.2.0
  → onnxruntime-node@1.24.3
    → global-agent@3.0.0
      → roarr@2.15.4
        → sprintf-js@1.1.3

Also reached via @langchain/community’s peer on @huggingface/transformers.

onnxruntime-node only requires global-agent in script/install.js (postinstall) to honor GLOBAL_AGENT_* proxy env vars when downloading native binaries. The inference entry (dist/index.js) does not import it. Local embeddings (server/src/ai/embedding.service.ts) load @huggingface/transformers at runtime, but that path does not load sprintf-js.

After this PR: global-agent@4.1.3 (no roarr / sprintf-js). pnpm why -r sprintf-js is empty; sprintf-js@1.1.3 and roarr are gone from pnpm-lock.yaml.

Production risk

Advisory Severity Runtime? Risk Action
GHSA-vfj7-8cjw-p6xm braces ≤3.0.3 High (DoS via ~9k-char nested brace patterns) No — Tailwind/chokidar/Jest/ts-loader only; patterns are developer-controlled Low Risk accepted. No 3.0.4+ on npm; micromatch/braces#72 was withdrawn. Keep auditConfig.ignoreGhsas: GHSA-vfj7-8cjw-p6xm.
GHSA-hp3w-g68c-fv3c sprintf-js ≤1.1.3 (#273) Moderate (RangeError from unbounded %.Nf precision) Tree: yes (server prod dep). Loaded at inference: no (install-script only). Format strings are library-controlled, not user input. Low (pre-fix); cleared (post-fix) No 1.1.4+. Safest compatible override: global-agent >=4.1.3 (what current onnxruntime-node already uses upstream).

Versions

Package Before After
global-agent 3.0.0 4.1.3 (override >=4.1.3)
sprintf-js 1.1.3 removed
roarr 2.15.4 removed
braces 3.0.3 3.0.3 (unpatched; ignored)

Lockfile refreshed with pnpm 10.23.0.

Test plan

  • pnpm audit --audit-level=high
  • pnpm --filter @opendexcom/plugin-interface build + pnpm build
  • pnpm --filter client test
  • pnpm --filter server test
  • CI green on this draft (do not merge)
Open in Web Open in Cursor 

No patched sprintf-js 1.1.4+ exists (GHSA-hp3w-g68c-fv3c). Pin
global-agent to 4.1.3+ so onnxruntime-node no longer pulls
roarr/sprintf-js. braces remains unpatched (GHSA-vfj7-8cjw-p6xm);
keep the existing audit ignore.

Co-authored-by: Rafal Korszun <rkorszun@users.noreply.github.com>
@rkorszun
rkorszun marked this pull request as ready for review October 12, 2026 17:54
@rkorszun
rkorszun merged commit e1ec761 into develop Oct 12, 2026
4 checks passed
@rkorszun
rkorszun deleted the cursor/security-braces-sprintf-7d28 branch October 12, 2026 17:55
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.

2 participants