Skip to content

Add guidance about unknown fields - #169

Merged
mnm678 merged 6 commits into
theupdateframework:masterfrom
asraa:superset-fields
Sep 7, 2021
Merged

Add guidance about unknown fields#169
mnm678 merged 6 commits into
theupdateframework:masterfrom
asraa:superset-fields

Conversation

@asraa

Copy link
Copy Markdown
Contributor

#163

Addressing this, specify that implementers should preserve unknown key-value pairs and include them in calculating hashes or verifying signatures.

I would like to add examples here, but it feels like an awkward place if the format hasn't been defined at this point in the spec.

Signed-off-by: Asra Ali asraa@google.com

@mnm678

Copy link
Copy Markdown
Collaborator

Thanks @asraa! The text of the change looks great, but could you remove the whitespace changes? They make the diff hard to read.

Signed-off-by: Asra Ali <asraa@google.com>
@asraa

Copy link
Copy Markdown
ContributorAuthor

Sorry about that! Must've been auto-formatting.

Signed-off-by: Asra Ali <asraa@google.com>

@trishankatdatadogtrishankatdatadog left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't think of how this PR affects security, at least for TUF purposes. Did I miss anything? @mnm678@SantiagoTorres@JustinCappos

Comment threadtuf-spec.md Outdated
attribute-value fields for backwards-compatible format changes. If
a backwards incompatible format change is needed, a new filename can
be used.
attribute-value fields to dictionary objects for backwards-compatible format

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
attribute-value fields to dictionary objects for backwards-compatible format
key-value fields to dictionary objects for backwards-compatible format

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rest of the spec is fairly consistent in referring to them as attributes and attribute-value fields.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for this PR we should revert to attribute-value fields, to be consistent.

We might want to edit the entire spec to change the object related terminology. Filed as #175

Comment threadtuf-spec.md
@mnm678

Copy link
Copy Markdown
Collaborator

I can't think of how this PR affects security, at least for TUF purposes. Did I miss anything?

Well, someone could try some kind of code injection through the unknown field, but it's signed metadata, so that's pretty unlikely.

Signed-off-by: Asra Ali <asraa@google.com>
@asraa

Copy link
Copy Markdown
ContributorAuthor

Well, someone could try some kind of code injection through the unknown field, but it's signed metadata, so that's pretty unlikely.

This would be like someone adding an strange field that disappears when canonicalizing and verifying the signature, right? Did this ever have some discussion with regards to the CUSTOM targets dictionary? I suppose one mitigation is that users must consume canonicalized custom key-values or something like that.

@trishankatdatadog

Copy link
Copy Markdown
Contributor

This would be like someone adding an strange field that disappears when canonicalizing and verifying the signature, right? Did this ever have some discussion with regards to the CUSTOM targets dictionary? I suppose one mitigation is that users must consume canonicalized custom key-values or something like that.

I think Marina means something else, but I'm not sure what

@mnm678

Copy link
Copy Markdown
Collaborator

I was thinking of a json parsing vulnerability. But any of these attacks would require an attacker to tamper with signed metadata, so there shouldn't be a security implication.

@trishankatdatadog

Copy link
Copy Markdown
Contributor

I was thinking of a json parsing vulnerability. But any of these attacks would require an attacker to tamper with signed metadata, so there shouldn't be a security implication.

Right, and any attacker who controls the key can do this without unknown key-value fields anyway.

Asra, what attack did you have in mind?

@asraa

Copy link
Copy Markdown
ContributorAuthor

Asra, what attack did you have in mind?

I thought similar -- as in an attacker adds some specially crafted fields that when canonicalized disappear, so the signature is still verified, by a client thinks there's some extra "verified" data. This may not be possible though (and is obviously visible in the files)

@trishankatdatadog

Copy link
Copy Markdown
Contributor

I thought similar -- as in an attacker adds some specially crafted fields that when canonicalized disappear, so the signature is still verified, by a client thinks there's some extra "verified" data. This may not be possible though (and is obviously visible in the files)

Yeap, the good news is that they will be caught, provided we log everything that goes in and out 🙂

The safest thing to do is to explicitly disallow superset fields, but I'm afraid this is too restrictive for valid, real-world use cases.

I can see how TUF metadata can be used to carry other things that might lead to insecurity, but I don't see how that is directly a problem, so long as it does not break TUF's security guarantees. This is already doable with the targets themselves anyway, not to mention the custom targets metadata.

@trishankatdatadog

Copy link
Copy Markdown
Contributor

BTW, this has implications for the sigstore key ceremony this Friday, which uses superset fields to record YubiKey attestations alongside public keys in their TUF root metadata. So, if anyone is really concerned, please speak up ASAP.

@trishankatdatadog

Copy link
Copy Markdown
Contributor

I can't think of major security issues right now with this change. Does anyone see issues? @JustinCappos?

@joshuagl

Copy link
Copy Markdown
Member

I can't think of a security issue with the change either, I did suggest we change some phrasing to be more consistent with the rest of the spec #169 (comment) (but I also prefer the phrasing used in this PR, and think we should convert the entire spec to use it #175)

trishankatdatadog
trishankatdatadog previously approved these changes Jul 20, 2021

@trishankatdatadogtrishankatdatadog left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, but I want everyone here to think about this

@joshuagljoshuagl linked an issue Jul 22, 2021 that may be closed by this pull request
joshuagl
joshuagl previously approved these changes Sep 7, 2021

@joshuagljoshuagl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @asraa – just a minor suggestion to use the specification standard terms.

Comment threadtuf-spec.md Outdated
mnm678and others added 2 commits September 7, 2021 09:38
Co-authored-by: Joshua Lock <jlock@vmware.com>
@mnm678
mnm678 merged commit 57f636e into theupdateframework:masterSep 7, 2021
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add clarification on unknown key-value pairs in file format

4 participants

@asraa@mnm678@trishankatdatadog@joshuagl