Skip to content

Expose DataProofs' context allowlisting (ProofVerificationOptions.KnownContexts) through CredentialVerificationOptions #22

Open

Description

@moisesja

Context

DataProofs 2.0.0 added ProofVerificationOptions.KnownContexts: context URI allowlisting for Data Integrity verification. A proof over RDF binds the statements, not the JSON that compacted them, so a holder can present a verified document under a @context that reads its terms differently (the upstream example: boards read as sails), and it verifies on every conforming implementation. VC Data Integrity §4.6 / §2.4.1 therefore require applications to accept only known contexts. With KnownContexts set, every @context value in the secured document, at any depth, must be a listed IRI; an unlisted value, an inline context object or a null fails the document with a document-level PROOF_VERIFICATION_ERROR. Unset (today's behaviour), nothing is checked.

Credentials passes ExpectedProofPurpose / ExpectedChallenge / ExpectedDomain to the pipeline (src/Credentials.Core/Securing/Internal/DataIntegrityMechanism.cs) but does not expose KnownContexts, so a Credentials verifier cannot enable this protection without bypassing IVerifier.

Proposal

  • Add IReadOnlyCollection<string>? KnownContexts to CredentialVerificationOptions (and thread it through PresentationVerificationOptions / contained-credential options and the status-list / schema-credential recursion), mapped to ProofVerificationOptions.KnownContexts for the embedded Data Integrity form. Null keeps today's behaviour.
  • Decide whether the enveloping forms (JOSE / COSE / SD-JWT) should apply the same allowlist to the inner document's @context for consistency; they sign the JSON itself, so the respelling attack does not apply to them, but a uniform policy surface may still be wanted.
  • Document (SECURITY.md "Best practices") that an RDFC/bbs-2023 verifier acting on claim semantics should set it, with approved immutable contexts, as upstream advises: listing a context trusts what it references, and the option does not authenticate context contents.
  • Tests: an RDFC credential re-compacted under a foreign context is Rejected when the list is set and Accepted when unset; nested contexts and inline context objects; presentations embedding credentials with their own contexts.

This is a public API addition (additive, non-breaking; PublicAPI.Unshipped.txt + ApiCompat), so it did not belong in the dependency-update PR (#21), where it was noted as a follow-up.

🤖 Generated with Claude Code

Activity

  1. self-assigned this
    on Nov 3, 2026
  2. added this to the 1.2.1 milestone on Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions