-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UTRS Appeal transfer #779
Comments
@stwalkerster After reviewing and rethinking today, additionally, I would actually prefer a report back with the result of the appeal transfer (created, not created, potentially templated reason - not the actual text). That said, this can very much be a down-the-road request and does not have to be implemented on release. |
Understood, I'll try to factor that into the design. Bear in mind that it's possible you may get multiple notifications from ACC as it's possible for a request to be closed, reopened, and closed again. What I'll probably do is send UTRS every status update, and leave it to UTRS to decide what to do with that data. (Remember that status update does not include queue changes, it'll just be open/close with reason) What I might actually do is use the UTRS-side API as a general status reporting system so it's used for both telling you about the request ID, and updating you on the request's status. I need to think a little more about this though. I'm also going to make some more tweaks to the API definition. I want to split out |
OK, the other change I've made is to remove the validation step for the HTTP response of requests. I've also done some layout tweaks to the description above, putting some stuff in collapsible sections, and moving the diagram from an image to GitHub's native diagramming |
@stwalkerster
|
Is this for the request status response?
How does something like this sound for the token? time() . "." . base64_encode(random_bytes(24)); When it's received, split it on the |
Re-hashing #26...
Thoughts have again resurfaced about transferring UTRS requests over to ACC. UTRS could send us email, provided IP, webserver IP, UA, block info, and the generic appeal reason. The initial thoughts we've had revolve around a HTTP API between ACC and UTRS, where UTRS will transfer the relevant appeal data to ACC, ACC returns a token to UTRS, then UTRS can redirect the user back to ACC with the token for ACC to take over handling of the request.
Below is a quick sequence diagram for what I initially expect the process to look like:
The HTTP API will be secured via a HMAC-based authentication system. We'll agree some way of organising the fields and hashing them with a shared-secret key. The result will be transmitted with the request, and the recipient will perform the same calculation. If the results match, then the sender must have the same key as the recipient.
This is still a work-in-progress to figure out exactly what and how we're going to attempt this.
API details
Two APIs need to be written, one ACC's side and one on UTRS' side.
These APIs are essentially both the same design and use the same format.
ACC "data transfer" API
ACC will present an API (eg:
/internal.php/api/utrsinbound
) which will accept a JSON document. This API is to be used to receive appeal data from UTRS as the first part of the transfer process.Data Transfer API definition
The JSON document received by ACC should consist of a single object containing the following keys:nonce
utrsId
email
emailConfirmed
networkIdentity
blockInfo
queueId
int?
(nullable int)domain
enwiki
)comments
comment
is an array of objects. each object is:comment
origin
username
string?
blockInfo
is an array of objects. each object is:comment
admin
networkIdentity
should be an array of objects, with each object having the following information:ipv4
ipv6
ua
trusted
This must be delivered as a HTTP POST request, with the following HTTP headers set:
The Authorization header value must be the word
Bearer
followed by a SHA-384 HMAC of the entire body content as a string. This can be generated in PHP with thehash_hmac('sha384', $data, $key)
function. We will agree on a shared key.If the data format of the request or response body needs to change at a later date, we will bump the
X-ACC-API-Version
header as required.All other headers should be sent with the exact values shown above.
Example
ACC will then respond with a HTTP response. For example, the request above may produce the below response.
Headers:
Body:
Data Transfer API response definition
status
error
status
is "OK", then this field will be null. Otherwise, this field will contain an error message.utrsId
token
url
UTRS should check the status field is "OK", and then pass the token and/or URL back to the user. If the status field is not "OK", a relevant error message will be placed in the "error" field of the response.
UTRS request notification
UTRS will present an API which will accept a JSON document. The JSON document should consist of a single object containing the following keys:
Request status request definition
nonce
utrsId
token
accId
status
open
orclosed
closureType
This must be delivered as a HTTP POST request, with the following HTTP headers set:
See notes in the ACC section about the meaning of the headers.
Example:
UTRS will then respond with a HTTP response. For example, the request above may produce the below response.
Headers:
Body:
Request status response definition
status
error
status
is "OK", then this field will be null. Otherwise, this field will contain an error message.The text was updated successfully, but these errors were encountered: