Skip to content

[WRONG BRANCH] fix(anthropic): validate upstream tool names - #214

Draft
luvs01 wants to merge 1 commit into
mainfrom
codex/fix-vulnerability-in-umans-provider
Draft

[WRONG BRANCH] fix(anthropic): validate upstream tool names#214
luvs01 wants to merge 1 commit into
mainfrom
codex/fix-vulnerability-in-umans-provider

Conversation

@luvs01

@luvs01 luvs01 commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Prevent crashes when an Anthropic-compatible provider returns a malformed tool_use.name (non-string) while escapeBuiltinToolNames is enabled, which previously caused name.startsWith(...) TypeErrors and failed requests.

Description

  • Hardened the Anthropic adapter to treat upstream content_block.name / content[].name as untrusted by changing their local typing to unknown and only invoking toolNames.fromWire(...) when the name is a string in both streaming and non-streaming paths (src/adapters/anthropic.ts).
  • When a non-string name is observed the code now passes an empty string to the compatibility transform so that malformed values degrade safely instead of throwing.
  • Added focused regression tests that exercise a provider-returned object-valued tool_use.name for both streaming and non-streaming parsing with escapeBuiltinToolNames enabled (tests/anthropic-stream-hardening.test.ts).

Testing

  • Ran bun test tests/anthropic-stream-hardening.test.ts and the file's 20 tests passed (20 passed, 0 failed).
  • Ran bun run typecheck and bun run privacy:scan, both completed successfully in this environment.
  • Attempted a full bun run test but unrelated integration tests timed out in this environment, so the full-suite run was not green here (failures/timeouts were unrelated to the Anthropic changes).

Codex Task

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@luvs01, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 53 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: e14ad006-2777-4dc1-87d0-242ef73b4c05

📥 Commits

Reviewing files that changed from the base of the PR and between 121f1ad and 786a4f4.

📒 Files selected for processing (2)
  • src/adapters/anthropic.ts
  • tests/anthropic-stream-hardening.test.ts

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the bug Something isn't working label Aug 9, 2026
@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown

Deterministic PR hygiene checks passed.

@github-actions github-actions Bot changed the title fix(anthropic): validate upstream tool names [WRONG BRANCH] fix(anthropic): validate upstream tool names Aug 9, 2026
@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown

⏳ DRAFT

  • wrong target branch (main); retarget to dev.

What to do

  • Retarget this PR to dev — all contributions go to dev.

Its title has been prefixed with [WRONG BRANCH].
This pull request was already a draft. Its draft status will be preserved after every issue above is resolved.

@github-actions
github-actions Bot marked this pull request as draft August 9, 2026 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aardvark bug Something isn't working codex

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant