{"schema": "pgtrue.report/1", "url": "https://pgtrue.postgres.ai/shared/brief/06c213c4-93c3-479e-beb4-2913f70dedce", "published": "2026-10-19T07:10:35Z", "publisher": "PostgresAI", "article": {"title": "PostgreSQL Security: A Comprehensive Guide to Hardening Your Database", "url": "https://www.percona.com/blog/postgresql-database-security-what-you-need-to-know", "date_published": "2025-04-01T11:00:58Z", "author": "Ibrar Ahmed", "publisher": "Percona"}, "grade": "A", "axes": [{"axis": "Factual", "summary": "A \u00b7 0 wrong of 14 checked \u00b7 0 caveats"}, {"axis": "Applicable", "summary": "A \u00b7 0 wrong of 12 checked \u00b7 1 caveat"}, {"axis": "Consistent", "summary": "A \u00b7 0 wrong of 14 checked \u00b7 0 caveats"}, {"axis": "Transparent", "summary": "A \u00b7 0 wrong of 9 checked \u00b7 1 caveat"}, {"axis": "Safe", "summary": "not applicable"}], "findings": [{"anchor": "F1", "url": "https://pgtrue.postgres.ai/shared/brief/06c213c4-93c3-479e-beb4-2913f70dedce#F1", "claim": "Enable ssl = on\u2026", "explanation": "Enabling ssl supports TLS but does not itself require encryption. PostgreSQL 17.4 documents this in runtime.sgml:2207-2212. Plaintext remains possible when matching authentication rules permit it. The article's encryption checklist omits enforcement. Require hostssl rules and remove matching plaintext-permitting rules to enforce TLS.", "verdict": "Mostly accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/f8554dee417ffc4540c94cf357f7bf7d4b6e5d80/doc/src/sgml/runtime.sgml#L2200-L2230", "label": "REL_17_4 \u00b7 doc/src/sgml/runtime.sgml:2200-2230"}, {"url": "https://github.com/postgres/postgres/blob/f8554dee417ffc4540c94cf357f7bf7d4b6e5d80/src/backend/libpq/hba.c#L2488-L2520", "label": "REL_17_4 \u00b7 src/backend/libpq/hba.c:2488-2520"}, {"url": "https://github.com/postgres/postgres/blob/f8554dee417ffc4540c94cf357f7bf7d4b6e5d80/doc/src/sgml/config.sgml#L1221-L1235", "label": "REL_17_4 \u00b7 doc/src/sgml/config.sgml:1221-1235"}]}, {"anchor": "F2", "url": "https://pgtrue.postgres.ai/shared/brief/06c213c4-93c3-479e-beb4-2913f70dedce#F2", "claim": "\u2026don\u2019t let it default to \u2018*\u2019\u2026", "title": "listen_addresses defaults to localhost", "explanation": "PostgreSQL 17.4 defaults listen_addresses to localhost. guc_tables.c:4427-4435 sets that value. config.sgml:644-678 documents loopback-only TCP access. A deployment can override it with *.", "verdict": "Mostly accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/f8554dee417ffc4540c94cf357f7bf7d4b6e5d80/src/backend/utils/misc/guc_tables.c#L4427-L4435", "label": "REL_17_4 \u00b7 src/backend/utils/misc/guc_tables.c:4427-4435"}, {"url": "https://github.com/postgres/postgres/blob/f8554dee417ffc4540c94cf357f7bf7d4b6e5d80/doc/src/sgml/config.sgml#L644-L678", "label": "REL_17_4 \u00b7 doc/src/sgml/config.sgml:644-678"}]}, {"anchor": "F3", "url": "https://pgtrue.postgres.ai/shared/brief/06c213c4-93c3-479e-beb4-2913f70dedce#F3", "claim": "\u2026including password-based logins and SCRAM-SHA-256\u2026", "title": "SCRAM supports challenge-response authentication and hashed password storage", "explanation": "PostgreSQL 17.4 implements SCRAM-SHA-256 password authentication. client-auth.sgml:1229-1239 documents password-sniffing protection and hashed storage. The same section identifies older client-library compatibility limits.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/f8554dee417ffc4540c94cf357f7bf7d4b6e5d80/doc/src/sgml/client-auth.sgml#L1220-L1330", "label": "REL_17_4 \u00b7 doc/src/sgml/client-auth.sgml:1220-1330"}]}, {"anchor": "F4", "url": "https://pgtrue.postgres.ai/shared/brief/06c213c4-93c3-479e-beb4-2913f70dedce#F4", "claim": "\u2026peer , which uses the OS user account to verify identity\u2026", "title": "Peer authentication uses the local operating system identity", "explanation": "PostgreSQL 17.4 obtains peer credentials from the kernel. auth.c:1850-1905 resolves the operating system account and checks its mapping. client-auth.sgml:1704-1707 limits peer authentication to local connections.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/f8554dee417ffc4540c94cf357f7bf7d4b6e5d80/doc/src/sgml/client-auth.sgml#L1696-L1710", "label": "REL_17_4 \u00b7 doc/src/sgml/client-auth.sgml:1696-1710"}, {"url": "https://github.com/postgres/postgres/blob/f8554dee417ffc4540c94cf357f7bf7d4b6e5d80/src/backend/libpq/auth.c#L1850-L1905", "label": "REL_17_4 \u00b7 src/backend/libpq/auth.c:1850-1905"}]}, {"anchor": "F5", "url": "https://pgtrue.postgres.ai/shared/brief/06c213c4-93c3-479e-beb4-2913f70dedce#F5", "claim": "PostgreSQL uses Role-Based Access Control (RBAC)\u2026", "title": "Roles and object privileges control database authorization", "explanation": "PostgreSQL 17.4 manages permissions through roles. user-manag.sgml:5-22 documents object ownership, privileges, and membership. ddl.sgml:1850-1898 documents granting and revoking privileges.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/f8554dee417ffc4540c94cf357f7bf7d4b6e5d80/doc/src/sgml/user-manag.sgml#L5-L22", "label": "REL_17_4 \u00b7 doc/src/sgml/user-manag.sgml:5-22"}, {"url": "https://github.com/postgres/postgres/blob/f8554dee417ffc4540c94cf357f7bf7d4b6e5d80/doc/src/sgml/ddl.sgml#L1850-L1898", "label": "REL_17_4 \u00b7 doc/src/sgml/ddl.sgml:1850-1898"}]}, {"anchor": "F6", "url": "https://pgtrue.postgres.ai/shared/brief/06c213c4-93c3-479e-beb4-2913f70dedce#F6", "claim": "\u2026Enforce policies that determine which rows a given user can see or modify.", "title": "RLS policies restrict rows users can query or modify", "explanation": "PostgreSQL 17.4 supports per-user row policies. ddl.sgml:2517-2519 documents restrictions on returned, inserted, updated, and deleted rows. Its later paragraphs describe owner exceptions and operations outside RLS.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/f8554dee417ffc4540c94cf357f7bf7d4b6e5d80/doc/src/sgml/ddl.sgml#L2510-L2548", "label": "REL_17_4 \u00b7 doc/src/sgml/ddl.sgml:2510-2548"}]}, {"anchor": "F7", "url": "https://pgtrue.postgres.ai/shared/brief/06c213c4-93c3-479e-beb4-2913f70dedce#F7", "claim": "\u2026Use settings like log_statement , log_connections , and log_disconnections\u2026", "title": "The three logging settings cover statements and connection events", "explanation": "PostgreSQL 17.4 log_statement selects SQL statement classes. log_connections records attempts and successful authentication and authorization. log_disconnections records session termination and duration. config.sgml:7320-7365 and 7762-7810 document these functions. postgres.c and auth.c implement the corresponding checks.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/f8554dee417ffc4540c94cf357f7bf7d4b6e5d80/doc/src/sgml/config.sgml#L7762-L7810", "label": "REL_17_4 \u00b7 doc/src/sgml/config.sgml:7762-7810"}, {"url": "https://github.com/postgres/postgres/blob/f8554dee417ffc4540c94cf357f7bf7d4b6e5d80/doc/src/sgml/config.sgml#L7320-L7346", "label": "REL_17_4 \u00b7 doc/src/sgml/config.sgml:7320-7346"}, {"url": "https://github.com/postgres/postgres/blob/f8554dee417ffc4540c94cf357f7bf7d4b6e5d80/doc/src/sgml/config.sgml#L7348-L7365", "label": "REL_17_4 \u00b7 doc/src/sgml/config.sgml:7348-7365"}, {"url": "https://github.com/postgres/postgres/blob/f8554dee417ffc4540c94cf357f7bf7d4b6e5d80/src/backend/tcop/postgres.c#L2360-L2387", "label": "REL_17_4 \u00b7 src/backend/tcop/postgres.c:2360-2387"}, {"url": "https://github.com/postgres/postgres/blob/f8554dee417ffc4540c94cf357f7bf7d4b6e5d80/src/backend/libpq/auth.c#L330-L374", "label": "REL_17_4 \u00b7 src/backend/libpq/auth.c:330-374"}, {"url": "https://github.com/postgres/postgres/blob/f8554dee417ffc4540c94cf357f7bf7d4b6e5d80/src/backend/tcop/postgres.c#L4311-L4390", "label": "REL_17_4 \u00b7 src/backend/tcop/postgres.c:4311-4390"}]}, {"anchor": "F8", "url": "https://pgtrue.postgres.ai/shared/brief/06c213c4-93c3-479e-beb4-2913f70dedce#F8", "claim": "\u2026pg_read_file\u2026", "title": "pg_read_file can return an entire text file", "explanation": "PostgreSQL 17.4 pg_read_file returns the entire file when offset and length are omitted. func.sgml:30341-30364 documents this behavior. genfile.c:319-327 passes the whole-file arguments to the common reader.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/f8554dee417ffc4540c94cf357f7bf7d4b6e5d80/doc/src/sgml/func.sgml#L30341-L30364", "label": "REL_17_4 \u00b7 doc/src/sgml/func.sgml:30341-30364"}, {"url": "https://github.com/postgres/postgres/blob/f8554dee417ffc4540c94cf357f7bf7d4b6e5d80/src/backend/utils/adt/genfile.c#L319-L327", "label": "REL_17_4 \u00b7 src/backend/utils/adt/genfile.c:319-327"}]}, {"anchor": "F9", "url": "https://pgtrue.postgres.ai/shared/brief/06c213c4-93c3-479e-beb4-2913f70dedce#F9", "claim": "\u2026configured in pg_hba.conf\u2026", "title": "pg_hba.conf controls client authentication", "explanation": "PostgreSQL 17.4 configures client authentication through pg_hba.conf. client-auth.sgml:64-83 documents the default location and reload behavior. The hba_file parameter can select another location.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/f8554dee417ffc4540c94cf357f7bf7d4b6e5d80/doc/src/sgml/client-auth.sgml#L64-L83", "label": "REL_17_4 \u00b7 doc/src/sgml/client-auth.sgml:64-83"}]}, {"anchor": "F10", "url": "https://pgtrue.postgres.ai/shared/brief/06c213c4-93c3-479e-beb4-2913f70dedce#F10", "claim": "\u2026Lock down who can run stored procedures\u2026", "title": "EXECUTE privileges control procedure calls", "explanation": "PostgreSQL 17.4 uses EXECUTE privileges for functions and procedures. ddl.sgml:2059-2074 documents this control. Administrators can grant or revoke that privilege.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/f8554dee417ffc4540c94cf357f7bf7d4b6e5d80/doc/src/sgml/ddl.sgml#L2059-L2074", "label": "REL_17_4 \u00b7 doc/src/sgml/ddl.sgml:2059-2074"}]}, {"anchor": "F11", "url": "https://pgtrue.postgres.ai/shared/brief/06c213c4-93c3-479e-beb4-2913f70dedce#F11", "claim": "PostgreSQL supports multiple methods\u2026", "title": "PostgreSQL supports multiple authentication methods", "explanation": "PostgreSQL 17.4 dispatches LDAP and RADIUS authentication in src/backend/libpq/auth.c:606\u2013669. Its authentication result controls connection acceptance.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/f8554dee417ffc4540c94cf357f7bf7d4b6e5d80/src/backend/libpq/auth.c#L606-L669", "label": "REL_17_4 \u00b7 src/backend/libpq/auth.c:606-669"}]}, {"anchor": "F12", "url": "https://pgtrue.postgres.ai/shared/brief/06c213c4-93c3-479e-beb4-2913f70dedce#F12", "claim": "PostgreSQL\u2019s built-in logging covers the basics: connection attempts\u2026", "title": "Built-in logging can record connection attempts", "explanation": "PostgreSQL 17.4 documents connection-attempt logging in doc/src/sgml/config.sgml:7320\u20137346. Enable log_connections to record these attempts.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/f8554dee417ffc4540c94cf357f7bf7d4b6e5d80/doc/src/sgml/config.sgml#L7320-L7346", "label": "REL_17_4 \u00b7 doc/src/sgml/config.sgml:7320-7346"}]}, {"anchor": "F13", "url": "https://pgtrue.postgres.ai/shared/brief/06c213c4-93c3-479e-beb4-2913f70dedce#F13", "claim": "\u2026disconnections\u2026", "title": "Built-in logging can record disconnections", "explanation": "PostgreSQL 17.4 documents session-termination logging in doc/src/sgml/config.sgml:7348\u20137365. Enable log_disconnections to record session endings.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/f8554dee417ffc4540c94cf357f7bf7d4b6e5d80/doc/src/sgml/config.sgml#L7348-L7365", "label": "REL_17_4 \u00b7 doc/src/sgml/config.sgml:7348-7365"}]}, {"anchor": "F14", "url": "https://pgtrue.postgres.ai/shared/brief/06c213c4-93c3-479e-beb4-2913f70dedce#F14", "claim": "\u2026and queries\u2026", "title": "Built-in logging can record SQL statements", "explanation": "PostgreSQL 17.4 documents SQL statement logging in doc/src/sgml/config.sgml:7762\u20137810. log_statement controls which statement classes appear.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/f8554dee417ffc4540c94cf357f7bf7d4b6e5d80/doc/src/sgml/config.sgml#L7762-L7810", "label": "REL_17_4 \u00b7 doc/src/sgml/config.sgml:7762-7810"}]}]}