-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor section on ProblemDetails, add one possible value. #444
Open
msporny
wants to merge
1
commit into
main
Choose a base branch
from
msporny-problem-details
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -60,7 +60,7 @@ | |||||
|
||||||
// extend the bibliography entries | ||||||
localBiblio: ccg.localBiblio, | ||||||
xref: "web-platform", | ||||||
xref: ["web-platform", "infra"], | ||||||
github: { | ||||||
repoURL: "https://github.com/w3c-ccg/vc-api/", | ||||||
branch: "main" | ||||||
|
@@ -1253,65 +1253,128 @@ <h4>Exchange Examples</h4> | |||||
<section> | ||||||
<h3>Error Handling</h3> | ||||||
<p> | ||||||
Error handling and messaging in the VC-API aligns with Problem Details for HTTP APIs [[RFC9457]]. | ||||||
Implementers SHOULD include a status and a title in the error response body | ||||||
relating to the specifics of the endpoint on which the error occurs. | ||||||
When an implementation detects an anomaly while processing a document, a | ||||||
<dfn>ProblemDetails</dfn> object can be used to report the issue to other | ||||||
software systems. The interface for these objects follow [[RFC9457]] | ||||||
to encode the data. A [=ProblemDetails=] [=map=] consists of the following | ||||||
properties: | ||||||
</p> | ||||||
|
||||||
<dl> | ||||||
<dt>type</dt> | ||||||
<dd> | ||||||
The `type` [=map/key=] MUST be present and its value MUST be a [=URL=] | ||||||
identifying the type of problem. | ||||||
</dd> | ||||||
<dt>title</dt> | ||||||
<dd> | ||||||
The `title` [=map/key=] SHOULD provide a short but specific human-readable | ||||||
string for the problem. | ||||||
</dd> | ||||||
<dt>detail</dt> | ||||||
<dd> | ||||||
The `detail` [=map/key=] SHOULD provide a longer human-readable string for the | ||||||
problem. | ||||||
</dd> | ||||||
</dl> | ||||||
|
||||||
<p> | ||||||
Leveraging [=keys=] such as `detail`, and `instance` is encouraged, to | ||||||
provide more contextual feedback about the error, while being conscious of | ||||||
security concerns and hence not disclosing sensitive information. | ||||||
</p> | ||||||
|
||||||
<p> | ||||||
Aligning on error handling and messaging will greatly improve test-suites accuracy | ||||||
when identifying technical friction impacting interoperability. | ||||||
The following problem description types are defined by this specification: | ||||||
</p> | ||||||
|
||||||
<dl> | ||||||
<dt id="UNKNOWN_OPTION_PROVIDED"> | ||||||
https://www.w3.org/TR/vc-api#UNKNOWN_OPTION_PROVIDED | ||||||
</dt> | ||||||
<dd> | ||||||
An option that is unknown to the implementation was provided to the API call. | ||||||
</dd> | ||||||
</dl> | ||||||
|
||||||
<p> | ||||||
Further lists of [=ProblemDetails=] that might be reported by implementations | ||||||
can be found in the following specifications: | ||||||
</p> | ||||||
Leveraging other fields such as detail, instance and type is encouraged, | ||||||
to provide more contextual feedback about the error, | ||||||
while being conscious of security concerns and hence not disclosing sensitive information. | ||||||
|
||||||
<ul> | ||||||
<li> | ||||||
<a data-cite="VC-DATA-MODEL-2.0#problem-details"> | ||||||
Section 7.2: Problem Details</a> in the [[[VC-DATA-MODEL-2.0]]] specification. | ||||||
</li> | ||||||
<li> | ||||||
<a data-cite="VC-DATA-INTEGRITY#processing-errors"> | ||||||
Section 4.7: Processing Errors</a> in the [[[VC-DATA-INTEGRITY]]] specification. | ||||||
</li> | ||||||
<li> | ||||||
<a data-cite="VC-DATA-INTEGRITY#processing-errors"> | ||||||
Section 3.5: Processing Errors</a> in the [[[VC-BITSTRING-STATUS-LIST]]] | ||||||
specification. | ||||||
</li> | ||||||
</ul> | ||||||
|
||||||
<pre class="example" title="An example of a ProblemDetails object"> | ||||||
{ | ||||||
"type": "https://www.w3.org/TR/vc-data-model#CRYPTOGRAPHIC_SECURITY_ERROR", | ||||||
"status": 400, | ||||||
"title": "CRYPTOGRAPHIC_SECURITY_ERROR", | ||||||
"detail": "The cryptographic security mechanism couldn't be verified. This is likely due to a malformed proof or an invalid verificationMethod." | ||||||
} | ||||||
</pre> | ||||||
|
||||||
<p class="issue"> | ||||||
The example `type` URLs above will work in the future after VCDM v2.0 becomes a | ||||||
global standard. To ensure the error links to the appropriate location, you can | ||||||
replace the base URL of `https://www.w3.org/TR/vc-data-model` with | ||||||
`www.w3.org/TR/vc-data-model-2.0` for the time being. | ||||||
</p> | ||||||
<p> | ||||||
Implementers should handle all server errors to the best of their capabilities. | ||||||
Endpoints should avoid returning improperly handled 500 errors in production | ||||||
environments, as these may lead to information disclosure. | ||||||
|
||||||
<p class="advisement" title="Sanitize error details in production"> | ||||||
Implementers are strongly advised to sanitize all server errors in production | ||||||
environments, as not doing so can lead to information disclosure. | ||||||
</p> | ||||||
<h4>Relationship between verification, validation and error handling</h4> | ||||||
|
||||||
<p> | ||||||
It is recommended to avoid raising errors while performing verification, | ||||||
and instead gather ProblemDetails objects to include in the verification results. | ||||||
It is recommended to avoid raising errors while performing verification, and | ||||||
instead gather ProblemDetails objects to include in the verification results. | ||||||
</p> | ||||||
<h4>Types of ProblemDetails</h4> | ||||||
An implementer can refer to the [[VC-DATA-MODEL-2.0]] and the [[VC-BITSTRING-STATUS-LIST]] for currently defined ProblemDetails types. | ||||||
<p class="issue"> | ||||||
The example `type` URLs will work in the future after VCDM v2.0 becomes a global standard. | ||||||
To ensure the error links to the appropriate location, you can replace the base URL of | ||||||
`https://www.w3.org/TR/vc-data-model` with `www.w3.org/TR/vc-data-model-2.0` for the time being. | ||||||
|
||||||
<section> | ||||||
<h3>Verification Errors vs. Warnings</h3> | ||||||
|
||||||
<p> | ||||||
This specification defines a distinction between a verification error vs. a | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
verification warning. Errors are `ProblemDetails` relating to cryptography, | ||||||
data model, and malformed context and are unrecoverable. Warnings are | ||||||
`ProblemDetails` relating to statuses and validity periods and might be | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
recoverable or where the subsequent action is at the discretion of the | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
application. | ||||||
</p> | ||||||
<pre class="example" | ||||||
title="ProblemDetails"> | ||||||
{ | ||||||
"type": "https://www.w3.org/TR/vc-data-model#CRYPTOGRAPHIC_SECURITY_ERROR", | ||||||
"status": 400, | ||||||
"title": "CRYPTOGRAPHIC_SECURITY_ERROR", | ||||||
"detail": "The cryptographic security mechanism couldn't be verified. This is likely due to a malformed proof or an invalid verificationMethod." | ||||||
} | ||||||
</pre> | ||||||
<h4>Verification Response</h4> | ||||||
<h5>Errors and Warnings</h5> | ||||||
Errors are `ProblemDetails` relating to cryptography, data model, and malformed context. | ||||||
Warnings are `ProblemDetails` relating to statuses and validity periods. | ||||||
|
||||||
If an error is included, the `verified` property of the `VerificationResponse` object | ||||||
MUST be set to `false`; if no errors are included, it MUST be set to `true`. | ||||||
|
||||||
<pre class="example" | ||||||
title="Verification Response"> | ||||||
{ | ||||||
"verified": false, | ||||||
"document": verifiableCredential, | ||||||
"mediaType": "application/vc", | ||||||
"controller": issuer, | ||||||
"controllerDocument": didDocument, | ||||||
"warnings": [ProblemDetails], | ||||||
"errors": [ProblemDetails] | ||||||
} | ||||||
|
||||||
<p> | ||||||
If an error is included, the `verified` property of the `VerificationResponse` | ||||||
object MUST be set to `false`; if no errors are included, it MUST be set to | ||||||
`true`. | ||||||
</p> | ||||||
|
||||||
<pre class="example" title="An example verification response containing warnings and errors."> | ||||||
{ | ||||||
"verified": false, | ||||||
"document": verifiableCredential, | ||||||
"mediaType": "application/vc", | ||||||
"controller": issuer, | ||||||
"controllerDocument": didDocument, | ||||||
"warnings": [ProblemDetails], | ||||||
"errors": [ProblemDetails] | ||||||
} | ||||||
</pre> | ||||||
|
||||||
</section> | ||||||
</section> | ||||||
|
||||||
</section> | ||||||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.