Skip to content
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

Expand on the TUF client update workflow, per popular demand. #440

Merged
merged 16 commits into from
May 24, 2017
Merged

Expand on the TUF client update workflow, per popular demand. #440

merged 16 commits into from
May 24, 2017

Conversation

trishankkarthik
Copy link
Contributor

@trishankkarthik trishankkarthik commented Apr 26, 2017

Besides our reference implementation, I do not believe that the TUF specification describes the precise steps that an alternative, compliant implementation should follow to download and verify a target. This PR is a humble attempt at solving this problem.

There are still some details are missing, such as:

  • Downloading and verifying the complete chain of root metadata files. (Maybe @ecordell or @heartsucker could help here?)
  • Merge reading consistent snapshots with the client update workflow.
  • Using the map file, but the pseudocode is available...

Hopefully, I didn't miss something important, or, worse, get something wrong. (I'll blame it on travel lag.) Please take it from here!

@coveralls
Copy link

Coverage Status

Coverage remained the same at 97.936% when pulling f092d2a on trishankkarthik:add-detailed-workflow into 40aaf93 on theupdateframework:develop.

Copy link
Member

@JustinCappos JustinCappos left a comment

Choose a reason for hiding this comment

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

Quick comments upon first read.

@@ -928,24 +928,113 @@ Version 1.0 (Draft)

5.1. The client application

1. The client application first instructs TUF to check for updates.
1. **Download the root metadata file**, up to some predetermined number of
Copy link
Member

Choose a reason for hiding this comment

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

Please clarify what "predetermined" means here.

arbitrarily increase the version numbers of: (1) the timestamp metadata,
(2) the snapshot metadata, and / or (3) the targets, or a delegated
targets, metadata file in the snapshot metadata. Please see the Mercury
paper for more details (to be published soon).
Copy link
Member

Choose a reason for hiding this comment

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

You can probably point to where this will be:

https://ssl.engineering.nyu.edu/papers/kuppusamy_usenix_17.pdf

For the time being, feel free to put the SUBMITTED there, but please label it DRAFT


7. TUF downloads and verifies the file and then makes the file available to the
software update system.
2.1. **Check signatures.** It must have been signed by a threshold of keys
Copy link
Member

Choose a reason for hiding this comment

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

Please avoid 'It', especially when it crosses points, etc.

5.1. If there is no targets metadata about this target, then report that
there is no such target.

