theupdateframework / tuf-on-ci

A TUF repository and signing tool
Other
22 stars 11 forks source link

empty (unused) signatures left in metadata #157

Open jku opened 10 months ago

jku commented 10 months ago

during the root-signing-staging import (https://github.com/sigstore/root-signing-staging/pull/21) the registry.npmjs.org role was changed:

After signing the metadata looked like this:

 "signatures": [
  {
   "keyid": "314ae73abd3012fc73bfcc3783e31d03852716597642b891d6a33155c4baf600",
   "sig": ""
  },
  {
   "keyid": "762cb22caca65de5e9b7b6baecb84ca989d337280ce6914b6440aea95769ad93",
   "sig": "3045022100dbcf90a4fe0364cd40017c6150c945492c6d8e775586ad9a6f0b719567a767d8022001beaa7f370a6154d9e9597bdfb424004575595e4e9b0399d81d11ded9ff8620"
  }
 ],

That first empty signature should not be there: the metadata is valid but that should not happen

jku commented 10 months ago

I think this might actually happen everytime a signer is removed. It cannot be too hard to figure out some improvement here: Options seem to be:

  1. remove the sigs when the key is removed from the delegating metadata. this means the delegated metadata changes even if there are no delegated metadata content changes... there are two options:
    • either there are still enough sigs: this does not require any action from delegated role signers assuming the signature removal is smart enough (and does not bump the metadata version). I don't think we have code this clever
      • or there are no longer enough signatures: in this case it makes sense to require more signatures -- IMO also makes sense to bump the version at this point even if that might not be 100% required
  2. when signing, check that existing sigs are valid sigs (remove any that are not)
    • this does not ensure that delegated metadata is still valid after signer removal (because delegated metadata is not signed when delegation is modified)

So the difference is mostly, do we want to make sure delegation changes don't break delegated metadata signatures (and how do we do it), see #95. Case 2 (we don't make those checks) is likely a lot easier

jku commented 10 months ago

I think what I want is:

jku commented 10 months ago

yes we're hitting this:

I believe this same thing happens in almost every case of this bug, and the issue will resolve itself on the next metadata version... so I'm inclined to not do workarounds at least at this point.

jku commented 9 months ago

After some more thought:

My opinion is that clients should be able to process metadata with invalid signatures -- and if there are enough valid signatures, must consider the metadata valid.

kommendorkapten commented 9 months ago

My opinion is that clients should be able to process metadata with invalid signatures -- and if there are enough valid signatures, must consider the metadata valid.

Agree!