feat: GET /api/keys/{key_id}/status + key revocation soft-delete (musehub#223)
Audit: muse verify-commit --check-key-status always reported "unknown" because the endpoint didn't exist (404). Investigation found a deeper gap: revoke_key() hard-deleted the key row, so even with the endpoint built there would be no way to distinguish "revoked" from "never registered."
Design decision (confirmed via AskUserQuestion): add revoked_at soft-delete rather than scoping down to active/unknown-only. Fully satisfies the ticket's acceptance criteria at the cost of auditing every signature- verification query site.
Implementation: - New alembic migration 0083: revoked_at column on musehub_auth_keys, nullable, no backfill needed (NULL = active for all existing rows). - revoke_key() now sets revoked_at instead of deleting the row. - Added revoked_at IS NULL filters everywhere a key is looked up for authentication/signature verification, so a revoked key can never authenticate again (same practical behavior as hard-delete, now auditable): request_signing.py's MSign core auth path, verify_and_authenticate's login/registration fingerprint lookup and dead-identity-recovery existing_keys check, register_agent_identity's fingerprint lookup, /api/auth/challenge's is_new_key check (must agree with verify's fingerprint lookup or a revoked key's owner couldn't re-register), get_keys_for_identity (list_keys), and repair-identity-repo's "most recent key" lookup. - New GET /api/keys/{key_id}/status (public, no auth -- status is non-sensitive and callers verifying a commit may not know the signer's handle): returns {"status": "active"|"revoked"}, 404 for unregistered.
TDD: wrote tests/test_key_status.py first (6 tests: active, revoked, unknown key_id, soft-delete not hard-delete, revoked key cannot authenticate, list_keys excludes revoked). Confirmed genuine RED via muse-dev shelf save/pop isolation across all 6 touched files.
Regression: 214 passed across key-status/auth/identity/authz test files -- no regressions in any authentication path this change touches.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Semantic Changes
50 symbols
Files Changed
+2
~6
1107 in snapshot
0 comments
muse hub commit comment sha256:0ce9daa6cc1a86e370a7c023184881065b392d52dd276b224582d7b936d9644a --body "your comment"
No comments yet. Be the first to start the discussion.