5.2. Otherwise, download the target (up to the number of bytes specified in
Copy link
Member

Choose a reason for hiding this comment

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

It's worth explaining why this is 'up to' instead of 'exactly'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

@coveralls
Copy link

Coverage Status

Coverage remained the same at 97.936% when pulling 6236878 on trishankkarthik:add-detailed-workflow into 40aaf93 on theupdateframework:develop.

@vladimir-v-diaz
Copy link
Contributor

Should we postpone the specification edits for the map file changes? The PR that implements the map file (TAP 4) hasn't yet been reviewed/merged with the master/develop branch. We can also update the specification in pull request #430.

@JustinCappos
Copy link
Member

JustinCappos commented Apr 26, 2017 via email

Copy link

@heartsucker heartsucker left a comment

Choose a reason for hiding this comment

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

I think this should be updated to use RFC 2119 keywords, because there are some places where you say "should" but I think you mean "must."


2. TUF downloads and verifies timestamp.json.
1.1. **Check signatures.** The root metadata file must have been signed by

Choose a reason for hiding this comment

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

I think you should mention key pinning over TOFU for the initial root.json.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea. Where is it best in the specification to discuss this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also, where in the specification do you think we should use "SHOULD" or "MUST" (ala RFC 2119)?

Choose a reason for hiding this comment

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

For example:

The latest known time should be lower than the expiration timestamp

should say

The latest known time MUST be lower than the expiration timestamp

Choose a reason for hiding this comment

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

Also

The version number of the previous root metadata file must be less than or equal

Should have the "must" in all caps

Choose a reason for hiding this comment

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

As for where to mention pinning vs. TOFU, I think there should be a section before 5.1 maybe called "client design" that mentions this, and then step 1 could specifically say something like "If a client was initialized with a pinned set of root keys, these keys and only these keys MUST be used to validate the original root.json."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks very much, @heartsucker, will incorporate these suggestions!

@heartsucker
Copy link

I have another question on this. I seem to have a chicken and egg problem.

Imagine a repo at time T1 with all metadata at versions 1. A client connects and downloads all metadata. At time T2, someone swaps the root metadata keys and all role keys creating all new metadata at versions 2. A client connects at T3 and starts by downloading the timestamp.json. This would be untrusted because the client doesn't know about the version 2 keys.

I think this could include the step saying "if timestamp.json is untrusted, the client downloads root.json an rebuilds the chain of trust, returns to the start and attempts to download timestamp.json again repeating the loop."

@ecordell
Copy link
Contributor

@heartsucker The first step of the update process should always be updating the root chain, so that trusted keys are up to date. I think the only change needed here is to clarify that "downloading the root" can mean "downloading n roots, until one is reached that is signed by trusted keys"

@trishankkarthik
Copy link
Contributor Author

trishankkarthik commented Apr 29, 2017

Very good question, @heartsucker, about not being able to verify timestamp and / or snapshot metadata due to change of keys, and thanks for the response, @ecordell !

Indeed, partly due to our findings from the submitted Mercury draft, we have made updating the root metadata the first and foremost step, so that there are no problems verifying timestamp and / or snapshot metadata from a change of keys (especially after the repository has been compromised, and recovered). This is also the first and foremost step, partly due to TAP 5.

@trishankkarthik trishankkarthik self-assigned this Apr 30, 2017
vladimir-v-diaz referenced this pull request May 18, 2017
Client's should validate new root.json according to the threshold and keys set by its previous version.

See @heartsucker comment [here](theupdateframework/rust-tuf#42 (comment))
@vladimir-v-diaz
Copy link
Contributor

@trishankkarthik I think this PR is good enough to merge at the moment. We can address the other points raised in the comments in separate pull requests. Please go ahead and make
any last remaining edits before we merge.

Documenting the other needed changes to specification...

@trishankkarthik
Copy link
Contributor Author

@vladimir-v-diaz @JustinCappos I agree we should merge. But first, I think we should:

  1. Merge Section 7.2 (reading consistent snapshots) with Section 5.1 (client update workflow). It's confusing to have multiple sections about the same thing.

  2. Remove some redundant notes at the end of Section 5.1.

@trishankkarthik
Copy link
Contributor Author

Okay, I merged reading consistent snapshots with the client update workflow. I also added some other details. Someone else please review to make sure I didn't make mistakes from burning the midnight oil.

@vladimir-v-diaz We should fix Section 7.1 (writing consistent snapshots). It seems to have some now inaccurate information. For example, aren't all targets metadata files written as FILENAME.VERSION.EXT instead of FILENAME.DIGEST.EXT? Isn't only the snapshot metadata file written as FILENAME.DIGEST.EXT? The root and timestamp metadata files are written as both FILENAME.EXT and FILENAME.DIGEST.EXT, right?

Also, have we decided whether it's (DIGEST|VERSION).FILENAME.EXT or FILENAME.(DIGEST|VERSION).EXT? Thanks!

@trishankkarthik
Copy link
Contributor Author

Okay, I just added that the expiration of the previous root metadata file does not matter, because we will attempt to update it in the next step.

@vladimir-v-diaz
Copy link
Contributor

vladimir-v-diaz commented May 23, 2017

@trishankkarthik

The code expects metadata filenames to be in <version_number>.rolename.<ext> format.

I think that's the format we last settled on. There were several reasons, one of them being that long digests might exceed the filename limit set by certain filesystems. However, according to Hannes, TAP 8 requires that filenames include the digest. We'll see once the TAP is edited with more detail.

@trishankkarthik
Copy link
Contributor Author

@vladimir-v-diaz Got it. Please feel free to make the change!

without requiring all previous root keys to be kept to sign new root.json
metadata.

In the event that the keys being updated are root keys, it is important to
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@vladimir-v-diaz I think this is great! Should we say a bit more about this in Step 1 of Section 5.1?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should. Do we also explain how to recover from a fast-forward attack?

Note: I just reviewed section 7.1 and it seems accurate to me, at least in regard to filenames. Is there a sentence/statement in particular that is inaccurate?

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, we do mention fast-forward attacks in the revised 1.5 section!

@coveralls
Copy link

Coverage Status

Coverage remained the same at 97.936% when pulling 06665c0 on trishankkarthik:add-detailed-workflow into 70cf57a on theupdateframework:develop.

@vladimir-v-diaz
Copy link
Contributor

I think we might be able to reuse some of @heartsucker's outline of root key migrations here.

@trishankkarthik
Copy link
Contributor Author

Okay, so I just worked with @vladimir-v-diaz to update the workflow. Specifically, I added details on how to update to the latest root metadata file (thanks to @ecordell and @heartsucker).

@JustinCappos Please review the entire workflow to make sure there are no problems?

@coveralls
Copy link

Coverage Status

Coverage remained the same at 97.936% when pulling 558fb43 on trishankkarthik:add-detailed-workflow into 70cf57a on theupdateframework:develop.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 97.936% when pulling c5e8c07 on trishankkarthik:add-detailed-workflow into 70cf57a on theupdateframework:develop.

Copy link
Member

@JustinCappos JustinCappos left a comment

Choose a reason for hiding this comment

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

good change

Sign up for free to 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.

7 participants