PST-062: The whole .env, including the secret keys, is handed to the PostgreSQL container #791
Labels
No labels
accessibility
authentication
breaking change
bug
documentation
enhancement
interface
internationalisation
observability
performance
security
tier
1
tier
2
tier
3
tier/4
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Postulo/postulo#791
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found in the security audit of 2026-10-10 (
SECURITY-AUDIT-2026-10-10.md), run againstmainatc30851bfrom 8 to 10 October 2026, as PST-062. Severity: Low.The text below is the audit's entry, unchanged apart from links to the other issues it names. The finding was produced by automated review and checked by a second automated pass; re-check it before acting on it.
docker/compose.postgres.yml(117-125)Who can do it, and what they need. Anyone who gains code execution inside the db container (a PostgreSQL vulnerability or a mis-set superuser role with COPY TO PROGRAM), or who can read that container's environment via the Docker API. Precondition: PostgreSQL deployment profile and such a compromise.
How it works.
env_file: ../.env, so every Postulo variable (POSTULO_SECRET_KEY, POSTULO_FIELD_KEY, POSTULO_EMAIL_HOST_PASSWORD, OIDC client secret, metrics/logs tokens) is in the postgres process environment.docker inspect postulo-db-1prints them.Impact. Turns a database-tier compromise (which yields hashed passwords and encrypted secrets) into one that also yields the key that decrypts those secrets, defeating the threat model's "key held outside the database" argument for that profile. The comment says the db only needs POSTGRES_PASSWORD.
Evidence.
Verification (verdict: confirmed; severity after verification: Low). Keep it low. Location: docker/compose.postgres.yml:121-122 (db.env_file). Attacker: code execution as the postgres user in the db container (PostgreSQL vulnerability, or a superuser role used through SQL), not Docker API access. Gain: POSTULO_SECRET_KEY and POSTULO_FIELD_KEY (decrypting stored connection secrets and OAuth refresh tokens) and the env-only SMTP and OIDC credentials. Drop the 'forge session cookies' claim (sessions are DB-backed with random keys). The password-reset forgery is redundant with DB write access. Remediation: give the db container only POSTGRES_PASSWORD, with a separate small env file (for example docker/db.env, or
POSTGRES_PASSWORD_FILEplus a Compose secret), keep the full .env for the Postulo services, and update the #582 test. Optionally create a non-superuser application role.Suggested remediation. Give the db service only POSTGRES_PASSWORD (a dedicated env file, or
environment: POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}with the compose project's env file pointed at the repository root via --env-file), and document the split in .env.example.