Skip to content

fix: escape ticket_id before interpolating into PostgREST filters in ai.py - #23

Draft
sonnymay wants to merge 1 commit into
mainfrom
claude/sleepy-lamport-lcb73f
Draft

sonnymay wants to merge 1 commit into
mainfrom
claude/sleepy-lamport-lcb73f

Conversation

@sonnymay

Copy link
Copy Markdown
Owner

Summary

Test plan

  • Added backend/test_ai.py with a parametrized regression test asserting _fetch_ticket and _fetch_notes escape an injected ticket_id (mirrors the existing injection tests in test_main.py/test_database.py).
  • python -m pytest test_ai.py test_main.py test_database.py -q → 45 passed.
  • ruff check and ruff format --check on changed files → clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xed3eAz7csBLFwejeoRRfX


Generated by Claude Code

…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
@vercel

vercel Bot commented Sep 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
supportops Ready Ready Preview Sep 13, 2026 2:06pm UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant