You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Request]: transfer store records owned by an API key when the key is rotated or revoked #732
With per-record ownership (#331), operator-issued API keys have no owning user, so auth sets the request principal to apikey:<key id>. Records created through a key are owned by that key. When the key is revoked, expires or is rotated to a new key, those records become unreachable. There is no way to move them to the replacement key or to a user.
Owner decision (2026-09-25): accept key-owned records as built in #331, and track transfer as a follow-up.
Proposed behavior and alternatives
An operator command alongside urlcode-store ownerless, e.g. urlcode-store reassign --from apikey:<old> --to <principal id>, run with the server stopped (it takes the directory lock), with a dry-run report first.
Optionally, key rotation in auth (api-key-rotate) could print the reassign command for any owned collections.
Alternative: let API keys be issued on behalf of a user (issueApiKey({ownerUserId})), so the principal is the user id and records survive key rotation. That is a larger auth change and needs a decision.
User-linked API keys (auth):issueApiKey({name, scopes, quota?, userId?}) and the CLI JSON gain an optional userId, validated against an existing user. A user-linked key sets the request principal to that user's id, so owned records belong to the user and survive key rotation. It still acts within the key's scopes, not the user's session roles. Keys without userId keep today's apikey:<key id> principal (service keys). Deleting or disabling the user must disable the keys linked to them. The migration is additive (a nullable column).
Operator reassign (store):urlcode-store reassign --from <principal id> --to <principal id> [--collection name] [--dry-run], next to the ownerless commands. It runs with the server stopped (it takes the directory lock), reports counts first, and respects the per-owner limit ([Request]: per-owner record limit for owned store collections #731) or refuses if moving would exceed it.
Activity
jimhoyd commentedon Sep 25, 2026
Decision (owner, 2026-09-25): both.
issueApiKey({name, scopes, quota?, userId?})and the CLI JSON gain an optionaluserId, validated against an existing user. A user-linked key sets the request principal to that user's id, so owned records belong to the user and survive key rotation. It still acts within the key's scopes, not the user's session roles. Keys withoutuserIdkeep today'sapikey:<key id>principal (service keys). Deleting or disabling the user must disable the keys linked to them. The migration is additive (a nullable column).urlcode-store reassign --from <principal id> --to <principal id> [--collection name] [--dry-run], next to theownerlesscommands. It runs with the server stopped (it takes the directory lock), reports counts first, and respects the per-owner limit ([Request]: per-owner record limit for owned store collections #731) or refuses if moving would exceed it.Ready to implement.
Generated by Claude Code
chore(package): raise core package budgets for the ownership and auth…
feat: per-owner store limits and reassign, user-linked API keys, shar…