Skip to content

fix(deps): remediate dependency security vulnerabilities (165→16, 4 critical→0) - #3406

Merged
Marfuen merged 2 commits into
mainfrom
mariano/security-dependency-upgrades-2
Jul 14, 2026
Merged

fix(deps): remediate dependency security vulnerabilities (165→16, 4 critical→0)#3406
Marfuen merged 2 commits into
mainfrom
mariano/security-dependency-upgrades-2

Conversation

@Marfuen

@Marfuen Marfuen commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Comprehensive dependency-security remediation. Reduces bun audit from 165 findings (4 critical / 58 high) → 16 (0 critical / 10 high / 3 moderate / 3 low). Clean single commit off main; all changes stay within declared version ranges and bun.lock is a clean regeneration.

Supersedes #3403 (that branch had the same first phase plus a merge commit; this PR is rebased clean off main and includes the further mitigation). #3403 can be closed.

Severity Before After
🔴 Critical 4 0
🟠 High 58 10
🟡 Moderate 84 3
⚪ Low 19 3
Total 165 16

What changed

Direct bumps (the vulnerable instance was the direct dep):

Package Why
better-auth 1.4.22 → ^1.6.13 CVE-2026-53512 (CVSS 9.1) OAuth refresh-token replay; mcp()/oidcProvider is enabled in apps/api
next → ^16.2.6 App Router middleware/proxy bypass, SSRF, DoS
axios → ^1.16.0 Proxy-Authorization credential leak, prototype pollution
vitest / vite / turbo in-major UI-server file read (dev) / fs.deny bypass / —

Dead-dep removal (unused, referenced by no script):

  • gitmoji → cascade-drops request, tough-cookie@2.5.0, tar@2.2.2, node-gyp@3
  • semantic-release-discord + -notifier → drops discord.js/@discordjs/rest (pinned undici@6). The actual release→Discord notification is a separate webhook GitHub Action, no npm deps — untouched.

Parent bumps: @browserbasehq/stagehand → ^3.7.0 (drops langchain + langsmith), @nestjs/swagger → ^11.4.5 (patched js-yaml).

Overrides for transitive vulns (backcompat-safe): axios, form-data, ws, semver, hono, @hono/node-server, multer, systeminformation, tmp, dompurify, ip-address, postcss, prismjs, qs, effect, protobufjs, linkify-it, mermaid, shell-quote, vite, @opentelemetry/core, @sigstore/core, markdown-it, @babel/core — plus @tiptap/* → 3.22.1 (lockstep pin).

Lockfile regen floats remaining stale transitives to patched in-range: undici 6.27.0 + 7.28.0, js-yaml 3.15.0 + 4.3.0, brace-expansion, minimatch (non-bundled), @sigstore/verify 3.1.1.

undici is deliberately not force-overridden across majors — discord.js/@discordjs/rest used its v6 internals; removing them lets the regen float both majors to patched versions safely.

Verification

  • turbo build — 20/20 tasks pass (caught + fixed a tiptap lockstep break from the regen)
  • Typecheck — 0 production errors (remaining are pre-existing .spec.ts debt on main)
  • apps/api/Dockerfile.multistage builds clean — fresh bun install (oven/bun:1.2.8) + package builds + nest build
  • API image boots past module-load — better-auth 1.6 + Prisma load; container stops only at the expected SECRET_KEY env guard
  • openapi.json not touched (no API endpoint files changed)

Remaining 16 (all dev/build-time or no upstream fix)

tar (electron-builder/giget/npm-bundled), minimatch (npm-bundled), esbuild (dev-server only), uuid (exceljs pins v8, no fix), sigstore (release CI), cookie (disjoint majors), @ai-sdk/provider-utils (low, via stagehand). None are prod-runtime-reachable with a safe fix available.

Follow-up

Tree-shaking (removing unused deps) will be its own PR — knip flags ~124 but it's noisy (confirmed false positives and negatives), so it needs a configured, build-verified pass.

Test plan

  • CI build + typecheck
  • Smoke-test auth flows (login, OAuth, hosted MCP) — better-auth 1.4→1.6
  • Confirm the API Docker image deploys/boots with real env

🤖 Generated with Claude Code


Summary by cubic

Cuts bun audit findings from 165 (4 critical) to 16 (0 critical) by upgrading, pinning, and removing dependencies, and fixes a TS mismatch with better-auth 1.6 role statements in the app. No runtime changes; full build, typecheck, and API Docker image verified.

  • Dependencies

    • Upgraded key deps: better-auth → ^1.6.23, axios → ^1.16.0; dev tooling (vite/vitest/turbo) to latest in-range; bumped @browserbasehq/stagehand → ^3.7.0 and @nestjs/swagger → ^11.4.5.
    • Removed unused gitmoji, semantic-release-discord, and semantic-release-discord-notifier (drops old undici@6 chain).
    • Added overrides to patch vulnerable transitives and pinned @tiptap/* to 3.22.1; regenerated bun.lock.
    • Result: 0 critical, 10 high, 3 moderate, 3 low; remaining issues are dev/build-time or awaiting upstream fixes.
  • Bug Fixes

    • Made mergePermissions accept readonly arrays and cast role.statements accordingly to match better-auth 1.6 types, fixing Next build TypeScript errors.

Written for commit a068e84. Summary will update on new commits.

Review in cubic

Comprehensive dependency-security pass. Reduces `bun audit` from 165
findings (4 critical / 58 high) to 16 (0 critical / 10 high / 3 moderate /
3 low). All changes stay within declared version ranges; bun.lock is a
clean regeneration.

Direct bumps (vulnerable instance was the direct dep):
- better-auth 1.4.22 -> ^1.6.13  (CVE-2026-53512, CVSS 9.1 OAuth
  refresh-token replay; mcp/oidcProvider plugin is enabled in apps/api)
- next -> ^16.2.6 (middleware/proxy bypass, SSRF, DoS)
- axios -> ^1.16.0 (proxy-auth credential leak, prototype pollution)
- vitest -> ^3.2.6, vite -> ^6.4.3, turbo -> ^2.10.5

Dead-dep removal (unused, referenced by no script):
- gitmoji -> cascade-drops request, tough-cookie@2.5.0, tar@2.2.2, node-gyp@3
- semantic-release-discord + -notifier -> drops discord.js/@discordjs/rest
  (which pinned undici@6 and blocked patching it). The real release->Discord
  notification is a separate webhook GitHub Action (no npm deps) - untouched.

Parent bumps (newer parent pulls a patched child):
- @browserbasehq/stagehand -> ^3.7.0 (drops langchain + langsmith)
- @nestjs/swagger -> ^11.4.5 (patched js-yaml 4.3.0)

Overrides for transitive vulns (backcompat-safe, verified):
- axios, form-data, ws, semver, hono, @hono/node-server, multer,
  systeminformation, tmp, dompurify, ip-address, postcss, prismjs, qs,
  effect, protobufjs, linkify-it, mermaid, shell-quote, vite,
  @opentelemetry/core, @sigstore/core, markdown-it, @babel/core
- @tiptap/* pinned 3.22.1 (lockstep; the lockfile regen floated the
  transitive @tiptap/* apart from @tiptap/react@3.22.1)

undici NOT force-overridden across majors (discord.js path removed; the
lockfile regen floats v6->6.27.0 and v7->7.28.0 within ranges instead).

Verified: full `turbo build` (20/20) + typecheck (0 production errors)
across all apps; apps/api Dockerfile.multistage builds clean and boots past
module-load (better-auth 1.6 loads; stops only at the expected SECRET_KEY
env guard). openapi.json intentionally untouched (no API files changed).

Remaining 16 are all dev/build-time or no-upstream-fix: tar
(electron-builder/giget/npm-bundled), minimatch (npm-bundled), esbuild
(dev-server only), uuid (exceljs, no v8 fix), sigstore (release CI), cookie
(disjoint majors), @ai-sdk/provider-utils (low, via stagehand).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
app Ready Ready Preview, Comment Jul 14, 2026 2:55pm
comp-framework-editor Ready Ready Preview, Comment Jul 14, 2026 2:55pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
portal Skipped Skipped Jul 14, 2026 2:55pm

Request Review

better-auth 1.6 types role `statements` as readonly tuples
(ExactRoleStatements = { readonly [P]: readonly [...] }), so casting
`role.statements as Record<string, string[]>` (mutable) is an invalid
conversion and fails `next build`'s TypeScript check on Vercel:

  Type 'readonly ["read"]' cannot be assigned to the mutable type 'string[]'

Widen `mergePermissions`'s `source` param to `Record<string, readonly
string[]>` (it only reads, never mutates) and cast to the readonly type.
Verified against better-auth@1.6.23 dist types; the only `.statements`
cast in the app (other Record<string,string[]> casts are on JSON/any).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel
vercel Bot temporarily deployed to Preview – portal July 14, 2026 14:51 Inactive
@Marfuen
Marfuen merged commit d403e9c into main Jul 14, 2026
10 checks passed
@Marfuen
Marfuen deleted the mariano/security-dependency-upgrades-2 branch July 14, 2026 14:59
claudfuen pushed a commit that referenced this pull request Jul 15, 2026
# [3.102.0](v3.101.2...v3.102.0) (2026-07-15)

### Bug Fixes

* **ci:** pin Syft 1.46.0 in SBOM action (1.42.3 can't parse bun.lock) ([#3415](#3415)) ([5f47024](5f47024))
* **ci:** scan bun.lock via file: input so the SBOM isn't empty ([#3414](#3414)) ([e47e6fd](e47e6fd))
* **deps:** override uuid to ^11.1.1 (Dependabot [#85](#85)) ([#3418](#3418)) ([598ff8c](598ff8c))
* **deps:** patch tmp and js-yaml in mcp-server (Dependabot [#58](https://github.com/trycompai/comp/issues/58)/[#59](https://github.com/trycompai/comp/issues/59)/[#71](https://github.com/trycompai/comp/issues/71)) ([#3412](#3412)) ([59a6b0f](59a6b0f))
* **deps:** remediate dependency security vulnerabilities ([#3403](#3403)) ([7577a37](7577a37))
* **deps:** remediate dependency security vulnerabilities (165→16, 4 critical→0) ([#3406](#3406)) ([d403e9c](d403e9c))
* **device-agent:** implement the installer-cleanup fix ([#3381](#3381)) ([0f7581b](0f7581b))
* **security:** prevent SSRF in task-automation enterprise API calls ([#3411](#3411)) ([dcec288](dcec288)), closes [#116](#116)
* **security:** resolve open CodeQL alerts (XSS, sanitization, workflow perms) ([#3419](#3419)) ([32329be](32329be)), closes [#108](#108) [js/xss-throu#dom](https://github.com/js/xss-throu/issues/dom) [#95](#95) [84/#85](#85)

### Features

* **framework-editor:** raise requirement description limit to 100,000 chars (FRAME-2) ([67c9f4a](67c9f4a))
@claudfuen

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.102.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants