Conversation
…ai.py _fetch_ticket and _fetch_notes built PostgREST filter strings by interpolating the user-supplied ticket_id from /ai/suggest directly, missing the same escape_filter_value() guard that #18 and #19 already applied to every filter in main.py. A crafted ticket_id could inject extra query parameters (e.g. widen the select or override filters) into the AI suggestion lookups. Add regression tests mirroring the existing injection-guard tests in test_database.py/test_main.py. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MfAUz5zxhP1oHqmUFFghyk
|
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
#18/#19addedescape_filter_value()to guard every PostgREST filter built inmain.pyagainst query-parameter injection (a craftedidcould append extra filter clauses, e.g. widen aselector override a filter).ai.py's_fetch_ticketand_fetch_notes— reachable viaPOST /ai/suggestwith a user-suppliedticket_id— were missed and still interpolated the raw value directly intoid=eq.{ticket_id}/ticket_id=eq.{ticket_id}&...filter strings.escape_filter_value()guard to both call sites inai.py.Test plan
backend/test_ai.pywith regression tests mirroring the existing injection-guard tests intest_database.py/test_main.py, verifying aticket_idcontaining&-delimited PostgREST query syntax can no longer inject extra params.pytest backend/test_ai.py backend/test_database.py backend/test_main.py— all pass except one pre-existing, unrelated failure (test_get_headers_uses_supabase_key) caused bySUPABASE_URLnot being set in this sandbox; reproduces identically on unmodifiedmain.ruff check backend/ai.py backend/test_ai.py— clean.🤖 Generated with Claude Code
https://claude.ai/code/session_01MfAUz5zxhP1oHqmUFFghyk
Generated by Claude Code