Skip to content

Bump pi-coding-agent to 0.81.0 to resolve brace-expansion DoS alert #288 - #4327

Merged
wojtekn merged 1 commit into
trunkfrom
fix-brace-expansion-dos-alert-288
Jul 27, 2026
Merged

Bump pi-coding-agent to 0.81.0 to resolve brace-expansion DoS alert #288#4327
wojtekn merged 1 commit into
trunkfrom
fix-brace-expansion-dos-alert-288

Conversation

@wojtekn

@wojtekn wojtekn commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Related issues

How AI was used in this PR

Claude Code investigated the alert, determined the only viable remediation path, performed the @earendil-works/pi-coding-agent API migration in the CLI pi runtime, and updated the affected tests. All changes were reviewed by the author.

Proposed Changes

Dependabot alert #288 is a high-severity DoS in brace-expansion (exponential-time brace expansion, CVE-2026-13149), which reaches Studio transitively through @earendil-works/pi-coding-agent.

The fix isn't a plain version bump. Findings while scoping it:

  • Every 0.80.x release of pi-coding-agent — including the latest 0.80.10 — bundles the vulnerable brace-expansion@5.0.6 in its shrinkwrap. Only 0.81.0+ ships the patched 5.0.7.
  • An npm overrides entry (scoped or global) can't fix it either: pi-coding-agent declares hasShrinkwrap, so npm treats its whole dependency subtree as sealed and parent overrides don't penetrate it (verified empirically).
  • pi-coding-agent is declared in three places (apps/cli, apps/studio, packages/common); all must move in lockstep, otherwise the hoisted 0.80.x copy keeps the vulnerable transitive dependency and the alert stays open.

So this bumps all three declarations (plus the pi-* siblings in apps/cli) to 0.81.0, which deduplicates to a single copy carrying patched brace-expansion@5.0.7.

0.81.0 also has breaking API changes. apps/studio and packages/common only import types and are unaffected, but the CLI pi runtime uses the runtime API, so it's migrated: createAgentSession now takes a modelRuntime (a ModelRuntime) instead of the removed authStorage / modelRegistry options. The runtime is built over an in-memory CredentialStore so no auth.json is read or written, preserving the previous in-memory-only behavior. No user-visible behavior change — the AI assistant authenticates and runs exactly as before.

Testing Instructions

  • npm run typecheck — passes across all workspaces.
  • npm test -- apps/cli/ai/tests/pi-runtime.test.ts — 10/10 pass; the WPCOM Anthropic/OpenAI provider and token-escaping auth-resolution tests were updated to the new modelRuntime API and still assert the same credential resolution.
  • npm test -- apps/cli/ai packages/common/ai — 306/306 pass.
  • npm run cli:build succeeds; node apps/cli/dist/cli/main.mjs --version runs.
  • After merge, confirm Dependabot alert Release 1.0.5-beta1 #288 auto-closes.

Manual smoke test worth doing: run an AI assistant turn against both a WordPress.com (bearer-token proxy) provider and a direct API-key provider to confirm authentication still resolves.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?


Upgrade @earendil-works/pi-coding-agent (and the pi-* siblings in apps/cli)
from 0.80.3 to 0.81.0 across all three declarations so the bundled
brace-expansion is the patched 5.0.7. 0.80.x ships the vulnerable 5.0.6 in
its shrinkwrap, and because the package declares hasShrinkwrap, npm overrides
cannot reach into that sealed subtree — only a 0.81.0+ bump fixes it.

Migrate the CLI pi runtime to the 0.81.0 API: createAgentSession now takes a
modelRuntime instead of authStorage/modelRegistry. Build a ModelRuntime backed
by an in-memory CredentialStore so no auth.json is read or written, preserving
the previous in-memory behavior.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@wojtekn
wojtekn requested review from a team and youknowriad July 24, 2026 10:23
@wpmobilebot

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing 73d2072 vs trunk

app-size

Metric trunk 73d2072 Diff Change
App Size (Mac) 1377.60 MB 1374.75 MB 2.85 MB 🟢 -0.2%

site-editor

Metric trunk 73d2072 Diff Change
load 1078 ms 1071 ms 7 ms ⚪ 0.0%

site-startup

Metric trunk 73d2072 Diff Change
siteCreation 7013 ms 7028 ms +15 ms ⚪ 0.0%
siteStartup 2347 ms 2345 ms 2 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@sejas sejas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Studio Code CLI works as expected. I couldn't test the desktop app as currently is not starting for me. The error doesn't seem related to this PR. I dropped the error I got in #4319 (comment)

@wojtekn
wojtekn merged commit d5da9c9 into trunk Jul 27, 2026
14 checks passed
@wojtekn
wojtekn deleted the fix-brace-expansion-dos-alert-288 branch July 27, 2026 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants