Skip to content

fix(ai-code-mode): warn when tool parameters look like secrets#431

Open
AlemTuzlak wants to merge 3 commits intomainfrom
fix/code-mode-secret-warning
Open

fix(ai-code-mode): warn when tool parameters look like secrets#431
AlemTuzlak wants to merge 3 commits intomainfrom
fix/code-mode-secret-warning

Conversation

@AlemTuzlak
Copy link
Copy Markdown
Contributor

Summary

  • Add warnIfBindingsExposeSecrets() that scans tool input schemas for secret-like parameter names (apiKey, token, password, credential, secret, access_key, private_key, auth_token) and emits console.warn during development
  • Code Mode executes LLM-generated code in a sandbox — if a tool's input schema includes parameters that carry secrets, the generated code can access those values and potentially exfiltrate them via tool calls
  • This is a best-effort heuristic warning, not a security boundary — it catches the most common antipattern of passing API keys as tool parameters instead of keeping them in server-side implementations

Test plan

  • 5 test cases covering: secret detection, safe parameter names, multiple patterns, missing inputSchema, api_key/api-key variations
  • All 26 @tanstack/ai-code-mode tests pass

Code Mode executes LLM-generated code in a sandbox. If a tool's input
schema includes parameters like apiKey, token, or password, the
LLM-generated code can access those values and potentially exfiltrate
them via tool calls.

Add warnIfBindingsExposeSecrets() that scans tool input schemas for
secret-like parameter names and emits console.warn during development.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 8, 2026

Warning

Rate limit exceeded

@AlemTuzlak has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 5 minutes and 2 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 5 minutes and 2 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4fb29553-c397-4fc3-9628-7ec7084cf4ac

📥 Commits

Reviewing files that changed from the base of the PR and between 4afaa76 and 7a12c6d.

📒 Files selected for processing (4)
  • .changeset/fix-code-mode-secret-warning.md
  • packages/typescript/ai-code-mode/src/create-code-mode-tool.ts
  • packages/typescript/ai-code-mode/src/validate-bindings.ts
  • packages/typescript/ai-code-mode/tests/validate-bindings.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/code-mode-secret-warning

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 and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

🚀 Changeset Version Preview

1 package(s) bumped directly, 5 bumped as dependents.

🟩 Patch bumps

Package Version Reason
@tanstack/ai-code-mode 0.1.0 → 0.1.1 Changeset
@tanstack/ai-code-mode-models-eval 0.0.1 → 0.0.2 Dependent
@tanstack/ai-code-mode-skills 0.1.0 → 0.1.1 Dependent
@tanstack/ai-isolate-cloudflare 0.1.0 → 0.1.1 Dependent
@tanstack/ai-isolate-node 0.1.0 → 0.1.1 Dependent
@tanstack/ai-isolate-quickjs 0.1.0 → 0.1.1 Dependent

@nx-cloud
Copy link
Copy Markdown

nx-cloud bot commented Apr 8, 2026

View your CI Pipeline Execution ↗ for commit 7a12c6d

Command Status Duration Result
nx affected --targets=test:sherif,test:knip,tes... ✅ Succeeded 7s View ↗
nx run-many --targets=build --exclude=examples/** ✅ Succeeded 2s View ↗

☁️ Nx Cloud last updated this comment at 2026-04-08 11:43:10 UTC

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 8, 2026

Open in StackBlitz

@tanstack/ai

npm i https://pkg.pr.new/@tanstack/ai@431

@tanstack/ai-anthropic

npm i https://pkg.pr.new/@tanstack/ai-anthropic@431

@tanstack/ai-client

npm i https://pkg.pr.new/@tanstack/ai-client@431

@tanstack/ai-code-mode

npm i https://pkg.pr.new/@tanstack/ai-code-mode@431

@tanstack/ai-code-mode-skills

npm i https://pkg.pr.new/@tanstack/ai-code-mode-skills@431

@tanstack/ai-devtools-core

npm i https://pkg.pr.new/@tanstack/ai-devtools-core@431

@tanstack/ai-elevenlabs

npm i https://pkg.pr.new/@tanstack/ai-elevenlabs@431

@tanstack/ai-event-client

npm i https://pkg.pr.new/@tanstack/ai-event-client@431

@tanstack/ai-fal

npm i https://pkg.pr.new/@tanstack/ai-fal@431

@tanstack/ai-gemini

npm i https://pkg.pr.new/@tanstack/ai-gemini@431

@tanstack/ai-grok

npm i https://pkg.pr.new/@tanstack/ai-grok@431

@tanstack/ai-groq

npm i https://pkg.pr.new/@tanstack/ai-groq@431

@tanstack/ai-isolate-cloudflare

npm i https://pkg.pr.new/@tanstack/ai-isolate-cloudflare@431

@tanstack/ai-isolate-node

npm i https://pkg.pr.new/@tanstack/ai-isolate-node@431

@tanstack/ai-isolate-quickjs

npm i https://pkg.pr.new/@tanstack/ai-isolate-quickjs@431

@tanstack/ai-ollama

npm i https://pkg.pr.new/@tanstack/ai-ollama@431

@tanstack/ai-openai

npm i https://pkg.pr.new/@tanstack/ai-openai@431

@tanstack/ai-openrouter

npm i https://pkg.pr.new/@tanstack/ai-openrouter@431

@tanstack/ai-preact

npm i https://pkg.pr.new/@tanstack/ai-preact@431

@tanstack/ai-react

npm i https://pkg.pr.new/@tanstack/ai-react@431

@tanstack/ai-react-ui

npm i https://pkg.pr.new/@tanstack/ai-react-ui@431

@tanstack/ai-solid

npm i https://pkg.pr.new/@tanstack/ai-solid@431

@tanstack/ai-solid-ui

npm i https://pkg.pr.new/@tanstack/ai-solid-ui@431

@tanstack/ai-svelte

npm i https://pkg.pr.new/@tanstack/ai-svelte@431

@tanstack/ai-vue

npm i https://pkg.pr.new/@tanstack/ai-vue@431

@tanstack/ai-vue-ui

npm i https://pkg.pr.new/@tanstack/ai-vue-ui@431

@tanstack/preact-ai-devtools

npm i https://pkg.pr.new/@tanstack/preact-ai-devtools@431

@tanstack/react-ai-devtools

npm i https://pkg.pr.new/@tanstack/react-ai-devtools@431

@tanstack/solid-ai-devtools

npm i https://pkg.pr.new/@tanstack/solid-ai-devtools@431

commit: 7a12c6d

@AlemTuzlak AlemTuzlak requested a review from jherr April 8, 2026 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant