Conversation
…ai.py _fetch_ticket and _fetch_notes built PostgREST filter strings by interpolating the user-supplied ticket_id from POST /ai/suggest directly, without the escape_filter_value() guard that main.py's db_get call sites already use (see #18, #19). A crafted ticket_id could inject extra PostgREST query parameters/filters. Route it through escape_filter_value like the rest of the codebase, and add a regression test. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Xed3eAz7csBLFwejeoRRfX
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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
backend/ai.py's_fetch_ticketand_fetch_notesbuilt PostgREST filter strings by interpolating the user-suppliedticket_id(fromPOST /ai/suggest) directly, without theescape_filter_value()guard thatmain.py'sdb_getcall sites already use (see fix: escape user input before interpolating into PostgREST filters #18, fix: escape id path parameter before interpolating into PostgREST filters #19).ticket_idcould inject extra PostgREST query parameters/filters into the request sent to Supabase.escape_filter_value, matching the existing pattern inmain.pyanddatabase.py.Test plan
backend/test_ai.pywith a parametrized regression test asserting_fetch_ticketand_fetch_notesescape an injectedticket_id(mirrors the existing injection tests intest_main.py/test_database.py).python -m pytest test_ai.py test_main.py test_database.py -q→ 45 passed.ruff checkandruff format --checkon changed files → clean.🤖 Generated with Claude Code
https://claude.ai/code/session_01Xed3eAz7csBLFwejeoRRfX
Generated by Claude Code