Skip to content

Update dependencies and patch security advisories - #7133

Merged
SawyerHood merged 5 commits into
mainfrom
deps/security-updates
Nov 5, 2026
Merged

SawyerHood merged 5 commits into
mainfrom
deps/security-updates

Conversation

@SawyerHood

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

The lockfile had 273 npm advisory hits across 57 packages (8 critical, many high). The ones that reach production include: TanStack Start reflected XSS (GHSA-qx66-fv34-fjm8, apps/web), handlebars JavaScript injection via AST type confusion (CVE-2026-33937, @bb/templates), 37 hono advisories (JSX/SSR XSS, cookie/serveStatic bypasses, CORS ReDoS), drizzle-orm SQL-identifier escaping (CVE-2026-39356, also now required by better-auth 1.7.18), undici TLS validation bypass / cache poisoning, zod memory exhaustion (GHSA-mrhx-c7xc-m3w5), and MCP SDK, react-router, prosemirror-view, dompurify, tar, sharp and node-forge issues.

What changed

  • Every dependency moved to its latest in-major release (exact pins to their latest patch: electron 44.10.2, npm 11.21.2, better-sqlite3 12.11.1, pi 0.84.4, hono 4.13.16, zod 4.6.7). Expo packages aligned to SDK 58.0.23 (react-native 0.88.1, safe-area 5.11); eas-cli 22 → 27.
  • Majors taken for security: drizzle-orm 0.38 → 0.45.4 (drizzle-kit 0.31, drizzle-kit generate reports no schema changes for @bb/db and @bb/connect-db), @cloudflare/workers-types 5 (wrangler 4.158 peer).
  • Patches: ported mermaid, @better-auth/api-key, @hugeicons/react-native, app-builder-lib to new versions; dropped oniguruma-to-es, @pierre/diffs, tiptap blockquote (fixed upstream; regex-engine-feature-probes.test.ts still passes).
  • pnpm.overrides for vulnerable transitive exact pins: dompurify (monaco), undici + sharp (miniflare), undici (pi-coding-agent), joi/minimatch/yaml/ajv/nanoid/node-forge/tar (eas-cli), tinypool (oxfmt).
  • Code adaptations:
    • apps/connect/src/machine-label.ts: drizzle 0.45 wraps driver errors in DrizzleQueryError; label-collision detection now checks the cause chain (otherwise label assignment would throw on collisions instead of suffixing).
    • apps/server: hono 4.13 types param() as possibly undefined in websocket upgrade handlers; plugin and terminal websocket handlers return 404 when the id is missing.
    • apps/web/src/server-entry.ts: TanStack router removed stores.statusCode; marketplace 503 is now applied to the streamed response.
    • apps/connect/src/account-session.ts: use native Headers.getSetCookie() (workers-types 5).
    • packages/domain/src/pending-interactions.ts: zod 4.6.6+ aborts on array size bounds, so the resolution union no longer surfaced the nested message; a union error function keeps the specific message (e.g. "User question selected choices cannot exceed 4"). No wire change.
    • packages/plugin-build/src/toolchain.ts: esbuild pin 0.28.2.
    • Tests updated for upstream behavior changes (wrapped DB errors, hono client dropping empty ?, sugar-high adding Ruby, ProseMirror separator img, jsdom 29.1 overflow shorthand, miniflare requiring ratelimit namespace_id, version-pinned assertions).
  • Deliberately held: tailwind 4.3.0 (4.3.x changes selector shapes the plugin CSS scoper depends on), @pierre/diffs ~1.2.12 (1.6 API changes), remend 1.3.1 (incomplete-image output change), @tanstack/react-virtual 3.14.20, hugeicons icons ~4.3.4 (icon geometry changes), oxfmt 0.64 (0.76 reformats ~320 files).
  • Remaining advisories (11, moderate/low): @hono/node-server 1.x (serveStatic only; unused), tiptap 2.x in docs/tasks plugins (needs v3 migration), satori via cf-workers-og (PNG output), and build-tool transitives (glob, minimatch, uuid, deepmerge, esbuild via drizzle-kit, katex).

