Fix/mdoc sub document number - #31
Open
grahamallen-1 wants to merge 2 commits into
Open
Conversation
Update spruce opencred with latest from stateofca
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Use the mDL document number as the OIDC
subformso_mdoc(mDL) presentations, instead of the enveloped credential id.Problem
For an mso_mdoc presentation the credential is an
EnvelopedVerifiableCredentialwhosecredentialSubject.idis thedata:application/mdl;base64,…URI — i.e. the entire mDL DeviceResponse.extractClaimsForIdTokenuses that assub, which is broken two ways:subdiffers on every login and an RP can never recognize a returning user.sub, and it ship the entire credential to the RP as the subject identifier.OpenID Connect Core 1.0 §2 (ID Token):
subis "a locally unique and never reassigned identifier … It MUST NOT exceed 255 ASCII characters in length" — https://openid.net/specs/openid-connect-core-1_0.html#IDTokenFix
common/oidc.js: for an mso_mdoc credential, derivesubfromorg.iso.18013.5.1.document_number(a stable, per-license identifier already flattened intocredentialSubjectbybuildMdocCredentialSubject). When the document number was not disclosed, or for non-mdoc credentials, fall back to the existingcredentialSubject.id ?? id— so the change is strictly never-worse-than the current behavior. VC and hybrid flows are unaffected.Tests
Added to
test/unit/60-oidc.test.js:subis the document number, not the base64 idcredentialSubject.idsubis the VC subject, unchanged