fix: validate and allowlist language before prompt injection#109
Merged
fix: validate and allowlist language before prompt injection#109
language before prompt injection#109Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…UAGES PR #92 introduced a security vulnerability by replacing the language allowlist validation with `language = body.language || "English"`, which allows arbitrary values to be injected into the AI prompt. Restore the proper validation: - Check that body.language is a string - Normalize to title case - Validate against SUPPORTED_LANGUAGES allowlist - Fall back to "English" if not in the list This also includes the other improvements from PR #92 (markdown cleanup, gemini model update, UI language list). Co-authored-by: jaseel0 <225665919+jaseel0@users.noreply.github.com> Agent-Logs-Url: https://github.com/BeyteFlow/ReadmeGenAI/sessions/486edd1a-2457-4589-b5e2-b61f6dfde55f
- Restore the aria-label attribute on the language select element (removed in PR #92, reducing accessibility) - Replace the duplicate inline languages array with SUPPORTED_LANGUAGES from constants (single source of truth) Co-authored-by: jaseel0 <225665919+jaseel0@users.noreply.github.com> Agent-Logs-Url: https://github.com/BeyteFlow/ReadmeGenAI/sessions/486edd1a-2457-4589-b5e2-b61f6dfde55f
The PR #92 incorrectly changed the JSDoc to say "Fastify request object". This is a Next.js API route that uses the standard Web Request API. Co-authored-by: jaseel0 <225665919+jaseel0@users.noreply.github.com> Agent-Logs-Url: https://github.com/BeyteFlow/ReadmeGenAI/sessions/486edd1a-2457-4589-b5e2-b61f6dfde55f
Copilot
AI
changed the title
[WIP] Validate and allowlist language on the API
fix: validate and allowlist Mar 24, 2026
language before prompt injection
naheel0
approved these changes
Mar 25, 2026
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.
PR #92 removed the
languageallowlist check, replacing it withlanguage = body.language || "English"— allowing arbitrary strings to be injected directly into the Gemini prompt via direct API calls, bypassing UI restrictions.Changes
src/app/api/generate/route.tsSUPPORTED_LANGUAGES; falls back to"English"for any unrecognized valuesrc/components/Generator/SearchInput.tsxlanguagesarray introduced in PR feat: Multi-Language README Support #92; uses theSUPPORTED_LANGUAGESconstant as the single source of trutharia-labelon the language<select>that was dropped in PR feat: Multi-Language README Support #92Original prompt
⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.