Skip to content

fix: add allowlist to sanitize_language_hint#789

Open
diaxx1309 wants to merge 10 commits into
imDarshanGK:mainfrom
diaxx1309:main
Open

fix: add allowlist to sanitize_language_hint#789
diaxx1309 wants to merge 10 commits into
imDarshanGK:mainfrom
diaxx1309:main

Conversation

@diaxx1309

Copy link
Copy Markdown

previously any string was accepted as a language hint with no validation. Adds an allowlist of supported language and return a 422 error for invalid values.

Description

Added an allowlist of supported languages to 'sanitize_language_hint()' in 'sanitize.py'. Previously, any string was accepted as a language hint with no validation. This restricts input to known supported languages and returns a 422 error for invalid values.

Related Issue

Fixes #469

Type of change

  • Bug fix
  • [x ] New feature / enhancement
  • Documentation update
  • Test addition
  • Refactor

Checklist

  • [ x] I have read CONTRIBUTING.md
  • [ x] My branch is up to date with main
  • I have run pytest -v and all tests pass
  • [ x] I have not introduced duplicate issues or features
  • [ x] My PR title follows the format: feat/fix/docs/test: short description
  • I have added tests for new features (Level 2 and 3 issues)
  • [ x] No hardcoded secrets or API keys in my code
  • [ x] This PR is linked to a GSSoC 2026 issue

Screenshots (if frontend change)

Test evidence

pytest -v
# paste output

previously any stringwas accepted as a language hint with no validation.
Adds an allowlist of supported language and return a 422 error for invalid values.
@diaxx1309 diaxx1309 requested a review from imDarshanGK as a code owner June 2, 2026 13:20
@imDarshanGK

Copy link
Copy Markdown
Owner

@diaxx1309 ci failing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add input validation to /analyze endpoint

2 participants