Conversation
…ai.py _fetch_ticket and _fetch_notes built PostgREST filter strings from raw ticket_id, which reaches them unescaped from the public POST /ai/suggest body. This is the same PostgREST filter injection class fixed in main.py (#18, #19) but the ai module was missed. Apply escape_filter_value() the same way and add regression tests covering both helpers. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hv295zWJQ6j3qxjCHcgWrX
|
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_notesbuilt PostgREST filter strings from a rawticket_id, which flows in unescaped from the publicPOST /ai/suggestrequest body.main.py(fix: escape user input before interpolating into PostgREST filters #18, fix: escape id path parameter before interpolating into PostgREST filters #19) viaescape_filter_value, but theaimodule was missed at the time.escape_filter_value()to both call sites, matching the pattern used everywhere else in the codebase.Test plan
backend/test_ai.pywith regression tests asserting that a craftedticket_id(e.g.t1&status=eq.Closed) is percent-encoded before it reaches the Supabase query string, for both_fetch_ticketand_fetch_notes.python3 -m pytest— 46 passed.ruff checkon the changed files — no issues.🤖 Generated with Claude Code
https://claude.ai/code/session_01Hv295zWJQ6j3qxjCHcgWrX
Generated by Claude Code