Re: [httpapi] Last Call: <draft-ietf-httpapi-rfc7807bis-04.txt> (Problem Details for HTTP APIs) to Proposed Standard

Ben Bucksch <news@bucksch.org> Mon, 07 November 2022 13:19 UTC

Return-Path: <news@bucksch.org>
X-Original-To: httpapi@ietfa.amsl.com
Delivered-To: httpapi@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 9D1D9C1524CD for <httpapi@ietfa.amsl.com>; Mon, 7 Nov 2022 05:19:16 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.907
X-Spam-Level:
X-Spam-Status: No, score=-6.907 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_HI=-5, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_BLOCKED=0.001, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id A301WMLklomw for <httpapi@ietfa.amsl.com>; Mon, 7 Nov 2022 05:19:12 -0800 (PST)
Received: from mail.server.beonex.com (mail.server.beonex.com [144.76.227.234]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 7B124C1524D7 for <httpapi@ietf.org>; Mon, 7 Nov 2022 05:19:10 -0800 (PST)
Content-Type: multipart/alternative; boundary="------------Y0wlbdk5Y46jPzJVMLvDiBf6"
Message-ID: <f79bdc4e-437f-5527-71e1-569d78097299@bucksch.org>
Date: Mon, 07 Nov 2022 14:19:03 +0100
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0 Thunderbird/102.2.2
From: Ben Bucksch <news@bucksch.org>
To: httpapi@ietf.org
References: <166627224606.10641.5749459667185024591@ietfa.amsl.com>
Content-Language: en-US
Organization: Me, myself and I
In-Reply-To: <166627224606.10641.5749459667185024591@ietfa.amsl.com>
Archived-At: <https://mailarchive.ietf.org/arch/msg/httpapi/-7SbWco4ChA1I94Z42kIvn5zsaI>
Subject: Re: [httpapi] Last Call: <draft-ietf-httpapi-rfc7807bis-04.txt> (Problem Details for HTTP APIs) to Proposed Standard
X-BeenThere: httpapi@ietf.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: Building Blocks for HTTP APIs <httpapi.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/httpapi>, <mailto:httpapi-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/httpapi/>
List-Post: <mailto:httpapi@ietf.org>
List-Help: <mailto:httpapi-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/httpapi>, <mailto:httpapi-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 07 Nov 2022 13:19:16 -0000

Hi Mark, hi all,

Thank you for authoring this spec. It is addressing a real need: Error 
messages are a serious problem point in most HTTP based APIs. Every API 
author creates their own error spec, with slightly different semantics, 
because the HTTP status does not adequately cover it. It's good to have 
error reporting specified consistently and sanely.

Sorry for raising this at the "last call", but I noticed a few issues 
that could pose problems in real world usage, and would be difficult to 
fix in hindsight:

1. Uncertainty created by the relative URIs used as IDs for problem 
"type" field

You are specifying problem "type" IDs as URIs. That's a good idea, it 
allows for scoping and teams to assign their own error IDs. However, 
allowing relative URIs creates significant real world problems:
* Most of the time, parsing of the errors will be adhoc. The chances 
that the client does not resolve the relative URLs into absolute URLs is 
high. This creates potential for conflict and/or multiple IDs.
* APIs may be available on different endpoints (URLs). Depending on the 
endpoint, that would create different IDs. That is not desirable. For a 
realistic example, a dev uses a small npm lib to parse Problem errors, 
and the lib correctly resolves the relative URI in "type" into absolute 
URIs. The dev treats errors based on these these types with absolute 
URIs. He and QA are testing against a dev or staging server and they do 
not know or realize that the production server will have a different API 
endpoint URL. So, it works in testing, but fails in production. Using 
relative URI for "type" is setting up for such a problem.
I would recommend to either 1) mandate absolute URIs, or alternatively 
to 2) define the ID as free-form generic string. In the latter case, 
relative URLs would not be resolved, but everybody would use them as 
strings - which is what likely happens in reality anyways.

I recommend to
replace: ```When "type" contains a relative URI, it is resolved relative 
to the document's base URI, as per {{URI, Section 5}}. However, using 
relative URIs can cause confusion, and they might not be handled 
correctly by all implementations.``` and the following paragraph with 
the example and the recommendation `it is RECOMMENDED that absolute URIs 
be used`,
with: ```Relative URIs are not allowed. That means that "type" MUST NOT 
be a number or simple string like "out-of-memory".```

