-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Labels
Description
Parent PRD
What to build
Extract the validatePolicyAssertions logic from X509CredentialValidator and make it apply generically to any credential with a did:x509 issuer. This implements PSA 10.6.2 rule 9: identifier values in credentialSubject that originate from the issuer DID must match the corresponding attributes in the issuer DID.
- In the
Verifyfunction (verifier.go), after signature verification succeeds for a credential with a did:x509 issuer, match credentialSubject identifiers against issuer DID attributes - Implement a recursive walk of the
credentialSubjectJSON to find all objects withsystem/valuefields (identifier pattern per PSA 10.6.1) - Match each identifier against the corresponding issuer DID attribute based on
systemURI:http://fhir.nl/fhir/NamingSystem/ura→ URA from issuer DIDhttp://fhir.nl/fhir/NamingSystem/uzi-nr-pers→ UZI-nummer from issuer DID
- Handle
roleCodeas a known special case (direct attribute, not an identifier object) - Remove
validatePolicyAssertionsfromX509CredentialValidator
This is independent of the CRL/resolver changes and can be worked on in parallel.
Acceptance criteria
- Identifier matching runs for any credential with a did:x509 issuer, not just X509Credential type
- Recursive walk finds deeply nested identifiers (e.g.,
credentialSubject.hasEnrollment.enrolledBy.identifier) - URA mismatch between credentialSubject and issuer DID produces an error
- UZI-nummer mismatch between credentialSubject and issuer DID produces an error
- roleCode mismatch produces an error
-
validatePolicyAssertionsis removed fromX509CredentialValidator - Existing X509Credential tests pass
- New test: PatientEnrollmentCredential with matching UZI-nummer passes
- New test: PatientEnrollmentCredential with mismatched UZI-nummer fails
- New test: HealthcareProviderCredential with matching URA passes
- New test: HealthcareProviderCredential with mismatched URA fails
Blocked by
None — can start immediately (independent of resolver/key resolution changes).
User stories addressed
- User story 1: PatientEnrollmentCredentials get attribute matching
- User story 2: HealthcareProfessionalDelegationCredentials get UZI-nummer and roleCode validated
- User story 3: HealthcareProviderCredentials get URA validated
- User story 7: existing behavior preserved
- User story 8: no type-specific validators needed for new credential types
Reactions are currently unavailable