Conversation
…ai.py ai._fetch_ticket and ai._fetch_notes (used by POST /ai/suggest) still built PostgREST filter strings by interpolating the request body's ticket_id directly, the same injection class already fixed for main.py's id-based routes in #18/#19. A crafted ticket_id could append extra query params or filter conditions. Both helpers now go through escape_filter_value like the rest of the API, with regression tests covering the injection case. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XyiFjiKo98KHBde3mumZpQ
|
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
ai._fetch_ticketandai._fetch_notes(used byPOST /ai/suggest) built PostgREST filter strings by interpolating the request body'sticket_iddirectly, unescaped.main.py's id-based routes in fix: escape user input before interpolating into PostgREST filters #18 and fix: escape id path parameter before interpolating into PostgREST filters #19 — those two PRs just didn't touchai.py. A craftedticket_idcould append extra query parameters or filter conditions to the Supabase request.escape_filter_valueguard, matching the pattern used everywhere else in the API.Test plan
python3 -m pytest -qinbackend/— all tests pass except one pre-existing, environment-dependent failure (test_database.py::test_get_headers_uses_supabase_key, unrelated to this change — reproduced onmainbefore this fix too, since the sandbox has noSUPABASE_URLset).backend/test_ai.pywith regression tests asserting a maliciousticket_id(t1&status=eq.Closed) can no longer inject extra query params into thetickets/ticket_notesfilters built byai._fetch_ticket/ai._fetch_notes.ruff check .— clean.🤖 Generated with Claude Code
https://claude.ai/code/session_01XyiFjiKo98KHBde3mumZpQ
Generated by Claude Code