Skip to content

[WRONG BRANCH] fix(xai): constrain hosted search tool names - #334

Draft
luvs01 wants to merge 1 commit into
mainfrom
codex/propose-fix-for-xai-x_search-vulnerability
Draft

[WRONG BRANCH] fix(xai): constrain hosted search tool names#334
luvs01 wants to merge 1 commit into
mainfrom
codex/propose-fix-for-xai-x_search-vulnerability

Conversation

@luvs01

@luvs01 luvs01 commented Aug 26, 2026

Copy link
Copy Markdown
Owner

Motivation

  • A provider-executed exemption for xAI x_search previously authorized any custom_tool_call whose call_id started with xs_call- (plus the declaration/destination checks), which allowed a malicious upstream to present an undeclared client tool name (for example apply_patch) and bypass the undeclared-tool guard.

Description

  • Add a names field to ProviderExecutedCallType and populate the PROVIDER_EXECUTED_DECLARATION_CALL_TYPES entry for x_search with the measured hosted names x_keyword_search, x_semantic_search, and x_user_search.
  • Tighten isAuthorizedProviderExecutedCall to require item.name and to check that the returned name is one of the measured names in addition to matching item.type and call_id prefix.
  • Update the undeclared-tool guard test coverage so hosted x_search names remain accepted while an apply_patch with a spoofed xs_call-... id is still refused; adjust the relevant test vectors and expectations accordingly.

Testing

  • node_modules/bun/bin/bun.exe test tests/responses-undeclared-tool-guard.test.ts — unit file passed (64 tests, 0 failures).
  • bun run typecheck — typecheck completed successfully.
  • bun run privacy:scan — privacy scan passed.
  • ⚠️ bun run test — full repo test run was not completed to green due to unrelated environment/baseline failures and a Bun runtime mismatch in this environment (an older Bun lacked node:zlib.zstdDecompressSync); the focused unit test for the changed subsystem and typecheck/privacy checks above succeeded using the repository's Bun where applicable.

Codex Task

@github-actions

Copy link
Copy Markdown

Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Aug 26, 2026
@github-actions github-actions Bot changed the title fix(xai): constrain hosted search tool names [WRONG BRANCH] fix(xai): constrain hosted search tool names Aug 26, 2026
@github-actions

github-actions Bot commented Aug 26, 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 26, 2026 02:21
@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

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