-
Notifications
You must be signed in to change notification settings - Fork 51
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
in-toto attestation JSON schema verify via CLI #129
Comments
in-toto uses Canonical JSON which may complicate this effort. http://wiki.laptop.org/go/Canonical_JSON |
This is a good point @colek42! |
Are Cue and JSON schemas canonical? If they are, I don't think this is a problem, right? |
what do you mean by canonical? I really don't know how to respond that 🤷🏻♂️ |
@developer-guy Sorry, my bad. Let me rephrase it: are CUE and JSON Schema compatible with Canonical JSON? If I get this right: Cue and JSON Schema provide a schema for cue or JSON. Then I am able to validate the CUE/JSON against the Schema. It is possible that my question is completely out of this discussion :D I am really not an expert in CUE or Canonical JSON. |
From what I understand, Canonical JSON is a subset (restricted version) of JSON, though poorly named if you want my opinion ;] Both CUE and JSON Schema should be able to handle this. |
@verdverm I understood Canonical JSON as "ordered" JSON. Question is if cue would validate this correctly: **NOTE: the following files are pseudo .. I have no idea if the syntax is right, but the idea behind it should be" file 1 {
"test": "A",
"foo": 1,
} file 2 {
"foo": 1,
"test": "A",
} Template JSON Schema or CUE:
With Canonical JSON only the file 2 should be approved by the template. The validation for file 1 MUST fail. |
Ah, I missed that lexicographical part in their spec. You could do this with CUE, though it would require some extra stuff. By default, CUE is intentionally order ignorant. You can probably use extra constraints (IsSorted on the object keys through a list comprehension) |
I think the Canonical JSON spec is more complicated than this. They have weights on each type and so on... We use Canonical JSON for ensuring the same hash for attestations (iirc). |
Wouldn't generating attestations using DSSE help here? There's already some support for it... |
I think the plan is to validate attestations via a schema, not to generate them. I might be wrong. |
Yes, but we won't be using cjson if the attestations are in DSSE as I understand it. Edit: so we can validate them using JSON schema as originally suggested? |
FYI, started: cue-lang/cue#1285 (CUE and Canonical JSON) |
Abstract
in-toto attestations are in the form of JSON. We can use JSON schema to validate the schema of the attestation.
Motivation
We started to work on a PR to verify in-toto attestations by using Cue or Rego languages in the cosign project. So, if in-toto attestations have JSON schemas, we can use them in the
in-toto-golang
CLI. Also, cosign has a dependency on thein-toto-golang
project for the structs of the in-toto attestations. So, if we add support of verifying JSON schemas to thein-toto-golang
project, we can use it in cosign project too.References
I found some additional resources that might help us to implement this:
cc: @Dentrax @erkanzileli
The text was updated successfully, but these errors were encountered: