Skip to content

feat(pggomtm): slim to validator-only with minimal database-token v1 (gomtm#310) - #11

Merged
codeh007 merged 3 commits into
mainfrom
slim-validator-only
Aug 17, 2026
Merged

feat(pggomtm): slim to validator-only with minimal database-token v1 (gomtm#310)#11
codeh007 merged 3 commits into
mainfrom
slim-validator-only

Conversation

@codeh007

@codeh007 codeh007 commented Aug 17, 2026

Copy link
Copy Markdown
Owner

概述

gomtm issue #310 硬切第一步(M1):mtmpg 只保留数据库内核(pggomtm.so validator),Rust SQL executor 整个删除,不做任何兼容/过渡设计。同时把 database-token 契约最小化到 v1。

契约变更(database-token v1,validator 0.3.0)

  • claims 必填且仅允许:issaudsub^[A-Za-z0-9_-]{1,64}$)、iatexp(iat+30..iat+300)、jtiscope="database"profile∈{ordinary,business_admin,database_developer};其他字段一律 deny unknown。
  • 删除旧 claims:delegation_idauth_methodauthority_versionclient_idcredential_iddb_role(及旧 db_profile);profile 即数据库角色,startup requested role 必须与 profile 精确同名。
  • system_user 身份编码改为 oauth:<issuer-host>:v1;u=<userId>;p=<profile>,彻底移除 oauth:pggomtm:v2;... 编码及其前缀常量。
  • 不变项:离线 JWKS 快照、/etc/pggomtm 双文件契约(pggomtm-validator-config/v1)、fail-closed、reason-code 脱敏闭集(24 code 字符串语义不变)、ES256/P-256/use=sig/key_ops=verify、aud≠iss、TTL 30–300s、拒绝网络/SQL/SPI。

删除清单(executor 硬切)

  • executor/ 目录(源码+测试+Dockerfile)
  • Cargo.toml 的 executor workspace 成员与孤儿 dev-dep sha2
  • .github/workflows/ci.yml 的 executor CI 步骤(executor_domain / executor_pg18 / executor_image,及 validator 内 executor 版本解析、libpq layout probe、executor runtime image)
  • .github/workflows/release.ymlexecutor-v* release 入口与 publish 内 executor 分支
  • docs/executor-runtime.md;README / MAINTAINERS / AGENTS / docs 中 executor 引用
  • 共享 PG18 harness 的 run-executor 矩阵(postgres_integration*.sh)
  • openspec:publish-rust-sql-executorrelease-host-artifacts(executor 部分)、standardize-profile-role-contract-v2 标注「被 issue-310 硬切取代」保留为历史

测试与文档

  • Rust 领域测试:新 claims 矩阵、拒绝旧字段、身份编码、TTL 边界、profile==role。
  • 真实 PG18 harness fixture:新身份编码断言(oauth:candidate.example.test:v1)+ 拒绝旧字段矩阵。
  • 版本:validator Cargo.toml0.3.0(契约变更 = 新 module+consumer 版本)。
  • 文档:README、docs/runtime-configuration.md、docs/authentication-failures.md、docs/release-and-compatibility.md 同步新契约。

CI 证据

后续 consumer 依赖(gomtm M2/M3)

  • M2(gomtm Go sql-relay)按 oauth:<issuer-host>:v1 解析 system_user。
  • M3(gomtmui 签名上移)签发最小 v1 令牌,profile 与 startup role 同名。

…(gomtm#310)

- 删除 executor 产品全部:executor/ 源码/测试/Dockerfile、根 Cargo workspace 成员、
  executor-v* release 入口与 executor CI 步骤、docs/executor-runtime.md、
  共享 PG18 harness 的 run-executor 矩阵,及 README/MAINTAINERS/AGENTS 中 executor 引用
- database-token contract 收敛为最小 v1:claims 仅 iss/aud/sub/iat/exp/jti/scope/profile
  并 deny unknown;删除 delegation_id/auth_method/authority_version/client_id/credential_id/db_role,
  profile 即数据库角色(startup role 必须与 profile 精确同名)
- system_user 身份编码改为 oauth:<issuer-host>:v1;u=<userId>;p=<profile>,
  彻底移除 oauth:pggomtm:v2;u=...;actor=...;d=...;m=...;a=...;p=... 编码及前缀常量
- validator Cargo.toml 升 0.3.0;离线 JWKS 快照、/etc/pggomtm 双文件契约、fail-closed、
  reason-code 脱敏闭集、ES256/P-256、aud!=iss、TTL 30-300s、拒绝网络/SQL/SPI 保持不变
- 更新 Rust 领域测试、PG18 harness fixture 与 final-image smoke;ABI 测试不动
- openspec 新增 slim-validator-only-database-token-v1 change,
  并标注 publish-rust-sql-executor / release-host-artifacts / standardize-profile-role-contract-v2 被硬切取代
@codeh007 codeh007 added enhancement New feature or request rust Pull requests that update rust code labels Aug 17, 2026
@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

Important

Review available on request

  • 🔍 Trigger review

Reviews should be triggered manually for repositories with fewer than 10 stars. Select Trigger review above or comment @coderabbitai review to review the latest changes. For a full review, comment @coderabbitai full review.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c4fbe055-df7b-4c44-8764-7a74c4346dd0


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codeh007
codeh007 merged commit dd44e88 into main Aug 17, 2026
4 checks passed
@codeh007
codeh007 deleted the slim-validator-only branch August 17, 2026 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request rust Pull requests that update rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants