idnits 2.17.1 draft-yasskin-http-origin-signed-responses-05.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** There are 10 instances of too long lines in the document, the longest one being 38 characters in excess of 72. ** The abstract seems to contain references ([2], [1]), which it shouldn't. Please replace those with straight textual mentions of the documents in question. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (January 23, 2019) is 1920 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) -- Looks like a reference, but probably isn't: '1' on line 2035 -- Looks like a reference, but probably isn't: '2' on line 2037 -- Looks like a reference, but probably isn't: '3' on line 2039 -- Looks like a reference, but probably isn't: '4' on line 2041 -- Looks like a reference, but probably isn't: '5' on line 2043 -- Looks like a reference, but probably isn't: '100' on line 504 == Missing Reference: '-1' is mentioned on line 506, but not defined -- Looks like a reference, but probably isn't: '6' on line 2046 -- Looks like a reference, but probably isn't: '7' on line 2048 -- Looks like a reference, but probably isn't: '8' on line 2050 -- Looks like a reference, but probably isn't: '9' on line 2052 -- Looks like a reference, but probably isn't: '10' on line 2054 -- Looks like a reference, but probably isn't: '11' on line 2114 -- Looks like a reference, but probably isn't: '12' on line 2128 -- Looks like a reference, but probably isn't: '13' on line 2143 -- Looks like a reference, but probably isn't: '14' on line 2165 -- Looks like a reference, but probably isn't: '15' on line 2166 -- Looks like a reference, but probably isn't: '16' on line 2182 -- Looks like a reference, but probably isn't: '17' on line 2321 -- Looks like a reference, but probably isn't: '18' on line 2329 -- Possible downref: Non-RFC (?) normative reference: ref. 'FETCH' == Outdated reference: A later version (-08) exists of draft-ietf-cbor-cddl-06 == Outdated reference: A later version (-19) exists of draft-ietf-httpbis-header-structure-09 == Outdated reference: A later version (-06) exists of draft-ietf-httpbis-variants-04 -- Possible downref: Normative reference to a draft: ref. 'I-D.ietf-httpbis-variants' -- Possible downref: Non-RFC (?) normative reference: ref. 'POSIX' ** Obsolete normative reference: RFC 3230 (Obsoleted by RFC 9530) ** Obsolete normative reference: RFC 6962 (Obsoleted by RFC 9162) ** Obsolete normative reference: RFC 7049 (Obsoleted by RFC 8949) ** Obsolete normative reference: RFC 7230 (Obsoleted by RFC 9110, RFC 9112) ** Obsolete normative reference: RFC 7231 (Obsoleted by RFC 9110) ** Obsolete normative reference: RFC 7234 (Obsoleted by RFC 9111) ** Obsolete normative reference: RFC 7540 (Obsoleted by RFC 9113) ** Downref: Normative reference to an Informational RFC: RFC 8032 -- Possible downref: Non-RFC (?) normative reference: ref. 'URL' == Outdated reference: A later version (-12) exists of draft-cavage-http-signatures-10 == Outdated reference: A later version (-19) exists of draft-ietf-httpbis-cache-03 == Outdated reference: A later version (-06) exists of draft-ietf-httpbis-http2-secondary-certs-03 == Outdated reference: A later version (-03) exists of draft-yasskin-httpbis-origin-signed-exchanges-impl-02 == Outdated reference: A later version (-02) exists of draft-yasskin-webpackage-use-cases-01 -- Obsolete informational reference (is this intentional?): RFC 2965 (Obsoleted by RFC 6265) -- Obsolete informational reference (is this intentional?): RFC 7235 (Obsoleted by RFC 9110) -- Obsolete informational reference (is this intentional?): RFC 7615 (Obsoleted by RFC 9110) Summary: 10 errors (**), 0 flaws (~~), 10 warnings (==), 28 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group J. Yasskin 3 Internet-Draft Google 4 Intended status: Standards Track January 23, 2019 5 Expires: July 27, 2019 7 Signed HTTP Exchanges 8 draft-yasskin-http-origin-signed-responses-05 10 Abstract 12 This document specifies how a server can send an HTTP exchange--a 13 request URL, content negotiation information, and a response--with 14 signatures that vouch for that exchange's authenticity. These 15 signatures can be verified against an origin's certificate to 16 establish that the exchange is authoritative for an origin even if it 17 was transferred over a connection that isn't. The signatures can 18 also be used in other ways described in the appendices. 20 These signatures contain countermeasures against downgrade and 21 protocol-confusion attacks. 23 Note to Readers 25 Discussion of this draft takes place on the HTTP working group 26 mailing list (ietf-http-wg@w3.org), which is archived at 27 https://lists.w3.org/Archives/Public/ietf-http-wg/ [1]. 29 The source code and issues list for this draft can be found in 30 https://github.com/WICG/webpackage [2]. 32 Status of This Memo 34 This Internet-Draft is submitted in full conformance with the 35 provisions of BCP 78 and BCP 79. 37 Internet-Drafts are working documents of the Internet Engineering 38 Task Force (IETF). Note that other groups may also distribute 39 working documents as Internet-Drafts. The list of current Internet- 40 Drafts is at https://datatracker.ietf.org/drafts/current/. 42 Internet-Drafts are draft documents valid for a maximum of six months 43 and may be updated, replaced, or obsoleted by other documents at any 44 time. It is inappropriate to use Internet-Drafts as reference 45 material or to cite them other than as "work in progress." 47 This Internet-Draft will expire on July 27, 2019. 49 Copyright Notice 51 Copyright (c) 2019 IETF Trust and the persons identified as the 52 document authors. All rights reserved. 54 This document is subject to BCP 78 and the IETF Trust's Legal 55 Provisions Relating to IETF Documents 56 (https://trustee.ietf.org/license-info) in effect on the date of 57 publication of this document. Please review these documents 58 carefully, as they describe your rights and restrictions with respect 59 to this document. Code Components extracted from this document must 60 include Simplified BSD License text as described in Section 4.e of 61 the Trust Legal Provisions and are provided without warranty as 62 described in the Simplified BSD License. 64 Table of Contents 66 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4 67 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 4 68 3. Signing an exchange . . . . . . . . . . . . . . . . . . . . . 5 69 3.1. The Signature Header . . . . . . . . . . . . . . . . . . 6 70 3.1.1. Examples . . . . . . . . . . . . . . . . . . . . . . 7 71 3.1.2. Open Questions . . . . . . . . . . . . . . . . . . . 8 72 3.2. CBOR representation of exchange response headers . . . . 9 73 3.2.1. Example . . . . . . . . . . . . . . . . . . . . . . . 9 74 3.3. Loading a certificate chain . . . . . . . . . . . . . . . 10 75 3.4. Canonical CBOR serialization . . . . . . . . . . . . . . 11 76 3.5. Signature validity . . . . . . . . . . . . . . . . . . . 11 77 3.5.1. Open Questions . . . . . . . . . . . . . . . . . . . 16 78 3.6. Updating signature validity . . . . . . . . . . . . . . . 16 79 3.6.1. Examples . . . . . . . . . . . . . . . . . . . . . . 17 80 3.7. The Accept-Signature header . . . . . . . . . . . . . . . 18 81 3.7.1. Integrity identifiers . . . . . . . . . . . . . . . . 19 82 3.7.2. Key type identifiers . . . . . . . . . . . . . . . . 19 83 3.7.3. Key value identifiers . . . . . . . . . . . . . . . . 20 84 3.7.4. Examples . . . . . . . . . . . . . . . . . . . . . . 20 85 3.7.5. Open Questions . . . . . . . . . . . . . . . . . . . 21 86 4. Cross-origin trust . . . . . . . . . . . . . . . . . . . . . 21 87 4.1. Uncached header fields . . . . . . . . . . . . . . . . . 23 88 4.1.1. Stateful header fields . . . . . . . . . . . . . . . 23 89 4.2. Certificate Requirements . . . . . . . . . . . . . . . . 24 90 5. Transferring a signed exchange . . . . . . . . . . . . . . . 25 91 5.1. Same-origin response . . . . . . . . . . . . . . . . . . 25 92 5.1.1. Serialized headers for a same-origin response . . . . 26 93 5.1.2. The Signed-Headers Header . . . . . . . . . . . . . . 26 94 5.2. HTTP/2 extension for cross-origin Server Push . . . . . . 27 95 5.2.1. Indicating support for cross-origin Server Push . . . 27 96 5.2.2. NO_TRUSTED_EXCHANGE_SIGNATURE error code . . . . . . 27 97 5.2.3. Validating a cross-origin Push . . . . . . . . . . . 28 98 5.3. application/signed-exchange format . . . . . . . . . . . 29 99 5.3.1. Cross-origin trust in application/signed-exchange . . 30 100 5.3.2. Example . . . . . . . . . . . . . . . . . . . . . . . 30 101 5.3.3. Open Questions . . . . . . . . . . . . . . . . . . . 30 102 6. Security considerations . . . . . . . . . . . . . . . . . . . 31 103 6.1. Over-signing . . . . . . . . . . . . . . . . . . . . . . 31 104 6.1.1. Session fixation . . . . . . . . . . . . . . . . . . 31 105 6.1.2. Misleading content . . . . . . . . . . . . . . . . . 31 106 6.2. Off-path attackers . . . . . . . . . . . . . . . . . . . 32 107 6.3. Downgrades . . . . . . . . . . . . . . . . . . . . . . . 32 108 6.4. Signing oracles are permanent . . . . . . . . . . . . . . 32 109 6.5. Unsigned headers . . . . . . . . . . . . . . . . . . . . 32 110 6.6. application/signed-exchange . . . . . . . . . . . . . . . 33 111 6.7. Key re-use with TLS . . . . . . . . . . . . . . . . . . . 33 112 6.8. Content sniffing . . . . . . . . . . . . . . . . . . . . 34 113 7. Privacy considerations . . . . . . . . . . . . . . . . . . . 35 114 8. IANA considerations . . . . . . . . . . . . . . . . . . . . . 35 115 8.1. Signature Header Field Registration . . . . . . . . . . . 35 116 8.2. Accept-Signature Header Field Registration . . . . . . . 36 117 8.3. Signed-Headers Header Field Registration . . . . . . . . 36 118 8.4. HTTP/2 Settings . . . . . . . . . . . . . . . . . . . . . 36 119 8.5. HTTP/2 Error code . . . . . . . . . . . . . . . . . . . . 37 120 8.6. Internet Media Type application/signed-exchange . . . . . 37 121 8.7. Internet Media Type application/cert-chain+cbor . . . . . 38 122 9. References . . . . . . . . . . . . . . . . . . . . . . . . . 39 123 9.1. Normative References . . . . . . . . . . . . . . . . . . 39 124 9.2. Informative References . . . . . . . . . . . . . . . . . 41 125 9.3. URIs . . . . . . . . . . . . . . . . . . . . . . . . . . 44 126 Appendix A. Use cases . . . . . . . . . . . . . . . . . . . . . 44 127 A.1. PUSHed subresources . . . . . . . . . . . . . . . . . . . 44 128 A.2. Explicit use of a content distributor for subresources . 45 129 A.3. Subresource Integrity . . . . . . . . . . . . . . . . . . 46 130 A.4. Binary Transparency . . . . . . . . . . . . . . . . . . . 46 131 A.5. Static Analysis . . . . . . . . . . . . . . . . . . . . . 46 132 A.6. Offline websites . . . . . . . . . . . . . . . . . . . . 47 133 Appendix B. Requirements . . . . . . . . . . . . . . . . . . . . 47 134 B.1. Proof of origin . . . . . . . . . . . . . . . . . . . . . 47 135 B.1.1. Certificate constraints . . . . . . . . . . . . . . . 47 136 B.1.2. Signature constraints . . . . . . . . . . . . . . . . 47 137 B.1.3. Retrieving the certificate . . . . . . . . . . . . . 48 138 B.2. How much to sign . . . . . . . . . . . . . . . . . . . . 48 139 B.2.1. Conveying the signed headers . . . . . . . . . . . . 49 140 B.3. Response lifespan . . . . . . . . . . . . . . . . . . . . 49 141 B.3.1. Certificate revocation . . . . . . . . . . . . . . . 50 142 B.3.2. Response downgrade attacks . . . . . . . . . . . . . 50 143 B.4. Low implementation complexity . . . . . . . . . . . . . . 51 144 B.4.1. Limited choices . . . . . . . . . . . . . . . . . . . 51 145 B.4.2. Bounded-buffering integrity checking . . . . . . . . 51 146 Appendix C. Determining validity using cache control . . . . . . 51 147 C.1. Example of updating cache control . . . . . . . . . . . . 52 148 C.2. Downsides of updating cache control . . . . . . . . . . . 53 149 Appendix D. Change Log . . . . . . . . . . . . . . . . . . . . . 53 150 Appendix E. Acknowledgements . . . . . . . . . . . . . . . . . . 55 151 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 56 153 1. Introduction 155 Signed HTTP exchanges provide a way to prove the authenticity of a 156 resource in cases where the transport layer isn't sufficient. This 157 can be used in several ways: 159 o When signed by a certificate ([RFC5280]) that's trusted for an 160 origin, an exchange can be treated as authoritative for that 161 origin, even if it was transferred over a connection that isn't 162 authoritative (Section 9.1 of [RFC7230]) for that origin. See 163 Appendix A.1 and Appendix A.2. 165 o A top-level resource can use a public key to identify an expected 166 publisher for particular subresources, a system known as 167 Subresource Integrity ([SRI]). An exchange's signature provides 168 the matching proof of authorship. See Appendix A.3. 170 o A signature can vouch for the exchange in some way, for example 171 that it appears in a transparency log or that static analysis 172 indicates that it omits certain attacks. See Appendix A.4 and 173 Appendix A.5. 175 Subsequent work toward the use cases in 176 [I-D.yasskin-webpackage-use-cases] will provide a way to group signed 177 exchanges into bundles that can be transmitted and stored together, 178 but single signed exchanges are useful enough to standardize on their 179 own. 181 2. Terminology 183 Absolute URL A string for which the URL parser [3] ([URL]), when run 184 without a base URL, returns a URL rather than a failure, and for 185 which that URL has a null fragment. This is similar to the 186 absolute-URL string [4] concept defined by ([URL]) but might not 187 include exactly the same strings. 189 Author The entity that wrote the content in a particular resource. 190 This specification deals with publishers rather than authors. 192 Publisher The entity that controls the server for a particular 193 origin [RFC6454]. The publisher can get a CA to issue 194 certificates for their private keys and can run a TLS server for 195 their origin. 197 Exchange (noun) An HTTP request URL, content negotiation 198 information, and an HTTP response. This can be encoded into a 199 request message from a client with its matching response from a 200 server, into the request in a PUSH_PROMISE with its matching 201 response stream, or into the dedicated format in Section 5.3, 202 which uses [I-D.ietf-httpbis-variants] to encode the content 203 negotiation information. This is not quite the same meaning as 204 defined by Section 8 of [RFC7540], which assumes the content 205 negotiation information is embedded into HTTP request headers. 207 Intermediate An entity that fetches signed HTTP exchanges from a 208 publisher or another intermediate and forwards them to another 209 intermediate or a client. 211 Client An entity that uses a signed HTTP exchange and needs to be 212 able to prove that the publisher vouched for it as coming from its 213 claimed origin. 215 Unix time Defined by [POSIX] section 4.16 [5]. 217 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 218 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 219 "OPTIONAL" in this document are to be interpreted as described in BCP 220 14 [RFC2119] [RFC8174] when, and only when, they appear in all 221 capitals, as shown here. 223 3. Signing an exchange 225 In the response of an HTTP exchange the server MAY include a 226 "Signature" header field (Section 3.1) holding a list of one or more 227 parameterised signatures that vouch for the content of the exchange. 228 Exactly which content the signature vouches for can depend on how the 229 exchange is transferred (Section 5). 231 The client categorizes each signature as "valid" or "invalid" by 232 validating that signature with its certificate or public key and 233 other metadata against the exchange's URL, response headers, and 234 content (Section 3.5). This validity then informs higher-level 235 protocols. 237 Each signature is parameterised with information to let a client 238 fetch assurance that a signed exchange is still valid, in the face of 239 revoked certificates and newly-discovered vulnerabilities. This 240 assurance can be bundled back into the signed exchange and forwarded 241 to another client, which won't have to re-fetch this validity 242 information for some period of time. 244 3.1. The Signature Header 246 The "Signature" header field conveys a list of signatures for an 247 exchange, each one accompanied by information about how to determine 248 the authority of and refresh that signature. Each signature directly 249 signs the exchange's URL and response headers and identifies one of 250 those headers that enforces the integrity of the exchange's payload. 252 The "Signature" header is a Structured Header as defined by 253 [I-D.ietf-httpbis-header-structure]. Its value MUST be a 254 parameterised list (Section 3.4 of 255 [I-D.ietf-httpbis-header-structure]). Its ABNF is: 257 Signature = sh-param-list 259 Each parameterised identifier in the list MUST have parameters named 260 "sig", "integrity", "validity-url", "date", and "expires". Each 261 parameterised identifier MUST also have either "cert-url" and "cert- 262 sha256" parameters or an "ed25519key" parameter. This specification 263 gives no meaning to the identifier itself, which can be used as a 264 human-readable identifier for the signature (see 265 Section 3.1.2, Paragraph 1). The present parameters MUST have the 266 following values: 268 "sig" Byte sequence (Section 3.10 of 269 [I-D.ietf-httpbis-header-structure]) holding the signature of most 270 of these parameters and the exchange's URL and response headers. 272 "integrity" A string (Section 3.8 of 273 [I-D.ietf-httpbis-header-structure]) containing a "/"-separated 274 sequence of names starting with the lowercase name of the response 275 header field that guards the response payload's integrity. The 276 meaning of subsequent names depends on the response header field, 277 but for the "digest" header field, the single following name is 278 the name of the digest algorithm that guards the payload's 279 integrity. 281 "cert-url" A string (Section 3.8 of 282 [I-D.ietf-httpbis-header-structure]) containing an absolute URL 283 (Section 2) with a scheme of "https" or "data". 285 "cert-sha256" Byte sequence (Section 3.10 of 286 [I-D.ietf-httpbis-header-structure]) holding the SHA-256 hash of 287 the first certificate found at "cert-url". 289 "ed25519key" Byte sequence (Section 3.10 of 290 [I-D.ietf-httpbis-header-structure]) holding an Ed25519 public key 291 ([RFC8032]). 293 "validity-url" A string (Section 3.8 of 294 [I-D.ietf-httpbis-header-structure]) containing an absolute URL 295 (Section 2) with a scheme of "https". 297 "date" and "expires" An integer (Section 3.6 of 298 [I-D.ietf-httpbis-header-structure]) representing a Unix time. 300 The "cert-url" parameter is _not_ signed, so intermediates can update 301 it with a pointer to a cached version. 303 3.1.1. Examples 305 The following header is included in the response for an exchange with 306 effective request URI "https://example.com/resource.html". Newlines 307 are added for readability. 309 Signature: 310 sig1; 311 sig=*MEUCIQDXlI2gN3RNBlgFiuRNFpZXcDIaUpX6HIEwcZEc0cZYLAIga9DsVOMM+g5YpwEBdGW3sS+bvnmAJJiSMwhuBdqp5UY=*; 312 integrity="digest/mi-sha256"; 313 validity-url="https://example.com/resource.validity.1511128380"; 314 cert-url="https://example.com/oldcerts"; 315 cert-sha256=*W7uB969dFW3Mb5ZefPS9Tq5ZbH5iSmOILpjv2qEArmI=*; 316 date=1511128380; expires=1511733180, 317 sig2; 318 sig=*MEQCIGjZRqTRf9iKNkGFyzRMTFgwf/BrY2ZNIP/dykhUV0aYAiBTXg+8wujoT4n/W+cNgb7pGqQvIUGYZ8u8HZJ5YH26Qg=*; 319 integrity="digest/mi-sha256"; 320 validity-url="https://example.com/resource.validity.1511128380"; 321 cert-url="https://example.com/newcerts"; 322 cert-sha256=*J/lEm9kNRODdCmINbvitpvdYKNQ+YgBj99DlYp4fEXw=*; 323 date=1511128380; expires=1511733180, 324 srisig; 325 sig=*lGZVaJJM5f2oGczFlLmBdKTDL+QADza4BgeO494ggACYJOvrof6uh5OJCcwKrk7DK+LBch0jssDYPp5CLc1SDA=* 326 integrity="digest/mi-sha256"; 327 validity-url="https://example.com/resource.validity.1511128380"; 328 ed25519key=*zsSevyFsxyZHiUluVBDd4eypdRLTqyWRVOJuuKUz+A8=* 329 date=1511128380; expires=1511733180, 330 thirdpartysig; 331 sig=*MEYCIQCNxJzn6Rh2fNxsobktir8TkiaJYQFhWTuWI1i4PewQaQIhAMs2TVjc4rTshDtXbgQEOwgj2mRXALhfXPztXgPupii+=*; 332 integrity="digest/mi-sha256"; 333 validity-url="https://thirdparty.example.com/resource.validity.1511161860"; 334 cert-url="https://thirdparty.example.com/certs"; 335 cert-sha256=*UeOwUPkvxlGRTyvHcsMUN0A2oNsZbU8EUvg8A9ZAnNc=*; 336 date=1511133060; expires=1511478660, 337 There are 4 signatures: 2 from different secp256r1 certificates 338 within "https://example.com/", one using a raw ed25519 public key 339 that's also controlled by "example.com", and a fourth using a 340 secp256r1 certificate owned by "thirdparty.example.com". 342 All 4 signatures rely on the "Digest" response header with the mi- 343 sha256 digest algorithm to guard the integrity of the response 344 payload. 346 The signatures include a "validity-url" that includes the first time 347 the resource was seen. This allows multiple versions of a resource 348 at the same URL to be updated with new signatures, which allows 349 clients to avoid transferring extra data while the old versions don't 350 have known security bugs. 352 The certificates at "https://example.com/oldcerts" and 353 "https://example.com/newcerts" have "subjectAltName"s of 354 "example.com", meaning that if they and their signatures validate, 355 the exchange can be trusted as having an origin of 356 "https://example.com/". The publisher might be using two 357 certificates because their readers have disjoint sets of roots in 358 their trust stores. 360 The publisher signed with all three certificates at the same time, so 361 they share a validity range: 7 days starting at 2017-11-19 21:53 UTC. 363 The publisher then requested an additional signature from 364 "thirdparty.example.com", which did some validation or processing and 365 then signed the resource at 2017-11-19 23:11 UTC. 366 "thirdparty.example.com" only grants 4-day signatures, so clients 367 will need to re-validate more often. 369 3.1.2. Open Questions 371 [I-D.ietf-httpbis-header-structure] provides a way to parameterise 372 identifiers but not other supported types like byte sequences. If 373 the "Signature" header field is notionally a list of parameterised 374 signatures, maybe we should add a "parameterised byte sequence" type. 376 Should the cert-url and validity-url be lists so that intermediates 377 can offer a cache without losing the original URLs? Putting lists in 378 dictionary fields is more complex than 379 [I-D.ietf-httpbis-header-structure] allows, so they're single items 380 for now. 382 3.2. CBOR representation of exchange response headers 384 To sign an exchange's response headers, they need to be serialized 385 into a byte string. Since intermediaries and distributors 386 (Appendix A.2) might rearrange, add, or just reserialize headers, we 387 can't use the literal bytes of the headers as this serialization. 388 Instead, this section defines a CBOR representation that can be 389 embedded into other CBOR, canonically serialized (Section 3.4), and 390 then signed. 392 The CBOR representation of a set of response metadata and headers is 393 the CBOR ([RFC7049]) map with the following mappings: 395 o The byte string ':status' to the byte string containing the 396 response's 3-digit status code, and 398 o For each response header field, the header field's lowercase name 399 as a byte string to the header field's value as a byte string. 401 3.2.1. Example 403 Given the HTTP exchange: 405 GET / HTTP/1.1 406 Host: example.com 407 Accept: */* 409 HTTP/1.1 200 410 Content-Type: text/html 411 Digest: mi-sha256=dcRDgR2GM35DluAV13PzgnG6+pvQwPywfFvAu1UeFrs= 412 Signed-Headers: "content-type", "digest" 414 415 416 ... 418 The cbor representation consists of the following item, represented 419 using the extended diagnostic notation from [I-D.ietf-cbor-cddl] 420 appendix G: 422 { 423 'digest': 'mi-sha256=dcRDgR2GM35DluAV13PzgnG6+pvQwPywfFvAu1UeFrs=', 424 ':status': '200', 425 'content-type': 'text/html' 426 } 428 3.3. Loading a certificate chain 430 The resource at a signature's "cert-url" MUST have the "application/ 431 cert-chain+cbor" content type, MUST be canonically-encoded CBOR 432 (Section 3.4), and MUST match the following CDDL: 434 cert-chain = [ 435 "📜⛓", ; U+1F4DC U+26D3 436 + { 437 cert: bytes, 438 ? ocsp: bytes, 439 ? sct: bytes, 440 * tstr => any, 441 } 442 ] 444 The first map (second item) in the CBOR array is treated as the end- 445 entity certificate, and the client will attempt to build a path 446 ([RFC5280]) to it from a trusted root using the other certificates in 447 the chain. 449 1. Each "cert" value MUST be a DER-encoded X.509v3 certificate 450 ([RFC5280]). Other key/value pairs in the same array item define 451 properties of this certificate. 453 2. The first certificate's "ocsp" value MUST be a complete, DER- 454 encoded OCSP response for that certificate (using the ASN.1 type 455 "OCSPResponse" defined in [RFC6960]). Subsequent certificates 456 MUST NOT have an "ocsp" value. 458 3. Each certificate's "sct" value if any MUST be a 459 "SignedCertificateTimestampList" for that certificate as defined 460 by Section 3.3 of [RFC6962]. 462 Loading a "cert-url" takes a "forceFetch" flag. The client MUST: 464 1. Let "raw-chain" be the result of fetching ([FETCH]) "cert-url". 465 If "forceFetch" is _not_ set, the fetch can be fulfilled from a 466 cache using normal HTTP semantics [RFC7234]. If this fetch 467 fails, return "invalid". 469 2. Let "certificate-chain" be the array of certificates and 470 properties produced by parsing "raw-chain" using the CDDL above. 471 If any of the requirements above aren't satisfied, return 472 "invalid". Note that this validation requirement might be 473 impractical to completely achieve due to certificate validation 474 implementations that don't enforce DER encoding or other standard 475 constraints. 477 3. Return "certificate-chain". 479 3.4. Canonical CBOR serialization 481 Within this specification, the canonical serialization of a CBOR item 482 uses the following rules derived from Section 3.9 of [RFC7049] with 483 erratum 4964 applied: 485 o Integers and the lengths of arrays, maps, and strings MUST use the 486 smallest possible encoding. 488 o Items MUST NOT be encoded with indefinite length. 490 o The keys in every map MUST be sorted in the bytewise lexicographic 491 order of their canonical encodings. For example, the following 492 keys are correctly sorted: 494 1. 10, encoded as 0A. 496 2. 100, encoded as 18 64. 498 3. -1, encoded as 20. 500 4. "z", encoded as 61 7A. 502 5. "aa", encoded as 62 61 61. 504 6. [100], encoded as 81 18 64. 506 7. [-1], encoded as 81 20. 508 8. false, encoded as F4. 510 Note: this specification does not use floating point, tags, or other 511 more complex data types, so it doesn't need rules to canonicalize 512 those. 514 3.5. Signature validity 516 The client MUST parse the "Signature" header field as the 517 parameterised list (Section 4.2.5 of 518 [I-D.ietf-httpbis-header-structure]) described in Section 3.1. If an 519 error is thrown during this parsing or any of the requirements 520 described there aren't satisfied, the exchange has no valid 521 signatures. Otherwise, each member of this list represents a 522 signature with parameters. 524 The client MUST use the following algorithm to determine whether each 525 signature with parameters is invalid or potentially-valid for an 526 exchange's 528 o "requestUrl", a byte sequence that can be parsed into the 529 exchange's effective request URI (Section 5.5 of [RFC7230]), 531 o "responseHeaders", a byte sequence holding the canonical 532 serialization (Section 3.4) of the CBOR representation 533 (Section 3.2) of the exchange's response metadata and headers, and 535 o "payload", a stream of bytes constituting the exchange's payload 536 body (Section 3.3 of [RFC7230]). Note that the payload body is 537 the message body with any transfer encodings removed. 539 Potentially-valid results include: 541 o The signed headers of the exchange so that higher-level protocols 542 can avoid relying on unsigned headers, and 544 o Either a certificate chain or a public key so that a higher-level 545 protocol can determine whether it's actually valid. 547 This algorithm accepts a "forceFetch" flag that avoids the cache when 548 fetching URLs. A client that determines that a potentially-valid 549 certificate chain is actually invalid due to an expired OCSP response 550 MAY retry with "forceFetch" set to retrieve an updated OCSP from the 551 original server. 553 1. Let: 555 * "signature" be the signature (byte sequence in the 556 parameterised identifier's "sig" parameter). 558 * "integrity" be the signature's "integrity" parameter. 560 * "validity-url" be the signature's "validity-url" parameter. 562 * "cert-url" be the signature's "cert-url" parameter, if any. 564 * "cert-sha256" be the signature's "cert-sha256" parameter, if 565 any. 567 * "ed25519key" be the signature's "ed25519key" parameter, if 568 any. 570 * "date" be the signature's "date" parameter, interpreted as a 571 Unix time. 573 * "expires" be the signature's "expires" parameter, interpreted 574 as a Unix time. 576 2. Set "publicKey" and "signing-alg" depending on which key fields 577 are present: 579 1. If "cert-url" is present: 581 1. Let "certificate-chain" be the result of loading the 582 certificate chain at "cert-url" passing the "forceFetch" 583 flag (Section 3.3). If this returns "invalid", return 584 "invalid". 586 2. Let "main-certificate" be the first certificate in 587 "certificate-chain". 589 3. Set "publicKey" to "main-certificate"'s public key. 591 4. If "publicKey" is an RSA key, return "invalid". 593 5. If "publicKey" is a key using the secp256r1 elliptic 594 curve, set "signing-alg" to ecdsa_secp256r1_sha256 as 595 defined in Section 4.2.3 of [RFC8446]. 597 6. Otherwise, either return "invalid" or set "signing-alg" 598 to a non-legacy signing algorithm defined by TLS 1.3 or 599 later ([RFC8446]). This choice MUST depend only on 600 "publicKey"'s type and not on any other context. 602 2. If "ed25519key" is present, set "publicKey" to "ed25519key" 603 and "signing-alg" to ed25519, as defined by [RFC8032] 605 3. If "expires" is more than 7 days (604800 seconds) after "date", 606 return "invalid". 608 4. If the current time is before "date" or after "expires", return 609 "invalid". 611 5. Let "message" be the concatenation of the following byte 612 strings. This matches the [RFC8446] format to avoid cross- 613 protocol attacks if anyone uses the same key in a TLS 614 certificate and an exchange-signing certificate. 616 1. A string that consists of octet 32 (0x20) repeated 64 times. 618 2. A context string: the ASCII encoding of "HTTP Exchange 1". 620 Note: RFC EDITOR PLEASE DELETE THIS NOTE; The implementation 621 of the final RFC MUST use this context string, but 622 implementations of drafts MUST NOT use it and MUST use 623 another draft-specific string beginning with "HTTP Exchange 624 1 " instead. This ensures that signers can predict how 625 their signatures will be used. 627 3. A single 0 byte which serves as a separator. 629 4. If "cert-sha256" is set, a byte holding the value 32 630 followed by the 32 bytes of the value of "cert-sha256". 631 Otherwise a 0 byte. 633 5. The 8-byte big-endian encoding of the length in bytes of 634 "validity-url", followed by the bytes of "validity-url". 636 6. The 8-byte big-endian encoding of "date". 638 7. The 8-byte big-endian encoding of "expires". 640 8. The 8-byte big-endian encoding of the length in bytes of 641 "requestUrl", followed by the bytes of "requestUrl". 643 9. The 8-byte big-endian encoding of the length in bytes of 644 "responseHeaders", followed by the bytes of 645 "responseHeaders". 647 6. If "cert-url" is present and the SHA-256 hash of "main- 648 certificate"'s "cert_data" is not equal to "cert-sha256" (whose 649 presence was checked when the "Signature" header field was 650 parsed), return "invalid". 652 Note that this intentionally differs from TLS 1.3, which signs 653 the entire certificate chain in its Certificate Verify 654 (Section 4.4.3 of [RFC8446]), in order to allow updating the 655 stapled OCSP response without updating signatures at the same 656 time. 658 7. If "signature" is not a valid signature of "message" by 659 "publicKey" using "signing-alg", return "invalid". 661 8. If "headers", interpreted according to Section 3.2, does not 662 contain a "Content-Type" response header field (Section 3.1.1.5 663 of [RFC7231]), return "invalid". 665 Clients MUST interpret the signed payload as this specified 666 media type instead of trying to sniff a media type from the 667 bytes of the payload, for example by attaching an "X-Content- 668 Type-Options: nosniff" header field ([FETCH]) to the extracted 669 response. 671 9. If "integrity" names a header field and parameter that is not 672 present in "responseHeaders" or which the client cannot use to 673 check the integrity of "payload" (for example, the header field 674 is new and hasn't been implemented yet), then return "invalid". 675 If the selected header field provides integrity guarantees 676 weaker than SHA-256, return "invalid". If validating integrity 677 using the selected header field requires the client to process 678 records larger than 16384 bytes, return "invalid". Clients MUST 679 implement at least the "Digest" header field with its "mi- 680 sha256" digest algorithm (Section 3 of [I-D.thomson-http-mice]). 682 Note: RFC EDITOR PLEASE DELETE THIS NOTE; Implementations of 683 drafts of this RFC MUST recognize the draft spelling of the 684 content encoding and digest algorithm specified by 685 [I-D.thomson-http-mice] until that draft is published as an RFC. 686 For example, implementations of draft-thomson-http-mice-03 would 687 use "mi-sha256-03" and MUST NOT use "mi-sha256" itself. This 688 ensures that final implementations don't need to handle 689 compatibility with implementations of early drafts of that 690 content encoding. 692 If "payload" doesn't match the integrity information in the 693 header described by "integrity", return "invalid". 695 10. Return "potentially-valid" with whichever is present of 696 "certificate-chain" or "ed25519key". 698 Note that the above algorithm can determine that an exchange's 699 headers are potentially-valid before the exchange's payload is 700 received. Similarly, if "integrity" identifies a header field and 701 parameter like "Digest:mi-sha256" ([I-D.thomson-http-mice]) that can 702 incrementally validate the payload, early parts of the payload can be 703 determined to be potentially-valid before later parts of the payload. 704 Higher-level protocols MAY process parts of the exchange that have 705 been determined to be potentially-valid as soon as that determination 706 is made but MUST NOT process parts of the exchange that are not yet 707 potentially-valid. Similarly, as the higher-level protocol 708 determines that parts of the exchange are actually valid, the client 709 MAY process those parts of the exchange and MUST wait to process 710 other parts of the exchange until they too are determined to be 711 valid. 713 3.5.1. Open Questions 715 Should the signed message use the TLS format (with an initial 64 716 spaces) even though these certificates can't be used in TLS servers? 718 3.6. Updating signature validity 720 Both OCSP responses and signatures are designed to expire a short 721 time after they're signed, so that revoked certificates and signed 722 exchanges with known vulnerabilities are distrusted promptly. 724 This specification provides no way to update OCSP responses by 725 themselves. Instead, clients need to re-fetch the "cert-url" 726 (Section 3.5, Paragraph 6) to get a chain including a newer OCSP 727 response. 729 The "validity-url" parameter (Paragraph 6) of the signatures provides 730 a way to fetch new signatures or learn where to fetch a complete 731 updated exchange. 733 Each version of a signed exchange SHOULD have its own validity URLs, 734 since each version needs different signatures and becomes obsolete at 735 different times. 737 The resource at a "validity-url" is "validity data", a CBOR map 738 matching the following CDDL ([I-D.ietf-cbor-cddl]): 740 validity = { 741 ? signatures: [ + bytes ] 742 ? update: { 743 ? size: uint, 744 } 745 ] 747 The elements of the "signatures" array are parameterised identifiers 748 (Section 4.2.6 of [I-D.ietf-httpbis-header-structure]) meant to 749 replace the signatures within the "Signature" header field pointing 750 to this validity data. If the signed exchange contains a bug severe 751 enough that clients need to stop using the content, the "signatures" 752 array MUST NOT be present. 754 If the the "update" map is present, that indicates that a new version 755 of the signed exchange is available at its effective request URI 756 (Section 5.5 of [RFC7230]) and can give an estimate of the size of 757 the updated exchange ("update.size"). If the signed exchange is 758 currently the most recent version, the "update" SHOULD NOT be 759 present. 761 If both the "signatures" and "update" fields are present, clients can 762 use the estimated size to decide whether to update the whole resource 763 or just its signatures. 765 3.6.1. Examples 767 For example, say a signed exchange whose URL is "https://example.com/ 768 resource" has the following "Signature" header field (with line 769 breaks included and irrelevant fields omitted for ease of reading). 771 Signature: 772 sig1; 773 sig=*MEUCIQ...*; 774 ... 775 validity-url="https://example.com/resource.validity.1511157180"; 776 cert-url="https://example.com/oldcerts"; 777 date=1511128380; expires=1511733180, 778 sig2; 779 sig=*MEQCIG...*; 780 ... 781 validity-url="https://example.com/resource.validity.1511157180"; 782 cert-url="https://example.com/newcerts"; 783 date=1511128380; expires=1511733180, 784 thirdpartysig; 785 sig=*MEYCIQ...*; 786 ... 787 validity-url="https://thirdparty.example.com/resource.validity.1511161860"; 788 cert-url="https://thirdparty.example.com/certs"; 789 date=1511478660; expires=1511824260 791 At 2017-11-27 11:02 UTC, "sig1" and "sig2" have expired, but 792 "thirdpartysig" doesn't exipire until 23:11 that night, so the client 793 needs to fetch "https://example.com/resource.validity.1511157180" 794 (the "validity-url" of "sig1" and "sig2") if it wishes to update 795 those signatures. This URL might contain: 797 { 798 "signatures": [ 799 'sig1; ' 800 'sig=*MEQCIC/I9Q+7BZFP6cSDsWx43pBAL0ujTbON/+7RwKVk+ba5AiB3FSFLZqpzmDJ0NumNwN04pqgJZE99fcK86UjkPbj4jw==*; ' 801 'validity-url="https://example.com/resource.validity.1511157180"; ' 802 'integrity="digest/mi-sha256"; ' 803 'cert-url="https://example.com/newcerts"; ' 804 'cert-sha256=*J/lEm9kNRODdCmINbvitpvdYKNQ+YgBj99DlYp4fEXw=*; ' 805 'date=1511733180; expires=1512337980' 806 ], 807 "update": { 808 "size": 5557452 809 } 810 } 812 This indicates that the client could fetch a newer version at 813 "https://example.com/resource" (the original URL of the exchange), or 814 that the validity period of the old version can be extended by 815 replacing the first two of the original signatures (the ones with a 816 validity-url of "https://example.com/resource.validity.1511157180") 817 with the single new signature provided. (This might happen at the 818 end of a migration to a new root certificate.) The signatures of the 819 updated signed exchange would be: 821 Signature: 822 sig1; 823 sig=*MEQCIC...*; 824 ... 825 validity-url="https://example.com/resource.validity.1511157180"; 826 cert-url="https://example.com/newcerts"; 827 date=1511733180; expires=1512337980, 828 thirdpartysig; 829 sig=*MEYCIQ...*; 830 ... 831 validity-url="https://thirdparty.example.com/resource.validity.1511161860"; 832 cert-url="https://thirdparty.example.com/certs"; 833 date=1511478660; expires=1511824260 835 "https://example.com/resource.validity.1511157180" could also expand 836 the set of signatures if its "signatures" array contained more than 2 837 elements. 839 3.7. The Accept-Signature header 841 "Signature" header fields cost on the order of 300 bytes for ECDSA 842 signatures, so servers might prefer to avoid sending them to clients 843 that don't intend to use them. A client can send the "Accept- 844 Signature" header field to indicate that it does intend to take 845 advantage of any available signatures and to indicate what kinds of 846 signatures it supports. 848 When a server receives an "Accept-Signature" header field in a client 849 request, it SHOULD reply with any available "Signature" header fields 850 for its response that the "Accept-Signature" header field indicates 851 the client supports. However, if the "Accept-Signature" value 852 violates a requirement in this section, the server MUST behave as if 853 it hadn't received any "Accept-Signature" header at all. 855 The "Accept-Signature" header field is a Structured Header as defined 856 by [I-D.ietf-httpbis-header-structure]. Its value MUST be a 857 parameterised list (Section 3.4 of 858 [I-D.ietf-httpbis-header-structure]). Its ABNF is: 860 Accept-Signature = sh-param-list 862 The order of identifiers in the "Accept-Signature" list is not 863 significant. Identifiers, ignoring any initial "-" character, MUST 864 NOT be duplicated. 866 Each identifier in the "Accept-Signature" header field's value 867 indicates that a feature of the "Signature" header field 868 (Section 3.1) is supported. If the identifier begins with a "-" 869 character, it instead indicates that the feature named by the rest of 870 the identifier is not supported. Unknown identifiers and parameters 871 MUST be ignored because new identifiers and new parameters on 872 existing identifiers may be defined by future specifications. 874 3.7.1. Integrity identifiers 876 Identifiers starting with "digest/" indicate that the client supports 877 the "Digest" header field ({{!RFC3230) with the parameter from the 878 HTTP Digest Algorithm Values Registry [6] registry named in lower- 879 case by the rest of the identifier. For example, "digest/mi-blake2" 880 indicates support for Merkle integrity with the as-yet-unspecified 881 mi-blake2 parameter, and "-digest/mi-sha256" indicates non-support 882 for Merkle integrity with the mi-sha256 content encoding. 884 If the "Accept-Signature" header field is present, servers SHOULD 885 assume support for "digest/mi-sha256" unless the header field states 886 otherwise. 888 3.7.2. Key type identifiers 890 Identifiers starting with "ecdsa/" indicate that the client supports 891 certificates holding ECDSA public keys on the curve named in lower- 892 case by the rest of the identifier. 894 If the "Accept-Signature" header field is present, servers SHOULD 895 assume support for "ecdsa/secp256r1" unless the header field states 896 otherwise. 898 3.7.3. Key value identifiers 900 The "ed25519key" identifier has parameters indicating the public keys 901 that will be used to validate the returned signature. Each 902 parameter's name is re-interpreted as a byte sequence (Section 3.10 903 of [I-D.ietf-httpbis-header-structure]) encoding a prefix of the 904 public key. For example, if the client will validate signatures 905 using the public key whose base64 encoding is 906 "11qYAYKxCrfVS/7TyWQHOg7hcvPapiMlrwIaaPcHURo=", valid "Accept- 907 Signature" header fields include: 909 Accept-Signature: ..., ed25519key; *11qYAYKxCrfVS/7TyWQHOg7hcvPapiMlrwIaaPcHURo=* 910 Accept-Signature: ..., ed25519key; *11qYAYKxCrfVS/7TyWQHOg==* 911 Accept-Signature: ..., ed25519key; *11qYAQ==* 912 Accept-Signature: ..., ed25519key; ** 914 but not 916 Accept-Signature: ..., ed25519key; *11qYA===* 918 because 5 bytes isn't a valid length for encoded base64, and not 920 Accept-Signature: ..., ed25519key; 11qYAQ 922 because it doesn't start or end with the "*"s that indicate a byte 923 sequence. 925 Note that "ed25519key; **" is an empty prefix, which matches all 926 public keys, so it's useful in subresource integrity (Appendix A.3) 927 cases like "" where the public 928 key isn't known until the matching "