feat: make regular api tokens revocable#1027
feat: make regular api tokens revocable#1027matmanna wants to merge 41 commits intohackclub:mainfrom
Conversation
latest changes from upstream
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
…kclub/hackatime into revokable_api_tokens
4c1f4b2 to
8e5aabd
Compare
|
hmm is it possible for me to get a @greptileai review |
8e5aabd to
f588a2e
Compare
Greptile SummaryThis PR extends the internal revocation endpoint to support revoking regular user
Confidence Score: 4/5
Sequence DiagramsequenceDiagram
participant Revoker as Revoker Service
participant RC as RevocationsController
participant DB as Database
Revoker->>RC: POST /api/internal/revoke (Bearer auth)
RC->>RC: authenticate! via secure_compare
alt Matches ADMIN_KEY_REGEX
RC->>DB: AdminApiKey.active.find_by(key)
DB-->>RC: admin_key or nil
RC->>DB: admin_key.revoke! sets revoked_at and renames
DB-->>RC: ok or raises
else Matches REGULAR_KEY_REGEX
RC->>DB: ApiKey.find_by(key)
DB-->>RC: api_key or nil
RC->>DB: api_key.update rolls uuid and renames
DB-->>RC: true or false
else No regex match
RC-->>Revoker: success false
end
alt Not found or failed
RC-->>Revoker: success false
else Succeeded
RC-->>Revoker: success true plus owner_email and key_name
end
Last reviewed commit: 2fb2aff |
|
@greptileai re-review pls? |
skyfallwastaken
left a comment
There was a problem hiding this comment.
Nice work! Left a couple comments for you to look at
Co-authored-by: Mahad Kalam <55807755+skyfallwastaken@users.noreply.github.com>
…ackatime into revokable_api_tokens
… into revokable_api_tokens
This PR will be landed prior to but alongside a corresponding one for the revoker.
This PR adds: