-
Notifications
You must be signed in to change notification settings - Fork 28
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
fix!: current CType meta schema ignores additional properties in claim contents #726
Conversation
title: 'CType Metaschema (draft-01)', | ||
description: `Describes a CType, which is a json schema for validating KILT claim types. This version has known issues, the use of schema ${CTypeModelV1.$id} is recommended instead.`, |
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.
we should update the hosted version if merged
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.
Looks very good! I would like to understand a bit more how it all works, if you answer my questions. Then I would take a second look after that :)
throw new SDKErrors.NestedClaimUnverifiableError(undefined, { | ||
cause: errors, | ||
}) | ||
verifyObjectAgainstSchema(cType, CTypeModel, messages) |
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.
Question, probably out of scope for this PR: how is a verifier supposed to know what are the nested CTypes? Are they assumed to have this knowledge? Or might they only know the top-level CType they want to verify a credential against?
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.
I was thinking the same thing but yes, I think it's out of scope. Maybe we need a CType registry in the sdk? Would also let us validate a CType only once (when adding to the registry) and not every time it is used.
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.
That would make our SDK less stateless, which is something we wanted to strive for as much as possible. it might be a good idea to at least reference this in a comment or something.
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.
Guess that's true. The way I see it choosing a CType is a very conscious decision for a verifier, so they'd be familiar with it and know whether or not it is nested. At least the need to known what sort of data they will be working with in their application, so they'd look into that for sure.
As far as I can see all the upgrade paths described above but the one where people simply create a new CType based on the old would break quite a few things. So I'd suggest sticking to that. Besides this, I see only two open issue that we should clarify before putting the new CType out there:
|
I think this version should be quite stable, right? At least as far as our credentials currently allow. If we want to support nested selected disclosure, we would have a v2 out there. So i would be in favour of having this a v1.
I think, for the sake of completeness, we could still allow any property, making it clear (either in the JSDocs or in the documentation itself), that only the top-level property can be revealed or hidden as a whole. |
As it turns out, there are quite a few details to figure out if we were to allow this, so I think it should be its own ticket with design phase and all. It would also be something that does not affect existing CTypes at all, so it could be quite simply the next meta schema version. See https://github.com/KILTprotocol/ticket/issues/2456. |
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.
Just a question, otherwise LGTM! Very very very very nice job! 👍
fixes KILTProtocol/ticket#2378
Introduces a new meta schema to fix the issue that additional properties were not validated.
Newly created CTypes would use this meta schema by default; legacy CTypes are still validated against the old meta schema.
@id
property on all CTypes (to avoid failing credentialSubjecct verification on VCs, where this would be present after expanding), but this comes at a cost; any IClaim would pass verification even with an extra@id
property.How to test:
Updated tests to cover both the old and new meta schema and CTypes created based on them.
Checklist: