Skip to content

SQL injection in function explainQuery? #223

@hartwork

Description

@hartwork

Hi!

This was already part of a public discussion at the PostgreSQL Berlin meetup and I found no directions in this repository on where to send reports on potential vulnerabilities instead, so I hope it's okay to bring the following up here.

There is a place in this code base that (without any in-depth analysis) looks like it could be vulnerable to SQL injections:

await client.query(`SET search_path TO ${schema}`);
const explainQuery = `EXPLAIN ${query}`;

Can you confirm? Does it mean that a malicious or snitchy LLM could exploit explainQuery to run arbitrary queries on the connected database? Is there anything protecting against this that I might be missing?

Thanks and best, Sebastian

CC @divyenduz

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions