Repository navigation
feat(chat): never send a message that holds an API key, and offer to take the key out (W4-05) - #2020
Merged
Merged
Conversation
…take the key out (W4-05) The composer finds a pasted key by its provider's shape (sk-ant-, sk-or-v1-, sk-proj-, sk-, AIza): Send waits, a line says why, and Remove takes the key out of the text. Save securely shows only where the page offers a key form. The run routes refuse such a message or typed answer with api_key before anything keeps it, and never log it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merged
8 of 13 tasks
gkhngyk
previously approved these changes
Nov 2, 2026
Contributor
|
Approved. Small notes:
|
8 of 13 tasks
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…PI key section Co-Authored-By: Claude Opus 5.5 <[email protected]>
gkhngyk
previously approved these changes
Nov 3, 2026
# Conflicts: # help/chat/chat.md
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.
Summary
A message that holds an API key is never sent to Chat (CHAT-16, Wave 4 plan W4-05). A pasted key would otherwise reach the model, the chat's history and the run's records.
sk-ant-…,sk-or-v1-…,sk-proj-…,sk-…,AIza…) shows one line under the box: "This looks like an API key. Save it securely instead of sending it?". Send and Enter wait, steering too.onSaveKey. That is W4-06's key form (Enterprise, Admins), so for now only Remove shows.POST /api/chat/runs(message) andPOST /api/chat/runs/{id}/answer(other) refuse such text with400 api_keybefore the engine sees it. The text is never logged.sk-learn,/sk-guide-to-ai-search-in-2026): a plainsk-key needs 20+ characters with a digit and a capital letter, and OpenRouter's is hex.help/chat/chat.md(approved: false).Behind
CHAT_AGENTIClike the rest of Chat; no migration.Related issue
None. Chat Wave 4 plan, W4-05.
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
sk-proj-followed by 40 random letters and digits after some text.curlthe route with a key inmessage(signed in):400withcode: "api_key".cd web && yarn vitest run src/lib/chat/key-paste.test.ts src/app/api/chat/runs src/components/chat/composer.Screenshot (light and dark, 1024 px): composer with the pasted-key line.
No new environment variables. No migration.
Checklist
yarn lintpassesyarn typecheckpassesyarn format:checkpasseshelp/(or no user-visible change)Screens: shown to the owner in a local preview (1024px, light and dark) and approved on 2026-11-02.
CI passed on this branch (82e66f8), run on the fork (https://github.com/cihan-gyk/ansvisor/actions/runs/41489993261): schema is up to date; web
format:check, lint, typecheck, all tests andyarn buildpass; server lint,format:checkand all tests pass.🤖 Generated with Claude Code