Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn when PQExec is called with a non-constant to warn about SQL injection in PostgreSQL #69

Open
david-a-wheeler opened this issue May 26, 2022 · 0 comments

Comments

@david-a-wheeler
Copy link
Owner

Warn when PostgreSQL's PQExec is called with a non-constant, to warn about SQL injection.

The PostgreSQL libpq C interface provides several functions, as explained in the PostgreSQL (Command Execution Functions) documentation:

  • PQexec directly runs a single string command and returns a result.
  • PQexecParams implements a parameterized statement.
    Placeholders are represented in the command as $1, $2, etc.,
    and the parameter values are supplied as separate parameters in the same call.
  • PQprepare implements a prepared statement.
    It takes a statement with placeholders and
    submits it to the database to be prepared.
    Users can later use the separate PQexecPrepared call
    to provide the placeholder parameter values and execute the resulting
    command.

Users should use the latter two for non-constant queries.

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

No branches or pull requests

1 participant