Skip to content

fix(channel): bind NOTIFY payloads via pg_notify - #1365

Open
arimu1 wants to merge 1 commit into
typelevel:mainfrom
arimu1:fix/1339-channel-notify-escape
Open

fix(channel): bind NOTIFY payloads via pg_notify#1365
arimu1 wants to merge 1 commit into
typelevel:mainfrom
arimu1:fix/1339-channel-notify-escape

Conversation

@arimu1

@arimu1 arimu1 commented Sep 13, 2026

Copy link
Copy Markdown

Summary

  • Fix SQL injection in Channel.fromNameAndProtocol by sending notification payloads through bound parameters instead of embedding them in the SQL string.
  • PostgreSQL rejects parameterized NOTIFY ... $1 syntax; use SELECT pg_notify($1, $2) IS NULL with both channel name and payload bound as text.
  • Execute via executeSized so the extended query completes with Sync and notifications are delivered reliably to listeners on the same session.

Fixes #1339

Test plan

  • Added ChannelTest case with a payload containing single quotes and a double quote; verified round-trip locally against Postgres 11 (docker) on port 15432.
  • CI (testsJVM/testOnly tests.ChannelTest) with project docker compose Postgres.

@arimu1
arimu1 force-pushed the fix/1339-channel-notify-escape branch from 6459faa to c08e3b7 Compare September 13, 2026 00:38
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.

SQL injection in Channel.fromNameAndProtocol

1 participant