security(state): provision least-privilege PostgreSQL roles - #208
Draft
seonghobae wants to merge 10 commits into
Draft
security(state): provision least-privilege PostgreSQL roles#208seonghobae wants to merge 10 commits into
seonghobae wants to merge 10 commits into
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced Sep 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #80 #192. Draft child of exact #207@
1d45a024f7e6a0cc351eda3b9fb317ccf6e35300.This bounded durable-state slice moves the least-privilege publication-role contract out of #207's integration fixture and into an executable deployment artifact without enabling
StateAuthority::Postgres, creating credentials, copying foreign-owner behavior, or widening Wardnet beyond its reputation/security state.Executed RED and repair lineage
Initial test-only
e1c6f7c3ef178f37c2ef15cb1c42f37ca0ea1ce1added onlytests/postgres_deployment_role_contract.rs; CI34246722844/ rust102130492398stopped at rustfmt and is not semantic evidence. Concurrent formatting repair0cf9fe514047b320a4aae1a9a1f8b96a8fb25053was adopted rather than overwritten. Its CI34247087136/ rust102131737688passed formatting and existing prerequisites, then produced the intended semantic RED becausedeploy/postgresql/reputation_state_roles.sqldid not exist.Concurrent production candidate
ec93199dc3042f6c519592d300775b1d5f6e678aadded only that non-migration deployment artifact. It idempotently creates/converges dedicatedwardnet_state_ownerandwardnet_runtimecapability roles as NOLOGIN/NOSUPERUSER/NOCREATEDB/NOCREATEROLE/NOINHERIT/NOBYPASSRLS/NOREPLICATION, strips direct runtime mutation and inner-admission authority, transfers the outer SECURITY DEFINER publication function to the state owner with temporary schema CREATE revoked immediately afterward, and grants runtime only the reads plus outer publication EXECUTE needed by the repository boundary. CI34247450830/ rust102132975534passed formatting and all preceding PostgreSQL 18.4 tests, installed and replayed the deployment artifact, then failed only because the Rust assertion expected PostgreSQL booleans asfalse/truewhile unaligned psql emitsf/t; the observed role contract itself had the intended sixteen false and three true values. Exact7167bdcd8e774a9b7f521e80765de1300e32f2aecorrected that oracle and CI34247844928/ rust102134327764reached terminal SUCCESS.The documentation-bearing
0d03523124905957a1bb0bbd8551fe0e85507b82then added the matching Unreleased CHANGELOG entry and updated the Proposed publication ADR. Concurrent review immediately advanced the same branch with hostile atomicity test282f0fec7ff16b3aa4e1e086900970e154e4f1c0; this intervening delta was adopted, not overwritten. Its hosted CI34248558975/ rust102137217073passed formatting and all preceding PostgreSQL 18.4 acceptance, then failed exactly atpostgres_deployment_role_atomicity: an injectedALTER FUNCTIONfailure stranded both capability roles and temporary state-owner schema CREATE (t:t:tinstead off:f:f). The root cause was psql autocommit across the installer statements.Exact causal repair
03af6b3c962ce7d681bd49f5a80487aa94283bc6wrapped the complete role installation in one explicitBEGIN/COMMITtransaction; hosted CI34248937286/ rust102138060537was terminal SUCCESS. Follow-up documentation commitsb1eee51598ccbbe24b200c28a9e387ce70365113and current exact5a4c510aad6a63c738fcf69656fa385e8343521bmake the Proposed ADR and Unreleased CHANGELOG code-current with the executed atomicity RED/GREEN and PostgreSQL 18 rollback semantics. Hosted CI34249592067/ rust102140309527is terminal SUCCESS on unchanged5a4c510...: formatting, all locked workspace tests including the injected PostgreSQL 18.4 mid-flight rollback regression, and strict Clippy all passed. Predecessor receipts remain history only.Acceptance
The executable PostgreSQL 18.4 contract requires idempotent replay; state owner and runtime NOLOGIN/NOSUPERUSER/NOBYPASSRLS properties; no residual state-owner schema CREATE; runtime no direct generation/publication/head mutation and no inner-admission EXECUTE; outer SECURITY DEFINER publication ownership by the state owner; successful runtime-mediated publication; denied direct runtime head mutation; denied state-owner schema DDL; unchanged last-known-good head after denied mutations; and all-or-nothing rollback of roles/grants/temporary schema authority on deterministic mid-flight installation failure.
Cluster-role installation remains a deployment operation after migrations 0001..0003. Login credentials/principals stay outside this artifact. Production PostgreSQL authority remains fail closed pending #80 repository wiring, actual deployment principal mapping, pooled tenant-context checkout/reset, migration upgrade/rollback/recovery, crash/retry, backup/restore and protected immutable release acceptance.
Keep Draft behind
#140 -> #193 -> #194 -> #196 -> #198 -> #199 -> #200 -> #207. No force update, destructive rebase, self/model approval, routine bypass, gate weakening, predecessor-result transfer, mutable foreign dependency, or no-op workflow churn.