fix: parameterize SQL timeout, guard data-URL parse, cleanup frontend bugs#7
Conversation
… bugs - PostgreSQL/MySQL drivers: replace f-string SQL interpolation with parameterized queries for statement_timeout / MAX_EXECUTION_TIME - chat.py: guard data-URL MIME extraction against malformed URLs that lack a colon (prevents IndexError) - ai-panel.tsx: remove redundant ternary returning identical strings - playground-page.tsx: add AbortController to image fetch so in-flight requests cancel on component unmount Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Thanks for the bundle — 4 of the 5 changes look great and ready to merge. One blocker on the PostgreSQL side before I can pull this in: PG driver regression ( await conn.execute("SET statement_timeout = \$1", int(timeout_s * 1000))PostgreSQL's The original f-string wasn't actually injectable here ( await conn.execute(f"SET statement_timeout = {int(timeout_s * 1000)}")That keeps the spirit of the hardening (defense-in-depth against future refactors passing a non-int) without breaking the driver. The other 4 changes are good to go as-is:
Once the PG line is reverted to the int-coerced f-string, I'll approve and squash-merge. Appreciate the cleanup! |
PostgreSQL SET does not accept bind parameters — asyncpg hands $1 to the server prepare phase which returns a syntax error. Revert to f-string with explicit int() coercion for defense-in-depth. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Good catch — reverted to int-coerced f-string in cc1e7a6. Ready for re-review. |
tao-hpu
left a comment
There was a problem hiding this comment.
Fix verified — int-coerced f-string is the right minimal patch. Thanks for the fast turnaround!
…ixes from #7 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Recognize Houx. (Houjiawei330) for parameterizing MySQL timeout, hardening PG statement_timeout, guarding chat data-URL parsing, and replacing the playground thumbnail revoked-flag with AbortController.
Summary
statement_timeout/MAX_EXECUTION_TIMEchat.py— two MIME extraction sitessplit(":")[1]now guarded against malformed URLs to prevent IndexErrorai-panel.tsx; add AbortController to image fetch inplayground-page.tsxso in-flight requests cancel on unmountTest plan