Proposal: move bot tokens to OAuth using web hooks #3660
dead-claudia
started this conversation in
General Discussion
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The idea is this: authenticated bots are normally trusted and few in number. But there's security risks in granting them app passwords, and refresh tokens can only extend the session for up to a year. Webhooks can solve that problem for most bots by shifting the root of trust to the PDS. And the few remaining ones can just use OAuth 2 and stuff like Device Authorization - 1-year sessions aren't a big deal, and if it's uptime-critical, it's critical enough to have a web service set up to push stuff to it.
The flow would look like this for each webhook:
A
using refresh token, sends{I, A}
whereI
is the user identity to server in request.I
is used by the server to look up its own shared parameters.B
using token, sends{B; KS = encrypt(K, {S; D})}
with shared secretS
, server encryption keyK
, and current dateD
to PDS in response. PDS and server now share prospective secretS
.{N; KS; encrypt(S, {N, access_token})}
with nonceN
to server in request header.N
s in request, finds the current date in decryptedKS
is at most, say, 5 minutes old, and sees thatS
is not in expiry list, server addsS
to expiry list with appropriate TTL, replaces the access token, and sends 200 response to PDS. IfS
is in the expiry list, a 200 is returned, but nothing is done. Otherwise, it returns a 403 response.Both requests may be made over plaintext HTTP or encrypted HTTPS. The initial refresh token must be sent over HTTPS, however.
Threat model
Beta Was this translation helpful? Give feedback.
All reactions