zod < 4.6.6 can exhaust memory validating oversized constrained collections
(GHSA-mrhx-c7xc-m3w5, high); there is no 3.x fix. @claude-flow/shared is the
most-installed zod 3 holdout (~286k downloads/month, a dependency of the cli,
hooks, claims, guidance, testing, deployment and the iot/federation plugins).
- config validator: ZodError.errors -> .issues; foreign ZodErrors are
recognised by shape; z.ZodType<Out, In> (port from #4535 by Dragan
Spiridonov)
- schema: one-argument z.record(value) -> z.record(z.string(), value)
- express ^4.22.2 || ^5.0.0 -> ^4.22.3 || ^5.1.0: 4.22.2 and 5.0.0-5.0.1
are inside GHSA-qw6h-vgh9-j6wx
- advisory-ranges test over the manifest (zod, express, ws)
- ADR-356 metadata (homepage, repository with directory, bugs, keywords) and
a README quickstart verified against a packed tarball, with a flow SVG
shared is a registry-resolved leaf of @claude-flow/cli, so this PR also needs
the cli pin ("@claude-flow/shared": "3.0.8") and the claude-flow root pin from
the release lane, after 3.0.8 is on the registry.
Co-authored-by: Dragan Spiridonov <spiridonovdragan@gmail.com>
Co-Authored-By: claude-flow <ruv@ruv.net>
* fix(shared): MCP transports refuse web pages, rebound hosts and open non-loopback binds; ws token checked at upgrade
Same guard as @claude-flow/mcp 3.1.3 for the copies in @claude-flow/shared.
Co-Authored-By: RuFlo <ruv@ruv.net>
* chore(shared): 3.0.6
Co-Authored-By: RuFlo <ruv@ruv.net>
* chore: package-lock follows @claude-flow/shared 3.0.6
Co-Authored-By: RuFlo <ruv@ruv.net>
---------
Co-authored-by: r <r@x>
@claude-flow/shared 3.0.1-3.0.3 declare only sql.js, but the compiled code
imports zod (core/config) and express, cors, helmet and ws (mcp transports).
They sat in devDependencies, so a clean `npm i @claude-flow/shared` cannot load
`.` or `./core` (Cannot find package 'zod') or `./mcp` (Cannot find package
'express'). ruflo users never saw it because @claude-flow/cli declares the same
packages and npm hoists them.
- Move zod, express, cors, helmet and ws to dependencies, with ranges that
overlap what @claude-flow/cli declares so a CLI install can dedupe them.
express is bounded to `^4.22.2 || ^5.0.0` (the patched 4.x floor the repo
overrides to, and the 5.x the workspace runs) instead of an open `>=`.
- Move @types/ws to dependencies: dist/mcp/transport/websocket.d.ts imports
`ws`, so a consumer type-checking with skipLibCheck off hit TS7016.
- Exclude *.test.ts / *.spec.ts / __tests__ from the build, and negate them in
`files` so a stale local dist (composite builds do not clear old outputs)
cannot ship them either. 3.0.3 ships 6 compiled tests that import vitest.
- HttpTransport: read `req.body ?? {}`. Under Express 5 a POST /rpc with no JSON
body left req.body undefined and answered 500 instead of the JSON-RPC 400.
Malformed JSON (body-parser's entity.parse.failed) now answers 400 / -32700
Parse error instead of 500 / -32603 Internal error, under Express 4 and 5.
- Lockfile: only the shared importer block moves; ws 8.19.0 was referenced by
nothing else and is dropped. `pnpm@8.15.0 install --frozen-lockfile` passes.
- Tests: __tests__/package-manifest.test.ts scans src/ with the TypeScript
AST (type-only imports erased, comments/strings ignored) and fails on an
undeclared runtime import, a missing @types/ws, or removed test exclusions;
__tests__/mcp/http-transport-body.test.ts (transport bound to port 0) covers
the bodiless POST and malformed JSON. Every mutant (zod, express, @types/ws,
spec negation, tsconfig exclude, each HTTP fix reverted) is caught.
Verified: npm pack + clean `npm i <tgz>` imports all 9 exports subpaths
(origin/main and registry 3.0.3 fail on 3 of them) and ships no test files;
HTTP /health 200 and a WebSocket connect work under express 5.3.0 and 4.22.3;
a consumer tsc with skipLibCheck off reports 0 errors; shared tests pass; the
CI recursive build and the CLI type-check pass.
Not included: the version bump and the CLI's exact `@claude-flow/shared`
pin, which belong to the release.