-
Notifications
You must be signed in to change notification settings - Fork 55
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
Add TUF schema files #246
base: master
Are you sure you want to change the base?
Add TUF schema files #246
Changes from 22 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,85 @@ | ||
{ | ||
"$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}$" | ||
}, | ||
"sig": { | ||
"type": "string", | ||
"minLength": 1024, | ||
"maxLength": 1024, | ||
"pattern": "^[a-f0-9]{1024}$" | ||
} | ||
} | ||
} | ||
}, | ||
"signed": { | ||
"type": "object", | ||
"required": ["_type", "expires", "mirrors", "spec_version", "version"], | ||
"additionalProperties": false, | ||
"properties": { | ||
"_type": { | ||
"enum": ["mirrors"] | ||
}, | ||
"expires": { | ||
"type": "string", | ||
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$" | ||
}, | ||
"mirrors": { | ||
"type": "object", | ||
"required": ["urlbase", "metapath", "targetspath", "metacontent", "targetscontent"], | ||
"additionalProperties": false, | ||
"properties": { | ||
"urlbase": { | ||
"type": "string", | ||
"minLength": 1 | ||
}, | ||
"metapath": { | ||
"type": "string", | ||
"minLength": 1 | ||
}, | ||
"targetspath": { | ||
"type": "string", | ||
"minLength": 1 | ||
}, | ||
"metacontent": { | ||
"type": "array", | ||
"items": { | ||
"type": "string", | ||
"minLength": 1 | ||
} | ||
}, | ||
"targetscontent": { | ||
"type": "array", | ||
"items": { | ||
"type": "string", | ||
"minLength": 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,192 @@ | ||
{ | ||
"$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": 1024, | ||
"maxLength": 1024, | ||
"pattern": "^[a-f0-9]{1024}$" | ||
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. One more thing to clarify - do we want to relax requirements on the signature? The spec does not talk about its length. 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. Yes: should just be a positive length |
||
} | ||
} | ||
} | ||
}, | ||
"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": ["keyid_hash_algorithms", "keytype", "keyval", "scheme"], | ||
"additionalProperties": false, | ||
"properties": { | ||
"keyid_hash_algorithms": { | ||
fridex marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"type": "array", | ||
"items": { | ||
"enum": [ | ||
"sha256", | ||
"sha512" | ||
] | ||
} | ||
}, | ||
"keytype": { | ||
"enum": ["rsa"] | ||
fridex marked this conversation as resolved.
Show resolved
Hide resolved
fridex marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
"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
|
||
"type": "string", | ||
"minLength": 1 | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"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": 1 | ||
fridex marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
}, | ||
"threshold": { | ||
"type": "number", | ||
"minimum": 1 | ||
} | ||
} | ||
}, | ||
"root": { | ||
"type": "object", | ||
"required": ["keyids", "threshold"], | ||
"additionalProperties": false, | ||
"properties": { | ||
"keyids": { | ||
"type": "array", | ||
"items": { | ||
"type": "string", | ||
"minLength": 1 | ||
} | ||
}, | ||
"threshold": { | ||
"type": "number", | ||
"minimum": 1 | ||
} | ||
} | ||
}, | ||
"snapshot": { | ||
"type": "object", | ||
"required": ["keyids", "threshold"], | ||
"additionalProperties": false, | ||
"properties": { | ||
"keyids": { | ||
"type": "array", | ||
"items": { | ||
"type": "string", | ||
"minLength": 1 | ||
} | ||
}, | ||
"threshold": { | ||
"type": "number", | ||
"minimum": 1 | ||
} | ||
} | ||
}, | ||
"targets": { | ||
"type": "object", | ||
"required": ["keyids", "threshold"], | ||
"additionalProperties": false, | ||
"properties": { | ||
"keyids": { | ||
"type": "array", | ||
"items": { | ||
"type": "string", | ||
"minLength": 1 | ||
} | ||
}, | ||
"threshold": { | ||
"type": "number", | ||
"minimum": 1 | ||
} | ||
} | ||
}, | ||
"timestamp": { | ||
"type": "object", | ||
"required": ["keyids", "threshold"], | ||
"additionalProperties": false, | ||
"properties": { | ||
"keyids": { | ||
"type": "array", | ||
"items": { | ||
"type": "string", | ||
"minLength": 1 | ||
} | ||
}, | ||
"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,95 @@ | ||
{ | ||
"$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": 1024, | ||
"maxLength": 1024, | ||
"pattern": "^[a-f0-9]{1024}$" | ||
} | ||
}, | ||
"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.