Repository navigation
security(#236): wrap exercise name in XML tags in muscle inference prompt - #246
Merged
Merged
Conversation
…ompt A user-supplied exercise name was interpolated with bare double-quotes in buildMuscleInferencePrompt, allowing a crafted name containing a quote to break out of the string boundary and inject instructions. Angle brackets are stripped first, then the name is wrapped in <exercise> tags — the Anthropic-recommended structural boundary for untrusted input. Three new tests cover: XML tag presence, safe embedding of a name with double quotes, and stripping of angle brackets to prevent tag injection. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://white-island-090dfd003-246.westeurope.7.azurestaticapps.net |
3 tasks
This branch was previously deployed
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
buildMuscleInferencePromptwas interpolating user-supplied exercise names with bare double-quotes, so a name likeKnebøy" Ignore previous instructionscould break the prompt structure<exercise>tags — the Anthropic-recommended boundary for untrusted input in Claude promptsprompts.test.jscovering: XML tag presence, safe embedding of double-quoted names, and angle-bracket strippingbuildRecommendPrompt,buildPeriodRecommendPrompt) interpolate controlled muscle labels from theMUSCLESconstant (not user input) — no change needed thereTest plan
npm test— 90 tests should pass including 3 new prompt injection testsKnebøy "dyp") in ExerciseForm — muscle inference should still work correctly<exercise>...</exercise>wrappingCloses #236
🤖 Generated with Claude Code