Repository navigation
fix(security): zod 4 in api-types, sdk and langchain; GHSA-mrhx exception withdrawn (#214) - #249
Merged
Merged
Conversation
…xception is withdrawn (core#214) zod up to 4.6.5, and every 3.x, can exhaust memory while validating an oversized array (GHSA-mrhx-c7xc-m3w5). api-types and the SDK depend on zod ^4.6.6; langchain keeps its classic zod/v3 import, which zod 4 ships, and its own tests read the same entry. The lockfile resolves one zod, 4.6.7. The audit exception for the advisory is removed, so the gate passes on the fix and not on an accepted risk. api-types 0.6.0 (a minor: its schemas are zod 4 now) and sdk 0.16.30. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…seed, Shop awaiting reasons) Regenerated by npm run sdk:spec:refresh; sdk:spec:check exits 0 against the served document. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
….6.0 The publish drift guard: langchain's packed content moved (dev dependency), so its version moves; the api-types 0.5.0 waiver no longer matches a package at 0.6.0, which also publishes two_header (#72, core#132). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fabianocruz
added a commit
that referenced
this pull request
Nov 19, 2026
…alls in the SDKs, the CLI and the MCP package (#244) Shop data calls in the SDKs, the CLI and the MCP package. A data call is a per-call data service found by a research of `task_kind: "data_service"`. An API key drafts one from an offer and reads it. It never runs one: running it is the person's authorization. While the call waits for the person, the API answers `next_action`, a link to the call's card on the dashboard behind the person's own sign-in. ## Status (2026-11-17) - Merged with main at 3373434 (zod 4, #249). No code here uses zod, so the zod 4 move needed no source change. - **Blocked by a technical dependency, not by G1:** codespar-enterprise #2520 has to be deployed first. The client calls routes that only #2520 serves: - `POST /v1/shop/agent/data-calls` (`agent_id`, `offer_id`, `idempotency_key`; answers `data_call`, `next_action` and `idempotent_replay`); - `GET /v1/shop/agent/data-calls/{id}` (`data_call`, `next_action`); - `POST /v1/shop/agent/data-calls/{id}/execute` (always 403 `person_required`, with `error.details.next_action`); - on `POST /v1/shop/agent/research`, `task_kind: "data_service"`, the `data` source and `criteria.data_service { params, sku? }`. - `spec-freshness` is red until then, and it says exactly that: the served document lacks those three operations and the research change. Nothing else differs. It is not a required check; `ci` is green. - The OpenAPI snapshot is the document served on 2026-11-17 (390 operations, G1 included) plus those four entries, taken from #2520 at 3bcd53dcb (`buildOpenApiSpec`). `src/generated/` is regenerated from it (393 operations). - Versions are past what npm and main hold: `@codespar/sdk` 0.16.31, `@codespar/cli` 0.22.8 (SDK floor ^0.16.31), `@codespar/mcp` 0.5.21, `@codespar/types` 0.11.8. The Python changelog stays "Unreleased" (`codespar` 0.16.2 on PyPI). **Nothing is published here.** Publishing happens after merge and after #2520 is deployed, with `spec:check` green against the served document. ## What changes - **TypeScript:** - `cs.dataCalls` and `session.dataCalls`: `create`, `get` (`{ data_call, next_action }`) and `execute`. A key's `execute` throws `DataCallNeedsPersonError` with `nextAction`. - `dataCallOutcome(view)` turns the four states into one word. - `session.research.create` takes `taskKind` and `criteria.dataService`. - The types live in `@codespar/types`. - **Python:** `cs.research` and `cs.data_calls` (async and sync), with `data_call_outcome` and `next_action_of`. - **CLI:** - Derived commands `shop create-data-calls`, `shop get-data-calls` and `shop data-calls-execute`. - These commands exit with the outcome: 0 confirmed, 10 pending, 20 refused, 30 failure, 40 uncertain. - A key's execute prints the person's link and exits 10. - Every other command keeps exit 1. - **MCP package:** `codespar_shop_data_call_draft`, `codespar_shop_data_call_request_authorization` (answers the person's link) and `codespar_shop_data_call_status`. No tool runs a call. - **OpenAPI snapshot:** the three data-call operations and the research body. ## Tests - Remote CI on 0a31927: `ci` green (build, typecheck, lint, the unit suites, audit gate), plus gitleaks, kit-templates and the example validations. - Earlier head: core 261, cli 359, mcp 52, types 178, python 173; ruff, mypy, and turbo typecheck and lint. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #214.
Migrates the repo to zod 4 for GHSA-mrhx-c7xc-m3w5: zod up to 4.6.5, and every 3.x, can exhaust memory while validating an oversized array. The audit exception that expires on 16/11 (UTC) is removed in this PR, so the Security audit passes because of the fix, not because of an accepted risk.
What changes
zod ^4.6.6. The schemas keep their shapes and inferred types. It is a minor because the schemas are now zod 4: whoever composes them with zod 3, or passes them to zod 3 tooling, opts in when moving to 0.6.0 (^0.5.0does not pick it up).zod ^4.6.6.SessionConfigSchemakeeps the same shape and the sameSessionConfigtype. The three single-argumentz.record(value)calls becamez.record(z.string(), value), the form zod 4 requires; what validates is the same.zod/v3, which zod 4 ships, and its peer stays>=3.25.0. Only the dev dependency goes to^4.6.6. Its test now imports fromzod/v3too, the same entry asschema.ts, soinstanceof z.ZodEffectscompares the same class. The bound on model input from fix(langchain): bound a tool call's input before Zod validates it #245 stays.ai,@ai-sdk/*,@modelcontextprotocol/sdk,zod-to-json-schema) already accept^4.scripts/audit-exceptions.json:exceptions: [].usdc_accounts[].seedand the Shop'sawaiting.reasonwithidentity_required/consent_required. That was whyspec-freshnessfailed, independent of zod.two_header(feat(sdk): session.ledger() + session.issue() wrappers + two_header api-type #72, core#132).Consumers (enterprise and web, on main)
ServerRowSchema,AuthSchemaFieldSchemaandProjectIdSchemafrom api-types intoopenapi.ts, so moving to 0.6.0 requires its OpenAPI generator on zod 4. Pinned to 0.4.0, it changes nothing until it opts in. It does not useSessionConfigSchema.SessionConfigSchemaappears only in the documentation (content/docs/api/sdk/client.mdx), not in code.Checks
node scripts/audit-gate.mjs: exit 0 with no exception (only moderates reported).audit-gate.test.mjs: 9/9.heavywas holding back because of memory pressure.Publishing (tag) is not part of this PR.
🤖 Generated with Claude Code