2. Avoid a default "type"

Remove: `When this member is not present, its value is assumed to be 
"about:blank".`
Rationale: This would *require* (!) conforming clients to lump all 
non-typed errors together into one error. Better to leave this unspecced 
and allow the client to make sense of it.

3. Translation

Please clarify which party is expected to translate the message. Leaving 
this undefined can lead to problems in practice.
a) If both client and server try to translate, it can cause chaos.
b) Generic usage of a third party server API - which is the goal of an 
IETF spec - means that the client cannot possibly know all the error types.
c) Even if all error types were known, all clients would need to 
translate the same strings
d) The server may need to add new error types at any time.
(See also next point 4 for importance.)
Current spec: "title" is defined as `a short, human-readable summary of 
the problem type`, and "detail" is defined as `human-readable 
explanation specific to this occurrence of the problem` and it /allow/s 
localization of "title" by stating `it SHOULD NOT change..., except for 
localization`, but it's only an allowance.
Implication: Therefore, a client cannot rely on the error messages to be 
useful for the user. Given that for many errors, the only possible 
recourse is to show the error to the end user, translation is a real 
world problem. The client needs to rely on the error string to be useful 
for the user.
Recommendation:
`If error strings are translated at all, it is expected that the 
localization happens on the server side and the server sends localized 
strings for "type", "detail" and custom fields, based on the 
"Accept-Language:" HTTP header sent by the client. Rationale: The server 
is better suited to perform language-specific variable insertion in the 
"detail" field. It  allows for processing of errors from generic third 
party servers, and allows the server to add new error types without 
prior arranging with the client.`

4. Problem: HTTP header field and localization

The spec states: `The title and detail values MUST NOT be serialized in 
the Problem field if they contain characters that are not allowed by 
String; see {{Section 3.3.3 of STRUCTURED-FIELDS}}. Practically, this 
has the effect of limiting them to ASCII strings.`
I understand that the limitation to ASCII is imposed by prior existing 
specs. However, mandating error strings to be in English (which is what 
ASCII means in practice) is not very helpful for the purposes of this 
specification.
Importance: Errors strings need to be helpful for the user and allow 
them to correct the problem. If they are in a language that the user 
does not understand, they are unlikely to be helpful. This in turn 
leaves the end user frustrated. Messages that are potentially important 
for the end user MUST be translated into the user's language.

If it is not reasonably possible to convey in the HTTP header field, I 
would recommend to remove this transmission method entirely.
Alternatively, you could specify an escaping mechanism which allows for 
escaping of Unicode characters to be expressed with ASCII, e.g. a JSON 
string (RFC 4627 Point 2.5, Paragr. 2, "\u005C").
Recommendation: `The Problem: HTTP header field is a JSON string. 
Non-ASCII Unicode characters MUST be escaped, because HTTP Headers 
require ASCII.` (This sentence probably would need more tweaking.)


Thank you for consideration of these issues. I think addressing these 
issues would prevent serious problems in everyday usage of this spec and 
harden it.

That said, I am very happy that you are addressing error reporting in 
HTTP APIs.

Greetings,

Ben


Am 20.10.22 um 15:24 schrieb The IESG:
> The IESG has received a request from the Building Blocks for HTTP APIs WG
> (httpapi) to consider the following document: - 'Problem Details for HTTP
> APIs'
>    <draft-ietf-httpapi-rfc7807bis-04.txt> as Proposed Standard
>
> The IESG plans to make a decision in the next few weeks, and solicits final
> comments on this action. Please send substantive comments to the
> last-call@ietf.org  mailing lists by 2022-11-03. Exceptionally, comments may
> be sent toiesg@ietf.org  instead. In either case, please retain the beginning
> of the Subject line to allow automated sorting.
>
> Abstract
>
>
>     This document defines a "problem detail" to carry machine-readable
>     details of errors in HTTP response content and/or fields to avoid the
>     need to define new error response formats for HTTP APIs.
>
>     This document obsoletes RF7807.
>
> Discussion Venues
>
>     This note is to be removed before publishing as an RFC.
>
>     Source for this draft and an issue tracker can be found at
>     https://github.com/ietf-wg-httpapi/rfc7807bis.
>
>
>
>
> The file can be obtained via
> https://datatracker.ietf.org/doc/draft-ietf-httpapi-rfc7807bis/
>
>
>
> No IPR declarations have been submitted directly on this I-D.
>
>
>
>
>