Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-authored-by: jaseel0 <225665919+jaseel0@users.noreply.github.com> Agent-Logs-Url: https://github.com/BeyteFlow/ReadmeGenAI/sessions/f4eeddeb-c8be-4a88-ad75-2b2deaf64c57
Copilot
AI
changed the title
[WIP] Fix issues in multi-language README support
fix: Validate and allowlist language input to prevent prompt injection in multi-language README generation
Mar 23, 2026
jaseel0
approved these changes
Mar 23, 2026
naheel0
approved these changes
Mar 23, 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.
body.languagefrom the request was interpolated directly into the Gemini prompt without validation, enabling prompt injection attacks. This PR implements an allowlist-based validation layer and wires up the full multi-language feature end-to-end.Changes
src/constants/languages.ts— New shared constantSUPPORTED_LANGUAGES(as consttuple +SupportedLanguagetype) as single source of truth for both API and UI.src/app/api/generate/route.ts— Validatesbody.languageimmediately afterreq.json(): trims, normalizes to title case, checks againstSUPPORTED_LANGUAGES, falls back to"English"if unrecognized. The validated locallanguagevariable is what gets interpolated into the prompt —body.languageis never used directly.src/components/Generator/SearchInput.tsx— Adds language selector dropdown (populated fromSUPPORTED_LANGUAGES) witharia-labelfor accessibility. UpdatesonGeneratesignature to(url: string, language: string). Responsive layout (column on mobile, row onmd+).src/app/generate/GeneratePageClient.tsx— UpdateshandleGenerateto accept and forwardlanguageto the API request body.Original prompt