fix: Report not-found and unauthorized from revoke_access_token #74
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
rosa/vernier!74
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/revoke-token-ownership-errors"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #62.
revoke_access_tokenreturnedOk(())when the token id did not exist or belonged to another user, and the account page flashed "Access token revoked." unconditionally — a foreign or nonexistent id reported success while any such token stayed live.Changes
RevokeTokenErrorenum (NotFound,Unauthorized,Unknown) incrates/domain/src/errors.rs, following the shape of the other owner-gated mutation errors (DeletePostError,DeleteWebmentionError).revoke_access_tokennow returnsRevokeTokenErrorinstead ofanyhow::Error: not-found and not-owned ids are reported instead of silently succeeding.From<RevokeTokenError> for AppErrorincrates/web/src/error.rsmapsNotFound→ 404 andUnauthorized→ forbidden, consistent with the sibling mappings, so the handler's?short-circuits before the success flash.NotFound; another user's token →Unauthorizedwith the token remaining live; revoking one's own token still deletes it (existing test).The
cimise task passes.