Fix/2164#331
Open
conradmugabe wants to merge 6 commits into
Open
Conversation
Introduce sanitizePromptParam() to defend the ?prompt= deep-link query param against prompt-injection smuggling and oversized payloads. It strips control characters (preserving \n and \t), zero-width/invisible characters, and the Unicode Tag block, trims, and caps length at a new MAX_PROMPT_PARAM_LENGTH (4000). HTML is intentionally NOT escaped: the chat render layer already auto-escapes user turns, so escaping would only corrupt legitimate prompts like "what does <div> do?" without adding safety. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Route the ?prompt= query param through sanitizePromptParam() at the chat entry point instead of a bare .trim(), so an attacker-crafted deep link cannot smuggle invisible/control characters or an oversized payload into the auto-submitted first message. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ding Add a dedicated spec covering every branch of sanitizePromptParam (XSS-ish passthrough, invisible/tag-block/control-char stripping with newline+tab preserved, oversized truncation, legit prompt intact, null/empty/whitespace → undefined). Extend the chat "initialPrompt forwarding" suite to assert the sanitized value is what reaches useAdvancedChat. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Extend the chat URL prompt-injection journey with four checkpoints for the sanitization behavior: a clean prompt rendering verbatim, invisible/control chars stripped to visible-only text, a whitespace/zero-width-only param producing no auto-submit, and an HTML/script-ish payload rendering as inert literal text (no injected element, no dialog). Adds a clearCachedSession helper; existing TC1-TC5 are left untouched. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add checkpoints upi-06..upi-09 for the new ?prompt= sanitization specs and upi-10 (oversized truncation) as unit-covered/not-e2e-reproducible, keeping COVERAGE.md and coverage.json in sync with the journey additions. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Member
|
Claude finished @conradmugabe's task —— View job E2E Coverage Review
Result: No new app routes introduced. Coverage improved with 5 new checkpoints for the |
mamigot
approved these changes
Jul 13, 2026
mamigot
left a comment
Member
There was a problem hiding this comment.
✅ E2E Coverage — No Issues
No new app routes were introduced. All existing coverage is intact.
Coverage check: 545 → 550 checkpoints (+5) — improved by the new chat-url-prompt-injection journey spec.
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.
Checklist
Changes