This is a backlog of deferred hardening work. Each item is a candidate to be planned and implemented later; none of them is a current defect that makes the server unusable. The items came out of a threat-model review that asked one question: if an attacker walks off with a full dump of the PostgreSQL database, what can they still read or crack, and what should we do about it?
This document only records the gaps. It does not describe anything that is already implemented, and it does not propose code changes here.
The baseline is better than a naive server's, because secrets are stored hashed or encrypted, and the key material lives outside the database. The table below is the full accounting.
| Data | Protection at rest | If the dump leaks |
|---|---|---|
| User passwords | Argon2id PHC, salted (src/db/user_repo.rs) |
Offline cracking only. |
| Client secrets | Argon2id PHC (src/db/client_repo.rs) |
Offline cracking only. |
| TOTP secrets | AES-256-GCM under HKDF-SHA256 (src/crypto/totp.rs, info totp-gcm-v2; pre-migration v1 blobs under bare SHA256(totp_key) still decrypt) |
Safe only if the key is not in the dump. |
| TOTP recovery codes | Argon2id PHC (src/db/user_repo/totp.rs) |
Offline cracking only. |
| DCR registration access tokens | Keyed HMAC hash (src/db/client_repo.rs) |
Safe; the pepper is not in the database. |
| Emails, client names, contacts, redirect URIs, scopes, entitlements | Plaintext | Full disclosure. |
jwks (client public keys) |
Plaintext | Public by design. |
tls_client_auth_subject_dn and cert thumbprints |
Plaintext | Identifier disclosure. |
is_admin, disabled, must_change_password, timestamps |
Plaintext | Metadata disclosure. |
The critical dependency is outside the database. The token pepper and the TOTP
encryption key are supplied through environment variables or mounted files
(src/config/raw.rs, src/config/build.rs), never through a table. A pure
database dump therefore does not yield them, and every hashed or encrypted
column above stays opaque. This separation is the single most important
protection the server has today, and the gaps below are mostly about not
depending on it alone.
Each item names the risk, the change to plan, and the files it would touch. The list is deliberately short and ordered by value.
email
lookup so case-insensitive uniqueness still works.src/db/user_repo.rs, src/db/client_repo.rs,
src/db/redirect_repo.rs, src/keys.rs, migrations/.src/crypto/totp.rs, src/keys.rs.src/config/, docs/DEPLOYMENT.md, docs/SECURITY.md.pgcrypto. A dump could be taken by a read-only job and leave no trace.docs/DATABASE.md, docs/DEPLOYMENT.md.The attack surface and the existing controls are documented in SECURITY.md; this section lists only the mitigations to close the residual risks.
This section covers a second threat-model question: if an attacker is already
inside the image's trust boundary, how could they reach the container or the
host, and how should we reduce that risk? The image is already hardened: it runs
as non-root UID 65532, uses a read-only root filesystem, drops all capabilities,
sets allowPrivilegeEscalation: false and seccompProfile: RuntimeDefault,
ships no shell, builds a static musl binary from digest-pinned bases, and
produces an SBOM, provenance, and a cosign signature in CI. The remaining vectors
are therefore narrow, and none of them is a current defect. This section lists
the mitigations to implement.
RuntimeDefault.deploy/k8s/deployment.yaml, docs/DEPLOYMENT.md.cargo deny do not catch a zero-day in a
trusted crate.cargo vet/cargo crev review..github/workflows/, fuzz/, deny.toml.docker exec / kubectl exec into the running container bypasses
every image control.docs/OPERATIONS.md, docs/DEPLOYMENT.md.Ranked by value against effort:
Recommendation: implement item 1 next. It closes the largest plaintext disclosure; items 2 and 3 then reduce the cost of a future key compromise.