Skip to main content

pgspot

Actions Status License: PostgreSQL PyPI Downloads Code style: black

Spot vulnerabilities in PostgreSQL extension scripts.

pgspot checks extension scripts for following PostgreSQL security best practices. In addition to checking extension scripts it can also be used to check security definer functions or any other PostgreSQL SQL code.

pgspot checks for the following vulnerabilities:

  • search_path-based attacks
  • unsafe object creation

Consult the reference for detailed documentation of the vulnerabilities which pgspot detects, and their potential mitigations.

Installation

pip install pgspot

Requirements

To install the runtime requirements, use pip install -r requirements.txt.

Usage

> pgspot -h
usage: pgspot [-h] [-a] [--proc-without-search-path PROC] [--summary-only] [--plpgsql | --no-plpgsql] [--explain EXPLAIN] [--ignore IGNORE] [--sql-accepting SQL_FN] [FILE ...]

Spot vulnerabilities in PostgreSQL SQL scripts

positional arguments:
  FILE                  file to check for vulnerabilities

options:
  -h, --help            show this help message and exit
  -a, --append          append files before checking
  --proc-without-search-path PROC
                        whitelist functions without explicit search_path
  --summary-only        only print number of errors, warnings and unknowns
  --plpgsql, --no-plpgsql
                        Analyze PLpgSQL code (default: True)
  --explain EXPLAIN     Describe an error/warning code
  --ignore IGNORE       Ignore error or warning code
  --ignore-lang LANG    Ignore unknown procedural language
  --sql-accepting SQL_FN
                        Specify one or more sql-accepting functions
> pgspot --ignore PS017 <<<"CREATE TABLE IF NOT EXISTS foo();"
PS012: Unsafe table creation: foo

Errors: 1 Warnings: 0 Unknown: 0

SQL-accepting functions

It is a common pattern that SQL-accepting functions exist, which take a string-like argument which will be executed as SQL. This can "hide" some SQL from pgspot, as the string-like argument masks the SQL. With the --sql-accepting argument, pgspot can be told about such functions.

Assuming a function named execute_sql which takes a SQL string as its first argument, and executes it. With pgspot --sql-accepting=execute_sql we can tell pgspot execute_sql may accept SQL. pgspot will attempt to unpack and evaluate all arguments to that function as SQL.

Metadata

Release files for pgspot 0.9.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pgspot 0.9.4
File Size Uploaded Provenance Actions
pgspot-0.9.4.tar.gz 18.3 kB With provenance Details for pgspot-0.9.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pgspot 0.9.4
File Interpreter ABI Platform Actions
pgspot-0.9.4-py3-none-any.whl Python 3 none any Details for pgspot-0.9.4-py3-none-any.whl

Total release size: 37.5 kB

Release files / pgspot-0.9.4.tar.gz

Download URL pgspot-0.9.4.tar.gz
Size 18.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8ccbde8f7c0de016dcdc8a5fa5566e55d366a1c93485f0e9bc4fc6f6bef308cf
BLAKE2b-256 checksum
How to use checksums
aa102ac96e4464540e2196e6e54b8ce97fefa84daf7e69426c162a549a369a0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Release files / pgspot-0.9.4-py3-none-any.whl

Download URL pgspot-0.9.4-py3-none-any.whl
Size 19.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a3ca665f78107cf41f4932a830666cd42f4aa4502801bd7e43486ac625c0bb23
BLAKE2b-256 checksum
How to use checksums
bfc5f0e10f43b3034c17a9ca6f6b34d85904763e0b3f2153f2b81b4a4459340e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Security for pgspot 0.9.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pgspot-0.9.4.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page