Skip to content

TAP 6 forces parsing of untrusted data #39

Closed

Description

@heartsucker

TAP 6 proposes adding the spec_version field to the signed portion of metadata forces all clients to fully parse data before doing any validation on it. Ideally, a client parses as little untrusted data as possible.

For example, a client might prefer to send a (protobuf) message like:

message SignedMetadata {
  repeated Signature signatures = 1;
  bytes signed = 2;
}

message Signature {
  string keyid = 1;
  string method = 2;
  bytes sig = 3;
}

message RootMetadata {
  ...
}
...

Where the signed field in the SignedMetadata message would itself be a serialized RootMetadata protobuf message. This would allow a client to skip parsing the signed data until after the contents have been verified.

In theory, this could be done with JSON where the object is

{
  "signatures": [...],
  "signed": "<base64 string>"
}

And the base64 string is itself an encoded root metadata object. This itself would actually be convenient as it would skip the need for using canonical JSON since only a string is being signed.

I don't actually have a solid suggestion at this time for how to handle the cases of varying specification versions. Putting the spec_version field in attacker controlled space is problematic in some ways as is forcing a client to fully parse all data.

Related: #35

Activity

  1. vladimir-v-diaz commented on Jun 1, 2017

    @vladimir-v-diaz
    Contributor

    Using base64 strings seems like a solution. Note that this wasn't always a problem because we previously used to list the hashes of all metadata in Snapshot. Clients could validates the hashes of metadata prior to parsing untrusted data.

    There is another issue with not listing hashes in Snapshot, which I think was reported by David Lawrence. @trishankkarthik can say more.

    We may again just list hashes in Snapshot, but I'm not entirely certain.

  2. heartsucker commented on Jun 1, 2017

    @heartsucker
    ContributorAuthor

    The problem with a b64 string is that wouldn't tell you anything about the spec_version. This issues is primarily meant to point out the non-triviality of resolving TAP 6 with the idea that parsing untrusted data is less secure than if it could be avoided.

    The best solution I could think of since posting this would be to encode it in the URL. For example, there's a repo at http://example.com, then clients can access:

    • spec_version = 1 at http://example.com/v1/{root,snapshot,etc}.json as well as all targets
    • spec_version = 2 at http://example.com/v2/{root,snapshot,etc}.json as well as all targets

    This moves it outside the metadata itself and has some of its own concerns, but I think it is a slight improvement.

  3. trishankkarthik commented on Jun 5, 2017

    @trishankkarthik
    Contributor

    I think this is related to theupdateframework/tuf#362...

  4. vladimir-v-diaz commented on Jul 24, 2017

    @vladimir-v-diaz
    Contributor

    I'm closing this issue so that we keep all TAP 6 discussions in one place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions