Closed
Bug 783598
Opened 13 years ago
Closed 11 years ago
Make conditions required response easier to detect
Categories
(Cloud Services Graveyard :: Server: Token, defect)
Cloud Services Graveyard
Server: Token
Tracking
(Not tracked)
VERIFIED
WONTFIX
People
(Reporter: gps, Unassigned)
References
Details
(Whiteboard: [qa+])
The current "conditions required" HTTP response looks like:
200 OK
Content-Type: application/json
{"status": 403,
"errors": [{"description": "Need to accept conditions",
"location": "body",
"name": ""}],
"urls": {"tos": "http://example.com"}
}
The heuristic for clients to detect this involves 3 steps:
1) Status == 403
2) Content-Type is application/json
3) JSON body contains "urls" field
One issue is the generic "urls". At the least I think this should be "conditions_urls" or similar. The reason is I can see some other error handler recycling "urls" for its own use (it is generic, after all). That would throw off clients.
Secondly, I don't like that the token server response message type is being determined by the presence of a field specific to that type. In other words, we are looking for traits to identify response message types instead of looking at a messageType field, different media type, other response header, etc. If we did this, my concern about "urls" would go away.
While I have these concerns for all HTTP APIs, I am more concerned about it for 4xx and 5xx status codes. From my experience, misconfigured or misbehaving servers often will generate their own 4xx and 5xx response messages. In the absence of a clear and identifying property of the response, it is all too easy for clients to confuse actual token server responses with those generated by intermediate HTTP agents. This will cause client bugs.
So, what I guess I'm asking for is something in the HTTP response that says without a doubt that the "conditions required" payload is actually that.
Updated•13 years ago
|
Whiteboard: [qa+]
Comment 1•13 years ago
|
||
I propose something like the following:
403 Forbidden
Content-Type: application/json
{"status": 403,
"errors": [{"description": "Need to accept conditions",
"location": "header",
"name": "X-Conditions-Accepted",
"error_code": 42,
"condition_urls": {"tos": "http//example.com},
}],
}
Key changes:
* The location of the error is a specific header, not "body", so set the fields on
the error object to reflect that.
* The "urls" field belongs to one specific error, so it should live inside the specific
error object rather than at the top level. Also renamed, although I think that's less
of an issue after moving it.
* Added an "error_code" field to the error object. This is not strictly necessary in
this case because the error already identifies the specific header at fault. But for
other cases it may be useful for machines to distinguish between e.g. "the header was
missing" and "the header was malformed".
Thoughts?
Reporter | ||
Comment 2•13 years ago
|
||
+1
Comment 3•13 years ago
|
||
+1 for this as well.
The error_code thing should go in a different issue IMO.
Assignee: nobody → alexis
Status: NEW → ASSIGNED
Comment 4•13 years ago
|
||
This should be handled by https://github.com/mozilla-services/cornice/pull/65 and https://github.com/mozilla-services/tokenserver/pull/13
Ryan can you review this?
Comment 5•13 years ago
|
||
r+
Comment 6•13 years ago
|
||
I have filed Bug 786523 to track the addition of an error_code field.
Comment 7•13 years ago
|
||
These were committed in relevant repos, closing out this bug.
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Comment 8•12 years ago
|
||
I am tentatively re-opening this in light of Bug 792674.
Comment 9•11 years ago
|
||
Linking to sync+fxa bugtree for consideration, although I suspect we'll triage it back out in short order.
Blocks: 956217
Comment 10•11 years ago
|
||
conditions-accepted was removed from tokenserver 1.0 spec, unblocking the metabug
No longer blocks: 956217
Updated•11 years ago
|
Assignee: alexis+bugs → nobody
Comment 11•11 years ago
|
||
conditions-required is no longer required, I think we can just delete this.
Status: REOPENED → RESOLVED
Closed: 13 years ago → 11 years ago
Resolution: --- → WONTFIX
Updated•2 years ago
|
Product: Cloud Services → Cloud Services Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•