@@ -4843,115 +4843,6 @@ <h3>Verification</h3>
4843
4843
4844
4844
</ section >
4845
4845
4846
- < section class ="normative ">
4847
- < h3 > Context Validation</ h3 >
4848
-
4849
- < p >
4850
- This section contains an algorithm that [=verifiers=] MUST run after running the
4851
- algorithm in Section [[[#verification]]], when validating a [=verifiable
4852
- credential=] or a [=verifiable presentation=]. This algorithm takes a document
4853
- ([=map=] |inputDocument|) and a set of approved JSON-LD Contexts ([=map=]
4854
- |approvedContexts|) and returns a [=map=] that contains the following:
4855
- </ p >
4856
-
4857
- < ul >
4858
- < li >
4859
- a status ([=boolean=] |status|)
4860
- </ li >
4861
- < li >
4862
- a [=conforming document=] ([=map=] |document|)
4863
- </ li >
4864
- < li >
4865
- zero or more warnings ([=list=] of [=ProblemDetails=] |warnings|)
4866
- </ li >
4867
- < li >
4868
- zero or more errors ([=list=] of [=ProblemDetails=] |errors|)
4869
- </ li >
4870
- </ ul >
4871
-
4872
- < p >
4873
- The context validation algorithm is as follows:
4874
- </ p >
4875
-
4876
- < ol class ="algorithm ">
4877
- < li >
4878
- Set |result|.|status| to `false`.
4879
- </ li >
4880
- < li >
4881
- For each |contextValue| expressed in every `@context` property, ensure that
4882
- either:
4883
- < ol class ="algorithm ">
4884
- < li >
4885
- The |contextValue| exists in |approvedContexts| and matches an exact value
4886
- or a cryptographic hash associated with the matching approved context, or
4887
- </ li >
4888
- < li >
4889
- optionally, if any of the context values do not exist in |approvedContexts|,
4890
- clone the `@context` property and remove each context value that was
4891
- not in |approvedContext| from the clone. Set |result|.|document| to
4892
- the result of running the < a data-cite ="JSON-LD11-API#compaction-algorithm ">
4893
- JSON-LD Compaction Algorithm</ a > with the |inputDocument| and
4894
- the cloned and modified context as inputs.
4895
- </ li >
4896
- </ ol >
4897
- </ li >
4898
- < li >
4899
- If no errors occurred in the previous step, set |result|.|status| to `true` and,
4900
- if |result|.|document| is not set, set it to |inputDocument|. If errors
4901
- occurred, set |result|.|status| to `false`, remove the |document| property from
4902
- |result|, and add at least one
4903
- < a href ="#MALFORMED_VALUE_ERROR "> MALFORMED_VALUE_ERROR</ a > to |result|.|errors|.
4904
- </ li >
4905
- < li >
4906
- Return the value of |result|.
4907
- </ li >
4908
- </ ol >
4909
-
4910
- < p >
4911
- The purpose of the algorithm above is to ensure that the [=verifier=] has
4912
- explicitly approved of the types of [=verifiable credentials=] and [=verifiable
4913
- presentations=] that it will process. Not checking these JSON-LD Context values
4914
- against known good values, and the semantics that they convey, can lead to
4915
- security vulnerabilities. While the algorithm above provides one way of checking
4916
- these values, and one optional way of safely processing unknown values,
4917
- implementers MAY use alternative approaches, or a different ordering of the
4918
- steps, that provide the same protections.
4919
- </ p >
4920
-
4921
- < p >
4922
- One such approach would be for a [=verifier=] to configure a JSON-LD Context
4923
- loader, sometimes referred to as a document loader, to use only local copies of
4924
- approved context files which would guarantee that 1) context files will never
4925
- change, and 2) the cryptographic hashes will never change, effectively
4926
- resulting in the same result as the algorithm above.
4927
- </ p >
4928
-
4929
- < p >
4930
- Another approach a [=verifier=] could use would be to use a list of well known
4931
- context URLs and their associated approved cryptographic hashes, without storing
4932
- every context file locally, which would allow contexts to be safely loaded and
4933
- cached from the network without compromising the security expectations of the
4934
- [=verifier=]. This approach would also be effectively equivalent to the
4935
- algorithm provided in this section.
4936
- </ p >
4937
-
4938
- < p >
4939
- Yet another valid approach would be for the [=holder=] to
4940
- < a data-cite ="JSON-LD11-API#compaction-algorithm "> compact</ a > a [=verifiable
4941
- credential=] or [=verifiable presentations=] to exactly what a [=verifier=]
4942
- requests, omitting additional issuer-specific context values that an [=issuer=]
4943
- used when issuing the original document. As long as the securing mechanism's
4944
- verification algorithm provides a successful verification result, such
4945
- transformations are valid and would result in full URLs for terms that were
4946
- previously compacted by the omitted context. That is, a term that was
4947
- previously compacted to `foo` based on an issuer-supplied context that is
4948
- unknown to a [=verifier=] would instead be "compacted" to something like
4949
- `https://vocabulary.example#foo` once the unknown context is omitted and the
4950
- compaction algorithm is applied by the [=verifier=].
4951
- </ p >
4952
-
4953
- </ section >
4954
-
4955
4846
< section >
4956
4847
< h3 > Problem Details</ h3 >
4957
4848
0 commit comments