Repository navigation
feat: store authors by the platform-signed principal - #11
Merged
Merged
Conversation
reoring
marked this pull request as ready for review
November 23, 2026 02:29
- Pin appserver-go v0.8.0 and resolve/store authors by Identity.Access.Principal (u_…); public author IDs and references unchanged. - 002_author_principal.sql adds authors.principal; Open backfills existing authors from the verified historical issuer (MEMO_LEGACY_OIDC_ISSUER) with the exact #7087 derivation, then enforces NOT NULL. Legacy subject retained for rollback. - A missing signed principal (pre-#7087 Platform API) stays a diagnostic 503; no fallback to subject.
v0.8.0 added principal and groupGrants to identity.AppAccess; the diagnostic response embedded the whole struct, so the new signed facts leaked into it and the exact-JSON test failed. whoami now serializes only declared/accepted, as the surrounding comment already promised.
reoring
force-pushed
the
feat/principal-author-key
branch
from
November 23, 2026 02:34
50dc7a3 to
1ad3593
Compare
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.
Summary
github.com/appthrust/appserver-go v0.8.0, the published tag at78866523da5289d828f0ba13d325d31f590c6f68containing feat: expose signed principal and group grants appserver-go#10. No temporaryreplaceor pseudo-version remains.Identity.Access.Principal; keep public author ULIDs and article/like/follow references stable.subjectvalues for rollback; new authors store only the signed principal.Merge/deployment prerequisites
Both prerequisites are mandatory:
dev-0271704de697delivery is insufficient).78866523da5289d828f0ba13d325d31f590c6f68.Memo is recorded as running only on ink, at
https://memo.pj-eee7fa8eabbc.appthrust.ink(pj-eee7fa8eabbc/memo). Nexusfeatures/security/permission/app-authorization.mdsection 15.4 (2026-11-13) records it as absent from Craftsman and Cloud. These are deployment records, not a new live observation; current live inventory is [未確認]. Ink's platform prerequisite is already satisfied, and the SDK tag prerequisite has now been satisfied too. No cluster was accessed or changed.This remains a draft preparation PR: do not merge, publish Memo, or deploy as part of this task. Platform/SDK upgrades alone must not automatically roll out this app update. Deployment additionally requires the verified historical issuer, a backup, and a maintenance window.
Migration
authors.subjectvalues. SetMEMO_LEGACY_OIDC_ISSUERto that exact value. The old schema did not retain issuer; do not infer it from the current URL or email. Mixed/unknown histories need a reviewed per-author crosswalk before rollout.002_author_principal.sqladds uniqueauthors.principaland makes the retained legacysubjectnullable. Before serving traffic,store.Open(ctx, dsn, legacyIssuer)locks the authors table, backfills missing principals atomically, and makes the new column NOT NULL. An absent historical issuer with existing unmigrated rows fails closed and leaves the app unavailable.Encoding:
"u_" + base64url_no_padding(sha256(decimal_UTF8_byte_length(issuer) + ":" + issuer + subject)). There is no extra delimiter, trimming, or normalization. The SQL uses built-in PostgreSQLsha256, not an extension.Rollback
authors.principal, restoreauthors.subject NOT NULL, and remove only002_author_principal.sqlfrommemo_schema_migrations. Restart the recorded old image. IDs and relationships remain intact.Full operator instructions: README, “Signed author keys: upgrade and rollback”.
Verification
All commands were wrapped with
~/.codex/skills/serialize-vm-tests/scripts/serialize-vm-tests --:go build ./...— PASS (exit 0).go vet ./cmd/server ./cmd/server/internal/api ./cmd/server/internal/store— PASS (exit 0).go test ./cmd/server ./cmd/server/internal/api ./cmd/server/internal/store -count=1 -v— PASS (exit 0), including real PostgreSQL migrations and the real SDK OIDC/exchange/signature path. No integration tests skipped.For the test command,
BUILTIN_APPSERVER_TEST_DATABASE_URLpointed only at a task-owned local PostgreSQL server via a Unix socket under.tmp/pg-socket; per-test schemas were isolated and cleaned. The local server was stopped and its data directory removed after testing.Coverage includes old-platform diagnostic 503 before database access, nil-exchange rejection, signed-principal-only new writes, unchanged ownership/admin and social rules, preserved Directory names, repeated migration, unknown issuer rejection, missing-subject atomic rejection, and a different issuer not claiming an existing author.
The migration test computes expected values with the exact Go reference expression (not a hand-written digest), then compares actual PostgreSQL migration output for 10 issuer/subject fixtures, including UTF-8 byte lengths and subject whitespace. One observed fixture:
The initial pre-fix missing-principal test attempt timed out after 180 seconds waiting for an unrelated exclusive VM-test holder; it did not execute and is not claimed as a red result. The final full focused run executed successfully.