Skip to content

Commit 57592f2

Browse files
authored
Merge pull request #26 from MarkLodato/opaque-type
Relax URI requirement on payloadType
2 parents 2f22dc4 + 57a63dc commit 57592f2

File tree

2 files changed

+29
-24
lines changed

2 files changed

+29
-24
lines changed

background.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -119,17 +119,6 @@ Rationales for specific decisions:
119119
payloadType and payload. PAE is already documented and good enough. No
120120
need to reinvent the wheel.
121121

122-
- Why use a URI for payloadType rather than
123-
[Media Type](https://www.iana.org/assignments/media-types/media-types.xhtml)
124-
(a.k.a. MIME type)?
125-
126-
- Because Media Type only indicates how to parse but does not indicate
127-
purpose, schema, or versioning. If it were just "application/json", for
128-
example, then every application would need to impose some "type" field
129-
within the payload, lest we have similar vulnerabilities as if
130-
payloadType were not signed.
131-
- Also, URIs don't need to be registered while Media Types do.
132-
133122
- Why not stay backwards compatible by requiring the payload to always be JSON
134123
with a "_type" field? Then if you want a non-JSON payload, you could simply
135124
have a field that contains the real payload, e.g. `{"_type":"my-thing",

protocol.md

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,35 @@ SIGNATURE = Sign(PAE(UTF8(PAYLOAD_TYPE), SERIALIZED_BODY))
1818

1919
Parameters:
2020

21-
* SERIALIZED_BODY is the byte sequence to be signed.
22-
23-
* PAYLOAD_TYPE is an authenticated URI indicating how to interpret
24-
SERIALIZED_BODY. It encompasses the content type (JSON, Canonical-JSON,
25-
CBOR, etc.), the purpose, and the schema version of the payload. This
26-
obviates the need for the `_type` field within [in-toto]/[TUF] payloads.
27-
This URI does not need to be resolved to a remote resource, nor does such a
28-
resource need to be fetched. Examples: `https://in-toto.io/Link/v1.0`,
29-
`https://in-toto.io/Layout/v1.0`,
30-
`https://theupdateframework.com/Root/v1.0.5`.
31-
32-
* KEYID is an optional, unauthenticated hint indicating what key and algorithm
33-
was used to sign the message. As with Sign(), details are agreed upon
21+
Name | Type | Required | Authenticated
22+
--------------- | ------ | -------- | -------------
23+
SERIALIZED_BODY | bytes | Yes | Yes
24+
PAYLOAD_TYPE | string | Yes | Yes
25+
KEYID | string | No | No
26+
27+
* SERIALIZED_BODY: Byte sequence to be signed.
28+
29+
* PAYLOAD_TYPE: Opaque, case-sensitive string that uniquely and unambiguously
30+
identifies how to interpret `payload`. This includes both the encoding
31+
(JSON, CBOR, etc.) as well as the meaning/schema. To prevent collisions, the
32+
value SHOULD be either:
33+
34+
* [URI](https://tools.ietf.org/html/rfc3986) (recommended)
35+
* Example: `https://in-toto.io/Statement/v1-json`.
36+
* SHOULD resolve to a human-readable description but MAY be
37+
unresolvable.
38+
* SHOULD be case-normalized (section 6.2.2.1)
39+
* [Media Type](https://www.iana.org/assignments/media-types/), a.k.a. MIME
40+
type or Content Type
41+
* Example: `application/vnd.in-toto.statement.v1+json`.
42+
* IMPORTANT: SHOULD NOT be a generic type that only represents
43+
encoding but not schema. For example, `application/json` is almost
44+
always WRONG. Instead, invent a media type specific for your
45+
application in the `application/vnd` namespace.
46+
* SHOULD be lowercase.
47+
48+
* KEYID: Optional, unauthenticated hint indicating what key and algorithm was
49+
used to sign the message. As with Sign(), details are agreed upon
3450
out-of-band by the signer and verifier. It **MUST NOT** be used for security
3551
decisions; it may only be used to narrow the selection of possible keys to
3652
try.

0 commit comments

Comments
 (0)