-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathresponse-code-reliability.bs
82 lines (62 loc) · 3.77 KB
/
response-code-reliability.bs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<pre class=metadata>
Title: Detecting the reliability of HTTP status codes
Shortname: response-code-reliability
Level: 1
Status: ED
Group: WebAppSec
Repository: w3c/webappsec-change-password-url
URL: https://w3c.github.io/webappsec-change-password-url/response-code-reliability.html
Editor: Elaine Knight, w3cid 126366, Apple Inc. https://apple.com, [email protected]
Editor: Ricky Mondello, w3cid 103933, Apple Inc. https://apple.com/, [email protected]
Editor: Theresa O'Connor, w3cid 40614, Apple Inc. https://apple.com/, [email protected]
Abstract: Defines a method for detecting the reliability of an HTTP server's response status codes.
Complain About: accidental-2119 true
Markup Shorthands: idl yes, markdown yes
</pre>
<pre class=biblio>
{
"WELL-KNOWN": {
"aliasOf": "RFC8615"
}
}
</pre>
<pre class=anchors>
text:well-known URI; type:dfn; spec:rfc8615; url:https://tools.ietf.org/html/rfc8615#section-3
</pre>
<pre class=link-defaults>
spec:url; type:interface; text:URL
</pre>
<div class=non-normative>
<h2 id=intro class=no-num>Introduction</h2>
<em>This section is non-normative.</em>
A number of specifications define [=well-known URIs=]. [[!WELL-KNOWN]]
Clients attempting to detect the presence of [=well-known URIs=] sometimes encounter misconfigured HTTP servers which respond with a 2xx <a for=response>status</a> when the resource actually doesn't exist.
This specification defines a method for discovering if an HTTP server is misconfigured in this way.
</div>
<h2 id=infra>Infrastructure</h2>
This specification depends on the Infra Standard. [[!INFRA]]
<h2 id="semantics">Detecting the reliability of HTTP status codes</h2>
We can see if a web server's [=response/statuses=] are reliable by [=/fetching=] a URL that should never result in an [=ok status=]. If the response status (after following redirects) is an [=ok status=], it's safe to conclude that the server is not configured properly.
To <dfn export>test the reliability of an origin's response status codes</dfn> given |origin|, run the following steps:
1. Let |p| be [=a new promise=].
1. If |origin| is not a [=tuple origin=], [=reject=] |p| and return it.
1. Let |status reliability queue| be the result of [=starting a new parallel queue=].
1. [=Enqueue the following steps=] to |status reliability queue|:
1. Let |url| be the result of calling {{URL(url, base)}} with url "/.well-known/resource-that-should-not-exist-whose-status-code-should-not-be-200" and base |origin|.
1. Let |request| be a new [=/request=] whose [=request/url=] is |url|, [=request/method=] is `GET`, [=request/origin=] is |origin|, [=request/mode=] is `"same-origin"`, [=request/service-workers mode=] is `"none"`, [=request/credentials mode=] is `"omit"`, [=request/cache mode=] is `"no-store"`, and [=request/redirect mode=] is `"follow"`.
1. Let |response| be the result of performing a [=/fetch=] using |request|.
1. If |response| is a [=network error=], [=reject=] |p|.
1. If |response|'s [=response/status=] is an [=ok status=], [=reject=] |p|. Otherwise, [=/resolve=] |p|.
1. Return |p|.
<h2 id="iana">IANA considerations</h2>
<h3 id="the-resource-that-should-not-exist-whose-status-code-should-not-be-200-well-known-uri">The `resource-that-should-not-exist-whose-status-code-should-not-be-200` well-known URI</h3>
This document defines the “`.well-known`” URI `resource-that-should-not-exist-whose-status-code-should-not-be-200`.
This registration will be submitted to the IESG for review, approval, and registration with IANA using the template defined in [[!WELL-KNOWN]] as follows:
: URI suffix
:: `resource-that-should-not-exist-whose-status-code-should-not-be-200`
: Change controller
:: W3C
: Specification document(s)
:: This document is the relevant specification. (See [[#semantics]])
: Related information:
:: None.