go-tuf icon indicating copy to clipboard operation
go-tuf copied to clipboard

Update Python interop tests to python-tuf v1.0.0

Open znewman01 opened this issue 2 years ago • 8 comments

Fixes #221

znewman01 avatar Mar 02 '22 02:03 znewman01

CC @jku to make sure the new python-tuf code is right; in particular:

  1. there's no built-in support for consistent snapshots, right?
  2. is there a better way to make sure that timestamp.json has correct hashes/length than what I'm doing?

CC @asraa @haydentherapper generally

My tests are passing, but some others are not passing due to the ErrWrongID change; would appreciate feedback. Core issue:

  1. e82b56b started ignoring ErrWrongID errors because of TAP-12
  2. TAP-12 seemingly got implemented in python-tuf v1.0.0
  3. however the change from (1) doesn't actually import the key! it just silently ignores it

Is the right thing to do:

  1. remove ErrWrongID generally?
  2. have a more-convoluted check, like "if keyid is provided check it but otherwise don't bother"?

znewman01 avatar Mar 02 '22 02:03 znewman01

@jku:

Left some comments hopefully they are helpful

Yes, thank you for the quick review :smile: great context

Maybe more accurate to say Metadata API does not enforce or test that the id actually is the hex digest of the canonical form: it's possible that as an accidental result of that we are producing metadata that is not strictly conformant with that current requirement.

ACK, makes sense. I will consider this a python-tuf bug and track python-tuf#1894.

However, it seems like it should be okay to ignore the keyIDs as a client and barring objections I will update the PR to allow this.

znewman01 avatar Mar 02 '22 20:03 znewman01

Pull Request Test Coverage Report for Build 1924696848

  • 8 of 13 (61.54%) changed or added relevant lines in 4 files are covered.
  • 6 unchanged lines in 4 files lost coverage.
  • Overall coverage decreased (-0.02%) to 70.215%

Changes Missing Coverage Covered Lines Changed/Added Lines %
repo.go 0 1 0.0%
client/client.go 0 2 0.0%
verify/errors.go 0 2 0.0%
<!-- Total: 8 13
Files with Coverage Reduction New Missed Lines %
client/client.go 1 81.41%
repo.go 1 73.37%
verify/errors.go 1 0%
verify/db.go 3 85.53%
<!-- Total: 6
Totals Coverage Status
Change from base Build 1831480097: -0.02%
Covered Lines: 2157
Relevant Lines: 3072

💛 - Coveralls

coveralls avatar Mar 02 '22 21:03 coveralls

TAP-12 seemingly got implemented in python-tuf v1.0.0

Maybe more accurate to say Metadata API does not enforce or test that the id actually is the hex digest of the canonical form: it's possible that as an accidental result of that we are producing metadata that is not strictly conformant with that current requirement.

With the python-tuf implementation, I think that we can move TAP 12 to accepted pretty quickly. Unless there are strong objections to the TAP that will lead to major changes (which I haven't seen), I'd argue for future-proofing go-tuf by implementing TAP 12 now. It may make the implementation temporarily out of sync with the specification, but not in a major way, and not in a way that affects security (as described in more detail in the TAP).

mnm678 avatar Mar 04 '22 16:03 mnm678

Filed #232 for TAP-12.

I think we should probably block this PR on that issue. That would make sure we don't half-implement TAP-12 and accidentally fail-open.

znewman01 avatar Mar 04 '22 22:03 znewman01

As #232 is merged can we rebase this and get it reviewed @znewman01?

joshuagl avatar Jun 21 '22 16:06 joshuagl

Yup! Might be a week-ish until I get around to it.

znewman01 avatar Jun 21 '22 16:06 znewman01

np, let us know when you're ready for review!

joshuagl avatar Jun 21 '22 18:06 joshuagl

@znewman01 mind if I update this?

asraa avatar Aug 16 '22 13:08 asraa

Go for it! Let me know if you don’t find time,it had finally popped to the top of my TODO list this week but happy to have you take it off my hands

On Aug 16, 2022, at 9:48 AM, asraa @.***> wrote:

 @znewman01 mind if I update this?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.

znewman01 avatar Aug 16 '22 13:08 znewman01

@jku @mnm678 could you PTAL? TAP-12 key ID removal is done, and so is some minor go-tuf snapshot length/hashes presence bug is resolved too.

asraa avatar Aug 16 '22 14:08 asraa

LGTM though I can't review it since it's my PR

znewman01 avatar Aug 17 '22 17:08 znewman01

I'll leave it to @jku since he's best suited to review this one

trishankatdatadog avatar Aug 17 '22 17:08 trishankatdatadog

I'll leave it to @jku since he's best suited to review this one

Sorry, I'm unlikely to have a real look in the next weeks.

jku avatar Aug 18 '22 20:08 jku

I made an exception for the DCO this time.

trishankatdatadog avatar Aug 26 '22 17:08 trishankatdatadog