python-tuf: Expiration check does not follow the spec

Description of issue or feature request:

The metadata expiry check code does not follow the specification:

Check for a freeze attack. The expiration timestamp in the trusted $ROLE metadata file MUST be higher than the fixed update expiration time.

Current behavior:

expires < now

Expected behavior:

expires <= now

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 22 (19 by maintainers)

Commits related to this issue

Most upvoted comments

@joshuagl - you are correct, we are using <= in rust-tuf and go-tuf.

I’ve created a PR against python-tuf (#1235) and filed issues against the in-toto specification (in-toto/docs#42) and reference implementation (in-toto/in-toto#417). That just leaves Tough that doesn’t follow the rough consensus here, @iliana would you like me to file an issue there?

Maybe not a consensus but at least a majority for <=?

I’m happy to review PRs that update python-tuf, in-toto spec and python-in-toto. 😃

The spec seems underspecified: …

I beg to differ, the final product verification workflow section clearly mandates expires < now (as is implemented in python-in-toto):

If the system’s date is newer than the expiration date on the layout’s expiration field, verification should fail.

Although, we might want to s/newer/higher and s/date/datetime.

I think this is actually a problem with the specification. I understand an expiration time as metadata that expires at a certain time, rather than after a certain time.

+1. Although I think just having agreement is more important than either option winning imvho

I think this is actually a problem with the specification. I understand an expiration time as metadata that expires at a certain time, rather than after a certain time.

Thanks for chiming in, @iliana. The spec is not inconsistent in itself. There are only inconsistencies between tuf and in-toto (i.e. tuf’s sister project) specs and the corresponding implementations. And there seems an agreement to consolidate all of these, which will require either some implementations and/or specifications to change.

tough: <

Hard to remember but I imagine this was a literal reading of the detailed workflows, which were followed very literally to develop tough initially.

We haven’t gone through spec changes in a while. Is the current revision internally inconsistent on this right now, and does it need clarified?

Is there though? Here are some more data points:

Don’t forget GPG and OpenSSL…

Thanks for doing some research @trishankatdatadog and @joshuagl. It looks like there is a general consensus for <=, so I agree that it makes sense to change our implementation.

Thanks for checking against independent implementations, Joshua, great work!

Agreed with consensus (luckily that doesn’t need meta-voting). By sheer precedent, as in legal cases, I’m personally voting for <=. Are we using threshold signatures for voting here; how does this work?

I think this is actually a problem with the specification. I understand an expiration time as metadata that expires at a certain time, rather than after a certain time.

I think this sounds sensible. However,

does anyone have other implementations/interpretations elsewhere?

x509 certificates are not a perfect comparison, but they are valid for a date range (notBefore through notAfter), with the certificate only classing as expired, with:

validity period for a certificate is the period of time from notBefore through notAfter, inclusive.

Which results in comparisons as <= such as in openssl.

GnuPG has expiration checks that look like sig->expiredate <= make_timestamp () i.e. in parse_signature and build_sig_subpkt.

I agree with Santiago. The important thing is that we agree on an interpretation, and are consistent.