- 
                Notifications
    You must be signed in to change notification settings 
- Fork 56
Add TUF schema files #246
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
base: master
Are you sure you want to change the base?
Add TUF schema files #246
Changes from all commits
dc9fe0b
              24dc032
              885ea58
              767c54a
              6b6d6fb
              850f864
              40247c4
              975c34a
              4c22256
              46281e4
              fb56026
              3a253ff
              84ad9f4
              d6731dc
              2affedf
              05fdf4b
              17f3efd
              e6b6832
              3a59b30
              945bd6f
              c6c6674
              7705ca9
              a5f6a0e
              d9b0672
              5579cfa
              99843d9
              9fb5926
              e17ccfb
              62067e2
              1e6a129
              39d2add
              c423ee2
              bcc2c17
              4efec41
              a037d25
              dba81f9
              ecc07c9
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| { | ||
| "$schema": "http://json-schema.org/draft-04/schema#", | ||
| "type": "object", | ||
| "required": ["repositories", "mapping"], | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "repositories": { | ||
| "type": "object", | ||
| "items": { | ||
| "type": "object", | ||
| "patternProperties": { | ||
| ".+": { | ||
| "type": "object", | ||
| "items": { | ||
| "type": "string", | ||
| "minimum": 1 | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "mapping": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "object", | ||
| "additionalProperties": false, | ||
| "required": ["paths", "repositories", "threshold", "terminating"], | ||
| "properties": { | ||
| "paths": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string", | ||
| "minLength": 1 | ||
| } | ||
| }, | ||
| "repositories": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string", | ||
| "minLength": 1 | ||
| } | ||
| }, | ||
| "threshold": { | ||
| "type": "integer", | ||
| "minimum": 1 | ||
| }, | ||
| "terminating": { | ||
| "type": "boolean" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|  | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,190 @@ | ||
| { | ||
| "$schema": "http://json-schema.org/draft-04/schema#", | ||
| "type": "object", | ||
| "required": ["signatures", "signed"], | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "signatures": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "object", | ||
| "required": ["keyid", "sig"], | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "keyid": { | ||
| "type": "string", | ||
| "minLength": 64, | ||
| "maxLength": 64, | ||
| "pattern": "^[a-f0-9]{64}$" | ||
|         
                  fridex marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
| }, | ||
| "sig": { | ||
| "type": "string", | ||
| "minLength": 1 | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would allow any length here: 
 | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "signed": { | ||
| "type": "object", | ||
| "required": ["_type", "expires", "keys", "roles", "spec_version", "version"], | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "_type": { | ||
| "enum": ["root"] | ||
| }, | ||
| "consistent_snapshot": { | ||
| "type": "boolean" | ||
| }, | ||
| "expires": { | ||
| "type": "string", | ||
| "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$" | ||
| }, | ||
| "keys": { | ||
| "type": "object", | ||
| "additionalProperties": false, | ||
| "patternProperties": { | ||
| "^[0-9a-f]{64}$": { | ||
| "type": "object", | ||
| "required": ["keytype", "keyval", "scheme"], | ||
| "additionalProperties": true, | ||
| "properties": { | ||
| "keytype": { | ||
| "enum": ["rsa", "ed25519", "ecdsa-sha2-nistp256"] | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does this mean only these three values are allowed? That seems incorrect The correct way to handle the spec requirements seems to be: 
 is the described check useful for anyone? not sure, but this is what the spec says if I read it correctly. | ||
| }, | ||
| "keyval": { | ||
| "type": "object", | ||
| "required": ["public"], | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mentioned this another comment: "public" is only required for the three defined keytypes, not for others | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "public": { | ||
| "type": "string", | ||
| "minLength": 1 | ||
| } | ||
| } | ||
| }, | ||
| "scheme": { | ||
|         
                  fridex marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
| "enum": ["rsassa-pss-sha256", "ed25519", "ecdsa-sha2-nistp256"] | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does this mean only these three values are allowed? | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "roles": { | ||
| "type": "object", | ||
| "required": ["root", "snapshot", "targets", "timestamp"], | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "mirror": { | ||
| "type": "object", | ||
| "required": ["keyids", "threshold"], | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "keyids": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string", | ||
| "minLength": 64, | ||
| "maxLength": 64, | ||
| "pattern": "^[a-f0-9]{64}$" | ||
| } | ||
| }, | ||
| "threshold": { | ||
| "type": "number", | ||
| "minimum": 1 | ||
| } | ||
| } | ||
| }, | ||
| "root": { | ||
| "type": "object", | ||
| "required": ["keyids", "threshold"], | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "keyids": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string", | ||
| "minLength": 64, | ||
| "maxLength": 64, | ||
| "pattern": "^[a-f0-9]{64}$" | ||
|         
                  fridex marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
| } | ||
| }, | ||
| "threshold": { | ||
| "type": "number", | ||
| "minimum": 1 | ||
| } | ||
| } | ||
| }, | ||
| "snapshot": { | ||
| "type": "object", | ||
| "required": ["keyids", "threshold"], | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "keyids": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string", | ||
| "minLength": 64, | ||
| "maxLength": 64, | ||
| "pattern": "^[a-f0-9]{64}$" | ||
| } | ||
| }, | ||
| "threshold": { | ||
| "type": "number", | ||
| "minimum": 1 | ||
| } | ||
| } | ||
| }, | ||
| "targets": { | ||
| "type": "object", | ||
| "required": ["keyids", "threshold"], | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "keyids": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string", | ||
| "minLength": 64, | ||
| "maxLength": 64, | ||
| "pattern": "^[a-f0-9]{64}$" | ||
| } | ||
| }, | ||
| "threshold": { | ||
| "type": "number", | ||
| "minimum": 1 | ||
| } | ||
| } | ||
| }, | ||
| "timestamp": { | ||
| "type": "object", | ||
| "required": ["keyids", "threshold"], | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "keyids": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string", | ||
| "minLength": 64, | ||
| "maxLength": 64, | ||
| "pattern": "^[a-f0-9]{64}$" | ||
| } | ||
| }, | ||
| "threshold": { | ||
| "type": "number", | ||
| "minimum": 1 | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "spec_version": { | ||
| "type": "string", | ||
| "pattern": "^[0-9]+\\.[0-9]+(\\.[0-9]+)?$" | ||
| }, | ||
| "version": { | ||
| "type": "number", | ||
| "minimum": 1 | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| { | ||
| "$schema": "http://json-schema.org/draft-04/schema#", | ||
| "type": "object", | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "signatures": { | ||
| "type": "array", | ||
| "items": [ | ||
| { | ||
| "type": "object", | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "keyid": { | ||
| "type": "string", | ||
| "minLength": 64, | ||
| "maxLength": 64, | ||
| "pattern": "^[a-f0-9]{64}$" | ||
| }, | ||
| "sig": { | ||
| "type": "string", | ||
| "minLength": 1 | ||
| } | ||
| }, | ||
| "required": [ | ||
| "keyid", | ||
| "sig" | ||
| ] | ||
| } | ||
| ] | ||
| }, | ||
| "signed": { | ||
| "type": "object", | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "_type": { | ||
| "enum": ["snapshot"] | ||
| }, | ||
| "expires": { | ||
| "type": "string", | ||
| "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$" | ||
| }, | ||
| "meta": { | ||
| "type": "object", | ||
| "additionalProperties": true, | ||
| "properties": { | ||
| "targets.json": { | ||
|         
                  trishankatdatadog marked this conversation as resolved.
              Show resolved
            Hide resolved There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would expect you could match all items in the object with patternproperties, not just the "targets.json" field ? | ||
| "type": "object", | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "version": { | ||
| "type": "integer", | ||
| "minimum": 1 | ||
| }, | ||
| "length": { | ||
| "type": "integer", | ||
| "minimum": 1 | ||
| }, | ||
| "hashes": { | ||
| "type": "object" | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is defined in targets schema but not here | ||
| } | ||
| }, | ||
| "required": [ | ||
| "version" | ||
| ] | ||
| } | ||
| }, | ||
| "required": [ | ||
| "targets.json" | ||
| ] | ||
| }, | ||
| "spec_version": { | ||
| "type": "string", | ||
| "pattern": "^[0-9]+\\.[0-9]+(\\.[0-9]+)?$" | ||
| }, | ||
| "version": { | ||
| "type": "integer", | ||
| "minimum": 1 | ||
| } | ||
| }, | ||
| "required": [ | ||
| "_type", | ||
| "expires", | ||
| "meta", | ||
| "spec_version", | ||
| "version" | ||
| ] | ||
| } | ||
| }, | ||
| "required": [ | ||
| "signatures", | ||
| "signed" | ||
| ] | ||
| } | ||
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.
Does this mean no extra properties are allowed? I think this is incorrect not just here but (almost) everywhere in the spec: there are only two or three places where extra properties would make the content non-compliant.