Follow-ups: mobile needs a new EAS build (native deps changed); redeploy apps/web promptly for the TanStack fix. Major upgrades (TS 7, vitest 5, electron 45, mermaid 12, tiptap 3, etc.) left for separate PRs.

How you verified

  • pnpm exec turbo run typecheck lint — 174/174.
  • pnpm exec turbo run test — 122/123; the only failure is @bb/scripts test/ci-bun.test.mjs, which fails identically on main (fa30b0a7dc) on the same machine.
  • Re-ran the npm bulk advisory check against the new lockfile: 0 critical/high.

AGENT GENERATED

Bring every dependency to its latest in-major release and fix all critical
and high npm advisories (TanStack Start XSS, handlebars, hono, drizzle-orm
SQL identifier escaping, undici, zod, MCP SDK, react-router, prosemirror-view,
dompurify, tar, sharp, node-forge and others).

- drizzle-orm 0.38 -> 0.45.4 (drizzle-kit 0.31), workers-types 5, eas-cli 27
- Port mermaid, better-auth api-key, hugeicons and app-builder-lib patches;
  drop oniguruma-to-es, @pierre/diffs and tiptap blockquote patches now fixed
  upstream
- Overrides for vulnerable transitive pins (miniflare, pi, monaco, eas-cli,
  oxfmt)
- Adapt code to drizzle error wrapping, hono param typing, TanStack Start
  status handling, workers-types getSetCookie and zod 4.6.7 union errors
- Hold tailwind 4.3.0, @pierre/diffs 1.2.x, remend, react-virtual and
  hugeicons icons where newer releases change output
toEqual on a 2 MiB Uint8Array exceeds the 5s test timeout in CI.
drizzle-orm 0.45 wraps driver errors, leaving the SQLite code only on
the cause. Project-source host conflicts and missing thread sections fell
through to 500s instead of 409/404.
Its bundled dependencies changed with the dependency update.
@SawyerHood
SawyerHood force-pushed the deps/security-updates branch from 5f02279 to 834e595 Compare November 5, 2026 18:55
The cross-process file-lock exclusion test failed on Windows with 1.5.3's
rebuilt prebuilds. The bump carries no security fix.
@SawyerHood
SawyerHood merged commit 6d5597d into main Nov 5, 2026
93 of 95 checks passed
@SawyerHood
SawyerHood deleted the deps/security-updates branch November 5, 2026 19:35
ymichael added a commit that referenced this pull request Nov 6, 2026
#7077)

## Human comments

## What was wrong

The Claude Code plugin's health and usage checks read Claude's login
themselves: `~/.claude/.credentials.json`, `~/.claude.json` and the
default `Claude Code-credentials` Keychain item. Usage then called
`api.anthropic.com/api/oauth/usage` with that token. When
`CLAUDE_CONFIG_DIR` is set, Claude Code signs in from a different
profile, so bb reported a different account than its sessions use. A
stale token in the default profile could show as `expired` for an
account that was signed in and working (#3607).

Fixing the paths would mean copying Claude Code's private rules for its
folder, Keychain name and account file. The installed 2.1.317 binary
showed several edge cases those rules miss: a legacy `.config.json`,
`CLAUDE_SECURESTORAGE_CONFIG_DIR`, relative paths and an empty variable.
Separately, fork resolved a relative `CLAUDE_CONFIG_DIR` against the
bridge process's directory instead of the session's cwd, which is where
Claude Code reads it.

## What changed

Everything is inside `plugins/provider-claude-code`. There is no daemon
protocol change, no plugin SDK change and no dependency change: main is
already on `@anthropic-ai/claude-agent-sdk` 0.3.318 (#7133).

- **`initialization-probe.ts`**: the probe that model and command
listing already use now has a second entry point, `probeClaudeUsage`. It
starts Claude Code with no prompt and sends the SDK usage request with
`skipBehaviors: true`, which skips Claude's scan of local transcripts.
- **Health** reads the account Claude Code reports at startup
(`initializationResult().account`). It is signed out only when Claude
reports `tokenSource: "none"` with no API key and a first-party
provider. The plan label comes from Claude's own plan name, for example
"Claude Ultra" → Ultra.
- **Usage** reads the limits Claude Code returns and keeps the existing
window normalization. It reports `unauthenticated` when Claude has no
usable login or plan limits don't apply, which matches today's result
for API-key logins.
- **Removed**: the Keychain and `.credentials.json` reads, the direct
`oauth/usage` call, and its `claude-code/2.1.0` User-Agent. This covers
the Claude rows of #6688's table.
- **Kept**: `accountKey` still reads the account UUID from the profile's
`.claude.json`, at `$CLAUDE_CONFIG_DIR` or `~` (Claude Code's rule).
Claude Code doesn't report the UUID anywhere else, and
`anthropic:account:<uuid>` has to match the Account Pooler's key so the
same account dedupes.
- **Fork**: `claudeConfigDirectory` resolves `CLAUDE_CONFIG_DIR` against
the session's cwd and treats an empty value as unset. Fork keeps this
local rule rather than asking `claude auth status`, because that would
break users who run only the SDK's bundled binary.

Behaviour changes:

- `expired` is no longer reported. Claude Code refreshes access tokens
itself, and the old check called a token expired once its timestamp
passed, even with a valid refresh token. A login Claude Code can't use
now shows as `unauthenticated`, and the sign-in action is the same.
- Health and usage each start a short Claude process: about 0.3 s for
health and 0.5 s for usage on this machine, against roughly 0.3 s for
the old direct fetch. The server already caches usage for 10 s.

## How you verified

- Live, on macOS with Claude Code 2.1.317, calling the real
`getClaudeProviderHealth` and `getClaudeProviderUsage`:

  | Profile | main | this PR |
  |---|---|---|
| default (signed in) | ready / ok, Ultra | ready / ok, Ultra, same
`accountKey` |
| `CLAUDE_CONFIG_DIR` = empty profile | — | unauthenticated /
unauthenticated |
| `CLAUDE_CONFIG_DIR` = profile with an invalid token | **ready / ok for
the default account** | unauthenticated / unauthenticated |

The last row is #3607's mismatch: main reports the default profile's
account while Claude Code itself has no usable login in that profile.
- New `provider-maintenance.account.test.ts`: usage reports the account
and plan Claude Code returns, and keys it from
`$CLAUDE_CONFIG_DIR/.claude.json`. Usage is signed out for a login
Claude can't use and for logins without plan limits. Health is ready or
signed out from the same account. It fails on main.
- New `claudeConfigDirectory` cases in `session-fork.test.ts`: a
relative path resolves against the session cwd, and unset or empty means
`~/.claude`.
- `pnpm exec turbo run typecheck
--filter=bb-plugin-provider-claude-code` passes, and oxlint is clean.
Targeted vitest (`provider-maintenance*`, `session-fork`, `model-list`,
`provider-commands`) passes 26 of 26. CI runs the full suites.

Fixes #3607
Part of #6688

🤖 Generated with [Claude Code](https://claude.com/claude-code)

> AGENT GENERATED

Co-authored-by: Claude Opus 5.5 <[email protected]>
ymichael added a commit that referenced this pull request Nov 9, 2026
…y installed version (#7312)

## Human comments

## What was wrong

When a source checkout updates itself in the app, the
`scripts/start-bb.mjs` process stays alive. Each update runs `pnpm
install` and then rebuilds in that same process. `buildRuntimeArtifacts`
found turbo with `require.resolve("turbo/bin/turbo")`. Node caches that
result, with symlinks already followed, for as long as the process runs,
and a fresh `createRequire` shares the same cache. So the process keeps
handing the build the `.pnpm/turbo@<version>` path it saw at startup,
even after updates move `node_modules/turbo` to a newer version.

For a while this does no harm. pnpm leaves the old version's folder on
disk, and the old `bin/turbo` script hands off to the repo's local
turbo, so builds still run the new version. pnpm deletes unused folders
only once `modules-cache-max-age` (7 days) has passed since its last
cleanup. When that cleanup runs during an update, the cached path points
at a deleted file and the rebuild fails:

```
Error: Cannot find module '/Users/michael/Projects/bb/node_modules/.pnpm/[email protected]/node_modules/turbo/bin/turbo'
✗  Rebuilding bb 0.49.0 (f8893ee) failed: Runtime build failed with exit code 1
```

In the reported case, one process had run several updates since before
#7133 (Nov 5) moved turbo from 2.10.12 to 2.11.10. The update that
failed (`55135d1e50 → f8893ee`) didn't change turbo. It was the
install where pnpm ran its cleanup (`node_modules/.modules.yaml` shows
`prunedAt: Mon, 09 Nov 2026 22:26:25 GMT`, the time of the failed
update).

## What changed

`scripts/start-bb.mjs` now passes
`<repoRoot>/node_modules/turbo/bin/turbo`, the symlink path, to the
build child process instead of resolving it in the long-lived process.
The child `node` follows the symlink when it starts, so each build runs
the turbo installed at that moment. turbo is a root devDependency, so
`node_modules/turbo` is always present at the root. The unused
`createRequire` import is removed.

## How you verified

Ran a real in-app update end to end, once with pre-fix code (control)
and once with this PR (fix). Each run used a scratch clone, a local bare
`origin`, its own data dir and ports, and `bb updates app apply --yes`:

- Commit A pins turbo to `2.10.12`, and `origin/main` is commit B, which
reverts that pin back to `^2.11.10`. Control is built on `7d57800665`;
fix is built on this PR's commit.
- After `pnpm install` at A, `prunedAt` in `node_modules/.modules.yaml`
was backdated 8 days, so pnpm's own cleanup runs during the update, as
it did in the reported case.
- **Control:** the shim logged `- turbo 2.10.12 / + turbo 2.11.10`, then
`Error: Cannot find module
'.../.pnpm/[email protected]/node_modules/turbo/bin/turbo'` and `✗
Rebuilding bb … failed: Runtime build failed with exit code 1`. That is
the reported failure.
- **Fix:** same steps. The rebuild ran `turbo 2.11.10`, bb came back up,
and `bb updates app status` reported `source checkout cd48a0e87b is up
to date`.
- Without the backdated `prunedAt`, the control also succeeds. A
`Module._findPath` trace showed the shim reusing the cached
`[email protected]` path on the second build; it worked because that folder
still existed.
- `pnpm start --dryrun` builds through the new path. `pnpm exec turbo
run test --filter=@bb/scripts -- test/start-bb.test.mjs` passes 4/4.

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>
ymichael added a commit that referenced this pull request Nov 18, 2026
## Human comments

## What was wrong

Boot JavaScript grew from 349.6 KB to 419.8 KB brotli between #6076
(dae54bd) and f1c5304, measured per module with the same build.
Most of the growth came from features, but the largest piece was a leak.
#6579 had the sidebar updates badge (`useUpdateInventory`) import
`pluginHasUpdateSurfaces` from `PluginUpdatesCard.tsx`. That one helper
put the plugin-management UI, the shared-ui resource list and
`@radix-ui/react-scroll-area` on boot: 19.7 KB brotli. A second leak
came with #6756: `thread-action-registry` imports `useBbNavigate` from
`plugin-navigation-hooks.ts`, which also defined the plugin-only
file-open hook, so the local open-target hooks loaded before first
paint.

While splitting dialogs I also found a bug in `vite-journey-chunks.ts`.
Vite adds `\0vite/preload-helper.js` to `importedIds` for any module
with a dynamic `import()`, with no matching import declaration in the
code. The counts disagreed, so `moduleEdges` fell back to following
every name of every import. Once `ThreadActionsProvider` gained a split,
that pulled the `@bb/client-core` and `@bb/thread-view` timeline code
into the plugin runtime chunk (PluginFrontend +18.5 KB, NewThreadPage
+15 KB).

Boot brotli growth, #6076 → f1c5304 (per-module attribution, brotli
share of each boot chunk):

| Commit / module cluster | Brotli bytes |
|---|---|
| #6579 Settings → Updates: plugin management UI, shared-ui resource
list, `@radix-ui/react-scroll-area` via `pluginHasUpdateSurfaces` |
+19,727 |
| #7133 dependency update: `react-dom` 19.2.4 → 19.3.1 (+ `react`,
`scheduler`) | +7,329 |
| #6002 keyed thread store: `query-tags` keyed store,
`thread-entity-store`, `thread-panel-queries` | +5,824 |
| #6013 / #6519 core tab and message-metadata registrations through the
plugin collector (`plugin-app-registration-collector`, validators) |
+5,249 |
| #7213 single update button: `@radix-ui/react-hover-card`, badge model
| +3,148 |
| #6756 open-target hooks via `plugin-navigation-hooks` | +2,381 |
| #6763 shared rename path: `inline-rename`, rename dialogs | +1,830 |
| #7176 setup-guide telemetry: `onboarding-model` | +1,733 |
| Radix version bumps (`react-collection` and others, excluding
scroll-area and hover-card) | +~3,900 |
| React Compiler memo caches (Nov 15 budget entry) and other
app/shared-ui feature growth | remainder (~19,000) |
| **Total** | **+70,214** |

Shared packages: `@bb/shared-ui` +15.3 KB (mostly the resource list
above), `@get-bb/plugin-sdk` +5.2 KB (the collector),
`@bb/server-contract` +2.0 KB, `@bb/sdk` +1.2 KB, `@bb/domain` +0.1 KB.
Zod was already on boot at #6076 and is unchanged.

## What changed

- `pluginHasUpdateSurfaces` moved from `PluginUpdatesCard.tsx` to
`plugin-status.ts`. The plugin-management UI now loads with Settings and
Tools (−19.7 KB).
- `usePluginCanOpenFileExternally` moved from
`plugin-navigation-hooks.ts` to a new `plugin-file-open-hooks.ts`, still
re-exported by `plugin-sdk-hooks.ts`. The open-target hooks now load
with the thread and compose pages, which already use them (−2.4 KB).
- An earlier version also set `treeshake.manualPureFunctions: ["z"]` to
drop unused zod schemas (−3.6 KB). It is removed. Rolldown matches that
name in every module, minified dependencies included, and also inside
function bodies. In the built app it deleted sonner's
`setSwiping(true)`/`setSwiping(false)` calls (toasts no longer follow a
swipe on touch screens), cmdk's result-sort call, and two `push` calls
in d3-scale's log ticks.
- The project path, project rename and delete, and thread delete and
archive dialogs load behind `defineSplit` preload-tier wrappers that
mount when opened and stay mounted, following `ApplicationUrlDialog`
(−3.1 KB). Nothing in them is visible at first paint.
- `vite-journey-chunks.ts` ignores the preload helper id. The regression
test fails before the fix and passes after.
- `bundle-budget.json`: `splitBoundaries` boot guards for
`PluginUpdatesCard`, `UpdatePluginDialog`, `useLocalOpenTargets` and the
five dialogs. `@radix-ui/react-scroll-area` is added to
`forbiddenBootPackages`, plus a dated `$comment` entry. Against main's
build, the new budget reports all nine guards.
- Limits are unchanged. Boot now measures 402,655 bytes against 429,151,
which is 6.2% headroom. 10% over the new measurement (442,921) would be
a raise, so lowering the limit would leave less than 10%.

Not reached: 10% headroom needs about 12.3 KB more. The remaining boot
code that isn't first-paint UI is small and spread out. The
command-palette placeholder is kept on boot deliberately so Cmd+K opens
instantly. The updates hover-card body is ~2 KB and splitting it would
risk an empty card on an early hover. The plugin collector (5.2 KB) is
how core registers its own Info tab and message time, per the rule that
core uses the plugin API path. Each of these would cost something
visible or break that rule.

## How you verified

Bundle sizes from real builds of main (3678415, same sizes as
f1c5304) and this branch rebased on main (`.br` files, as
`check-bundle-budget.mjs` counts them):

| Closure | main raw / brotli | branch raw / brotli | brotli Δ |
|---|---|---|---|
| boot | 1,717,479 / 428,928 | 1,597,774 / 402,655 | −26,273 (−6.1%) |
| ThreadPage | 1,909,102 / 504,492 | 1,918,632 / 506,727 | +2,235 |
| NewThreadPage | 1,007,979 / 270,590 | 1,025,094 / 274,769 | +4,179 |
| PluginFrontend | 832,313 / 220,554 | 846,772 / 223,750 | +3,196 |
| boot + ThreadPage | 933,420 | 909,382 | −24,038 |
| boot + NewThreadPage | 699,518 | 677,424 | −22,094 |
| boot + PluginFrontend | 649,482 | 626,405 | −23,077 |

Journey growth is the open-target hooks (~3.9 KB) that those pages use,
plus small dialog dependencies.

First content on a real server (measured with the earlier version that
still had the `z` hint, so about 3.6 KB more JS was removed than now):
one `pnpm start:worktree` server with real data (a real agent thread
plus fixtures). Main's and this branch's builds were served by swapping
`index.html` in `apps/app/dist`, so server and data were identical. Each
run used headless Chrome on a fresh navigation with the HTTP cache
cleared and disabled, 4× CPU throttle, 1.6 Mbps / 150 ms RTT. Median of
6 alternating runs; ranges did not overlap for any metric:

| Page | Metric | main | branch | Δ |
|---|---|---|---|---|
| New thread `/` | FCP | 3,594 ms | 3,430 ms | −164 |
| | composer painted | 6,862 ms | 6,731 ms | −131 |
| Thread `/threads/<id>` | FCP | 3,606 ms | 3,432 ms | −174 |
| | timeline painted | 8,942 ms | 8,756 ms | −187 |
| Plugin page `/plugins/automations/automations` | FCP | 3,572 ms |
3,422 ms | −150 |
| | content painted | 7,496 ms | 7,353 ms | −144 |
| | JS downloaded before content (new / thread / plugin) | 745,687 /
979,589 / 732,738 B | 719,291 / 951,279 / 706,155 B | −26.4 / −28.3 /
−26.6 KB |

Manual checks on the branch build:
- Cold load, sidebar and composer: no console errors.
- Updates badge hover card: lists the provider CLI updates.
- Thread page renders its timeline.
- New thread submitted from the composer.
- Thread delete dialog: confirmed, thread deleted.
- Archive on a parent with a child: dialog shows the child count; both
threads archived.
- "New project" path-entry fallback dialog: path submitted, project
created.
- Settings → Updates and the Plugins page render.
- Project rename and delete dialogs opened through the real
`ProjectActionsProvider` in a throwaway test, because their only menu
sits in a header that the current routes don't render.
- A 409 on `GET /threads/<new>/thread-storage/location` right after
submit also happens on main.

Commands:
- `pnpm exec turbo run typecheck lint --filter=@bb/app`
- `pnpm exec turbo run test --filter=@bb/app -- <63 related test
files>`: 63 passed
- `src/vite-journey-chunks.test.ts`: fails before the fix, passes after
- `node scripts/check-bundle-budget.mjs`: OK
- `oxfmt --check`
- Rebased on main (includes #7736); `pnpm exec turbo run build typecheck
lint --filter=@bb/app` and `check-bundle-budget.mjs` pass, and the 40
app test files that touch the changed providers, dialogs, layout and
hooks pass on the merge.
- The built sonner and cmdk code again contains the swipe setter and
sort calls that the `z` hint had removed.

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
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