fix(ai-security): unscoped LLM prompts allow prompt injection and API abuse#38
Merged
Merged
Conversation
Contributor
|
Important Review skipped Bot user detected. To trigger a single review, invoke the ⚙️ SettingsSeverity Threshold: 📖 User Guide
|
Contributor
|
Note Linting checks passed successfully 🎉 All formatting and code quality checks are clean. You're good to merge 🚀 |
calebephrem
approved these changes
Jul 13, 2026
calebephrem
left a comment
Member
There was a problem hiding this comment.
I didn't get how this is prompt injection fix but ts a nice pr
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.
Automated fix generated by Rhea for a MEDIUM AI_SECURITY finding:
Hardening the three Groq call sites with system prompts, delimited untrusted input, and tighter generation settings.
Summary
Hardened all three Groq call sites against prompt injection by adding instruction hierarchy and untrusted-data framing.
Changes
src/commands/code/suggest.ts: System policy for code-only advice; user payload in<user_code>; temperature0.2.src/commands/code/run.ts: System policy for explain/fix; code and stderr in delimited tags; temperature0.2andmax_completion_tokens: 640.src/commands/math/math-breakdown.ts: System policy for math-only breakdowns; expression in<user_expression>; temperature0.2.Why
Unscoped single-user messages let injected text override the task. System messages plus delimited data reduce injection risk and keep completions on-task without changing command UX.
verifyStagedEditsonly reported missing ambient types/deps (nonode_modulesin the limited checker), not issues from these edits.🤖 Generated by Rhea — review before merging.