Hub rules-postgresql

rules-postgresql

v3 public Verified

PostgreSQL

PostgreSQL is a powerful, open-source object-relational database system with a strong reputation for reliability and data integrity. These rules govern SQL optimization, schema design, and ACID-compliant data management.

@sigmashakeinc 2 pulls 6 rules published Apr 8, 2026 synced Oct 11, 2026 sigmashakeinc/rules/rulesets/rules-postgresql →
Severity
5 error 1 warn 0 info
demo.cast
PostgreSQL is a powerful, open-source object-relational database system with a strong reputation for reliability and data integrity. These rules govern SQL optimization, schema design, and ACID-compliant data management.

Rules index

6 governance rules

Indexed from the repository's .rules files, grouped by technology. Expand any rule to read the raw source.

postgresql

no-hardcoded-pg-credentials error block

Hardcoded PostgreSQL connection string or password in source code. Credentials committed to VCS are exposed to anyone with repository access and in CI logs. Load the connection string from an environment variable (DATABASE_URL) or a secrets manager instead.

Rule source requires an active Pro or Enterprise subscription.
no-pg-copy-to-file error block

COPY TO/FROM with an absolute file path runs as the PostgreSQL superuser and can read or overwrite arbitrary files on the database server (CWE-22, CVE-2018-1115 class). Use COPY ... TO STDOUT / FROM STDIN piped through the application layer instead, or restrict with pg_read_file/pg_write_file roles.

Rule source requires an active Pro or Enterprise subscription.
no-pg-read-file error block

pg_read_file(), pg_read_binary_file(), and pg_ls_dir() expose the filesystem of the database server to SQL-level callers. If the query is reachable from user input this is a server-side file read vulnerability. Restrict execution to superuser/pg_monitor roles and never expose these functions to application service accounts.

Rule source requires an active Pro or Enterprise subscription.
no-pg-superuser-grant error block

Granting SUPERUSER privilege bypasses all PostgreSQL access controls — a SUPERUSER can read any table, write any file the OS process can reach, and execute arbitrary OS commands via COPY. Use fine-grained GRANT statements on specific schemas and tables instead.

Rule source requires an active Pro or Enterprise subscription.
no-sql-string-concat error block

SQL query assembled via string concatenation or template interpolation with request data — direct SQL injection risk (CWE-89). Use parameterised queries: db.query('SELECT ... WHERE id = $1', [userId]) in pg/node-postgres, or an ORM. Never interpolate user-controlled values into SQL strings.

Rule source requires an active Pro or Enterprise subscription.
postgresql-block-unsafe-patterns warning ask

Dynamic EXECUTE in PL/pgSQL executes a string as SQL. If the string includes any user-supplied input without parameterisation, this is a first-class SQL injection vector (CWE-89). Use parameterised statements or EXECUTE ... USING $1 with bound parameters instead of string concatenation.

Rule source requires an active Pro or Enterprise subscription.

Version metadata

Published metadata

The hash-locked record of this published ruleset. When source contents change, the maintainer resyncs and the version bumps.

Version
v3
Published
Apr 8, 2026
Source commits
0
Synced
Oct 11, 2026
Hash
85faedd697bfebe445e21333f1b30a624c17e89b9ac7b885c2e06f0cb3e2e6b4
Signature
Verified (publisher key)
Tested with
claude-code@current
Plan
Starter (free)
Visibility
Public

Source history

Recent commits

Latest commits touching rulesets/rules-postgresql/.sigmashake/rules in sigmashakeinc/rules/rulesets/rules-postgresql. The published version only bumps when a maintainer resyncs.

No commit history available.