Skip to content

Commit 1d19824

Browse files
committed
Add header extension member
1 parent 68da2d7 commit 1d19824

File tree

1 file changed

+31
-10
lines changed

1 file changed

+31
-10
lines changed

draft-ietf-httpapi-digest-fields-problem-types.md

+31-10
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ Want-Content-Digest: sha-512=3, sha-256=10
7171
"type": "https://iana.org/assignments/http-problem-types#\
7272
digest-unsupported-algorithm",
7373
"title": "hashing algorithm is not supported",
74-
"unsupported-algorithm": "foo"
74+
"unsupported-algorithm": "foo",
75+
"header": "Wand-Content-Digest"
7576
}
7677
~~~
7778

@@ -98,14 +99,15 @@ A server MAY use this problem type if it wants to communicate to the client that
9899
one of the hashing algorithms referenced in the integrity or integrity preference fields present in the request
99100
is not supported.
100101

101-
For this problem type, `unsupported-algorithm` is defined as the only extension member.
102-
It SHOULD be populated in a response using this problem type, with its value being the algorithm key of the unsupported algorithm from the request.
102+
Two problem type extension members are defined, which SHOULD be populated for all responses using this problem type:
103+
104+
- The `unsupported-algorithm` extension member identifies the unsupported algorithm from the request. Its value is the corresponding algorithm key.
105+
- The `header` extension member as defined in {{identifying-problem-causing-headers}}.
106+
103107
The response can include the corresponding integrity preference field to indicate the server's algorithm support and preference.
104108

105109
This problem type is a hint to the client about algorithm support, which the client could use to retry the request with a different, supported, algorithm.
106110

107-
Note that a request may contain more than one integrity fields or integrity preference fields.
108-
109111
Example:
110112

111113
~~~ http-message
@@ -131,7 +133,8 @@ Want-Repr-Digest: sha-512=10, sha-256=0
131133
"type": "https://iana.org/assignments/http-problem-types#\
132134
digest-unsupported-algorithm",
133135
"title": "Unsupported hashing algorithm",
134-
"unsupported-algorithm": "sha-256"
136+
"unsupported-algorithm": "sha-256",
137+
"header": "Repr-Digest"
135138
}
136139
~~~
137140
{: title="Response indicating the problem and advertising the supported algorithms"}
@@ -156,7 +159,8 @@ Content-Type: application/problem+json
156159
"type": "https://iana.org/assignments/http-problem-types#\
157160
digest-unsupported-algorithm",
158161
"title": "Unsupported hashing algorithm",
159-
"unsupported-algorithm": "sha"
162+
"unsupported-algorithm": "sha",
163+
"header": "Want-Repr-Digest"
160164
}
161165
~~~
162166
{: title="Response indicating the problem and advertising the supported algorithms"}
@@ -165,6 +169,10 @@ Content-Type: application/problem+json
165169

166170
This section defines the "https://iana.org/assignments/http-problem-types#digest-invalid-value" problem type. A server MAY use this problem type when responding to a request, whose integrity fields include a digest value, that cannot be generated by the corresponding hashing algorithm. For example, if the digest value of the `sha-512` hashing algorithm is not 64 bytes long, it cannot be a valid SHA-512 digest value and the server can skip computing the digest value. This problem type MUST NOT be used if the server is not able to parse the integrity fields according to {{Section 4.5 of STRUCTURED-FIELDS}}, for example because of a syntax error in the field value.
167171

172+
One problem type extension member is defined, which SHOULD be populated for all responses using this problem type:
173+
174+
- The `header` extension member as defined in {{identifying-problem-causing-headers}}.
175+
168176
The server SHOULD include a human-readable description why the value is considered invalid in the `title` member.
169177

170178
This problem type indicates a fault in the sender's calculation or encoding of the digest value. A retry of the same request without modification will likely not yield a successful response.
@@ -190,7 +198,8 @@ Content-Type: application/problem+json
190198
{
191199
"type": "https://iana.org/assignments/http-problem-types#\
192200
digest-invalid-value",
193-
"title": "digest value for sha-512 is not 64 bytes long"
201+
"title": "digest value for sha-512 is not 64 bytes long",
202+
"header": "Repr-Digest"
194203
}
195204
~~~
196205
{: title="Response indicating that the provided digest is too short"}
@@ -199,7 +208,12 @@ Content-Type: application/problem+json
199208

200209
This section defines the "https://iana.org/assignments/http-problem-types#digest-mismatching-value" problem type. A server MAY use this problem type when responding to a request, whose integrity fields include a digest value that does not match the digest value that the server calculated for the request content or representation.
201210

202-
Two problem type extension members are defined: the `algorithm` and `provided-digest` members. A response using this problem type SHOULD populate all members, with the value of `algorithm` being the algorithm key of the used hashing algorithm and the value of `provided-digest` being the digest value taken from the request's integrity fields. The digest value is serialized as a byte sequence as described in {{Section 4.1.8 of STRUCTURED-FIELDS}}.
211+
212+
Three problem type extension members are defined, which SHOULD be populated for all responses using this problem type:
213+
214+
- The `algorithm` extension member is the algorithm key of the used hashing algorithm.
215+
- The `provided-digest` extension member is the digest value taken from the request's integrity fields. The digest value is serialized as a byte sequence as described in {{Section 4.1.8 of STRUCTURED-FIELDS}}.
216+
- The `header` extension member as defined in {{identifying-problem-causing-headers}}.
203217

204218
The problem type intentionally does not include the digest value calculated by the server to avoid attackers abusing this information for oracle attacks.
205219

@@ -228,11 +242,18 @@ Content-Type: application/problem+json
228242
digest-mismatching-value",
229243
"title": "digest value from request does not match expected value",
230244
"algorithm": "sha-256",
231-
"provided-digest": ":RK/0qy18MlBSVnWgjwz6lZEWjP/lF5HF9bvEF8FabDg=:"
245+
"provided-digest": ":RK/0qy18MlBSVnWgjwz6lZEWjP/lF5HF9bvEF8FabDg=:",
246+
"header": "Repr-Digest"
232247
}
233248
~~~
234249
{: title="Response indicating the mismatching digests"}
235250

251+
# Identifying Problem Causing Headers
252+
253+
Requests can include multiple integrity or integrity preference fields. For example, they may use the `Content-Digest` and `Repr-Digest` fields simultaneously or express preferences for content and representation digests at the same time. To aid troubleshooting, it's useful to identify the header field, whose value caused the problem detailed in the response. For this reason, the `header` extension member is defined, which SHOULD be populated for all responses using the problem types defined in this document.
254+
255+
The `header` extension member's value is the header field name that caused the problem. Since HTTP header field names are case-insensitive and not all HTTP versions preserve their casing, the casing of extension member's value might not match the request header field name's casing.
256+
236257
# Security Considerations
237258

238259
Disclosing error details could leak information

0 commit comments

Comments
 (0)