Volume 4: Security Internals

This volume describes how the server authenticates clients, decides what they may do, protects connections, records what happened, and limits abusive clients. It is written from the code. The operator view (what to turn on, defaults, known gaps) lives in Security; this volume links there instead of repeating it.

Pages

Page Covers
Authentication User store in pg_authid, Argon2id hashing, per-wire verifiers (SCRAM-SHA-256, mysql_native_password, Oracle 12C, SASL PLAIN, HTTP Basic, SigV4), superuser bootstrap, failed-login delay, protected mode, the pre-auth gate
Authorization Roles and membership, GRANT and REVOKE, the plan-level privilege check, column grants, column masks, row-level security, wire roles for non-SQL wires
TLS src/protocol/tls.rs, certificate loading and generation, the three per-wire TLS modes, require_tls, mTLS
Audit and limits Audit events and the hash-chained log, synergydb audit, the authentication rate limiter, buffer limits, timeouts, connection pools
Compliance notes What the code supports for compliance work, and what it does not
Encryption proxy Written separately
Encryption at rest internals Written separately

Code map

Area Main files
Password storage and verifiers src/auth/password.rs, src/auth/scram.rs, src/auth/verify_cache.rs
Shared wire login src/auth/wire_auth.rs
Role catalog src/catalog/system_tables.rs, src/catalog/repository.rs, src/catalog/bootstrap.rs, src/catalog/credentials.rs
Session identity src/auth/session.rs
Privileges src/auth/acl.rs, src/plan/privileges.rs, src/query/engine.rs (authorize_plan)
Row-level security src/plan/rls_injector.rs
TLS src/protocol/tls.rs, src/protocol/mssql/tls.rs, src/config.rs (TlsConfigFile)
Audit src/auth/audit.rs, src/auth/audit_chain.rs, src/audit_cmd.rs
Limits src/protocol/rate_limiter.rs, src/protocol/buffer_limits.rs, src/protocol/timeout.rs, src/protocol/pool.rs

(source: src/auth/mod.rs; src/protocol/mod.rs)

Modules that are present but not wired

Several modules under src/auth/ compile and have unit tests but nothing in the server calls them. They are listed here once so the other pages do not describe them as live behaviour.

Module What it contains Status
src/auth/permission.rs PermissionChecker Not wired: only the ObjectPrivilege type is used, by src/plan/executor.rs (source: src/auth/permission.rs, PermissionChecker)
src/auth/cache.rs PermissionCache Not wired: no caller outside src/auth/ (source: src/auth/cache.rs, PermissionCache)
src/auth/grant.rs GRANT statement model Not wired: GRANT runs through execute_grant_revoke in the engine instead (source: src/auth/grant.rs; src/query/engine.rs, execute_grant_revoke)
src/auth/column_security.rs Column security manager Not wired: column grants are enforced by column_grants_allow in the engine (source: src/auth/column_security.rs; src/query/engine.rs, column_grants_allow)
src/auth/secrets.rs SecretsManager with Vault, Kubernetes, AWS, Azure and GCP backends Not wired: init_secrets_manager has no caller; only the [secrets] config section is validated (source: src/auth/secrets.rs, init_secrets_manager; src/config.rs, SecretsConfigFile)
src/protocol/postgres/auth.rs PostgresAuthenticator with Trust, Cleartext and MD5 Not wired: the PostgreSQL handler authenticates in src/protocol/postgres/mod.rs; PostgresAuthConfig is stored but never read (source: src/protocol/postgres/auth.rs, PostgresAuthenticator)
src/protocol/pool.rs Generic async ConnectionPool Not wired: re-exported from src/protocol/mod.rs but not used (source: src/protocol/pool.rs, ConnectionPool)

Unit tests in tests/security_auth.rs exercise some of these modules directly (for example colsec_grant_and_check and grant_statement_apply_to_acl). Those tests show the module works on its own, not that the server uses it (source: tests/security_auth.rs).