docs(breg): state that the migration role must not hold CREATE on the database in Provision PostgreSQL
维护者通常 1 天内回复
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 82/100
- Issue 类型
- 文档
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- postgresql
调研方向
阅读 docs/site/src/content/docs/operate/breg.mdx 中的 “Provision PostgreSQL” 部分,并将其中关于角色的说明与 crates/registry-breg/src/postgres/roles.rs 中的 verify_migration_role 进行对照。更新主章节,说明迁移角色不得拥有该数据库,也不得在其中持有 CREATE 权限,并添加相关的证据注释。完成标准:非空间功能设置的读者能够看到此要求,且文档记载的角色权限与强制执行的规则一致。
由索引模型根据 Issue 内容生成。
描述
Problem
docs/site/src/content/docs/operate/breg.mdx, section "Provision PostgreSQL", never says that the migration role must not hold CREATE on the database, and must not own the database (an owner holds CREATE implicitly). The main block revokes database privileges from PUBLIC only (REVOKE ALL ON DATABASE registry FROM PUBLIC;); the only revoke that names the registry roles is REVOKE CREATE ON DATABASE registry FROM PUBLIC, registry_migration, registry_runtime; inside the spatial subsection, so a reader of a non-spatial project has no reason to check it. PostgreSQL does not grant database CREATE to PUBLIC by default, so the risk is an explicit grant or ownership the administrator's own tooling adds (for example CREATE DATABASE registry OWNER registry_migration, or a hosted provider's setup script).
Where
- Docs:
docs/site/src/content/docs/operate/breg.mdx, "Provision PostgreSQL" (lines 140 to 201 on origin/main; identical onjeremi/documents). - Enforcement:
crates/registry-breg/src/postgres/roles.rs,verify_migration_role(lines 401 to 431 on origin/main). It refuses whenhas_database_privilege(current_user, current_database(), 'CREATE')is true, as it does for SUPERUSER, BYPASSRLS, CREATEDB and CREATEROLE, withRoleInvariant("migration role has database-level administrative authority"). The same function then requires the migration role to own all five managed schemas (verify_schema_owner). - It runs on every apply connection (
interlock.rs,acquire_inner, line 286), in schema preparation forbregctl test(schema.rs), and in the maintenance commands.
What goes wrong
The refusal is correct and happens before maintenance, so nothing is written. But the operator is not told why:
bregctl applyandbregctl planreportapply.migration.failedwith "requires exact-target reconciliation" and suggested actionreconcile-failed-migration(see #1381), which sends them tomigration reconcilefor a database that was never touched.bregctl testmost likely reportstest.database.unavailable("recreate the disposable database"), becauseschema_preparation_errorincrates/registry-bregctl/src/test_lifecycle.rscollapses every otherStartupErrortoTestLifecycleError::Database. I did not trace theRoleInvarianttoStartupErrormapping for this exact case.
During the 2026-10-22 root-cause investigation, the repro databases gave the migration role CREATE on the database and lacked the five managed schemas; the documented setup passed with v0.43.0.
Proposed direction
In the main "Provision PostgreSQL" text (not only the spatial block):
- One sentence: the migration role must not own the database or hold CREATE on it; it owns only the five schemas, and
testandapplyrefuse a role with database-level authority. - Optionally add
REVOKE CREATE ON DATABASE registry FROM registry_migration, registry_runtime;to the main block, so the spatial block's revoke is not the only one. - Add
crates/registry-breg/src/postgres/roles.rs, verify_migration_roleto the Evidence comment.
Notes
- Confirmed in code: the CREATE refusal, its message, where it runs, and the docs text on origin/main.
- From the triage notes, not reproduced by me: the repro databases' exact grants.
- Inferred: the
bregctl testcode for this case. - The misleading apply code is #1381; this issue is docs only.
- 主要语言
- Rust
- 星标
- 2
- 派生
- 0
- 平均合并
- 9 小时 43 分钟
- 30 天内合并 PR
- 268
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
registrystack/registry-stack 的其他 Issue
-
test(breg): postgres_startup needs the tooling feature its required-features does not declare可能已有人在做 @jeremi 于 1 天前认领。 未关闭area:breg bug
难度 2/5 1-3 小时 新手友好度 74/100
registrystack/registry-stack#2307 ·
维护者通常 1 天内回复
-
area:docs documentation
难度 2/5 1-3 小时 新手友好度 76/100
registrystack/registry-stack#2253 ·
维护者通常 1 天内回复
-
area:coordinator bug
难度 2/5 1-3 小时 新手友好度 82/100
registrystack/registry-stack#2252 ·
维护者通常 1 天内回复
-
area:release bug
难度 2/5 1-3 小时 新手友好度 74/100
registrystack/registry-stack#2248 ·
维护者通常 1 天内回复
-
area:breg documentation
难度 1/5 1-3 小时 新手友好度 88/100
registrystack/registry-stack#2233 ·
维护者通常 1 天内回复
查看 registrystack/registry-stack 的全部 Issue
相似的 Issue
-
bug: workspace access hint suggests a --subject command that fails for hyphen-leading OIDC subjects未关闭
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
type: bug
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
A-FFI C-Testing D-Straightforward S-Ready
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
-
docs priority:P3 size:XS
难度 1/5 1 小时以内 新手友好度 88/100
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复