Conversation
…ai.py
POST /ai/suggest passed the request body's ticket_id straight into
db_get filter strings in _fetch_ticket and _fetch_notes, unlike every
other {id}-based lookup which now goes through escape_filter_value
(#18, #19). A crafted ticket_id could append extra query parameters
or filter conditions to the Supabase REST request. Add regression
tests covering both helpers.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SGNgeN62cZWwyUxDLGpNxi
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
3 tasks
This branch was successfully 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
POST /ai/suggestpasses the request body'sticket_idstraight intodb_getfilter strings insideai._fetch_ticketandai._fetch_notes, unlike every other{id}-based lookup inmain.py, which now goes throughescape_filter_valueafter fix: escape user input before interpolating into PostgREST filters #18 and fix: escape id path parameter before interpolating into PostgREST filters #19.ticket_id(e.g. containing&or,) could append extra query parameters or filter conditions to the Supabase REST request, the same PostgREST filter-injection class those two prior PRs fixed elsewhere in the codebase.ticket_idwith the existingescape_filter_valuebefore interpolating it, closing the gap.Test plan
backend/test_ai.pywith regression tests asserting_fetch_ticketand_fetch_notesescape injected query-string delimiters inticket_id.python3 -m pytest -q): 44 passed including the 2 new tests, plus 1 pre-existing, unrelated failure (test_get_headers_uses_supabase_key) confirmed present on the unmodified tree too (environment-dependent, missingSUPABASE_URLin isolation).CHANGELOG.mdunder[Unreleased] / Fixed.🤖 Generated with Claude Code
https://claude.ai/code/session_01SGNgeN62cZWwyUxDLGpNxi
Generated by Claude Code