gittuf / gittuf

A security layer for Git repositories
https://gittuf.dev
Apache License 2.0
439 stars 28 forks source link

Re-design ssh Key as Verifier only #433

Closed lukpueh closed 2 weeks ago

lukpueh commented 2 weeks ago

Previously, ssh Key satisfied both the dsse.Verifier interface and served as TUF metadata key container. Unfortunately, it didn't seem feasible to wire up the key container with the current TUF metadata implementation, which uses SSlibKey.

This commit re-designs the ssh key implementation to use SSlibKey as key container and a separate Verifier for verification.

See https://github.com/gittuf/gittuf/pull/429#issuecomment-2151588628 for more detailed design considerations.

Change details:

lukpueh commented 2 weeks ago

Note that unlike #429, this PR does not add a "ssh Verifier to SSlibKey" conversion function, because with the re-design there does not seem to be a use case.

The general workflow should be:

  1. Import SSlibKey from ssh key file
  2. Add to TUF metadata, or cache otherwise
  3. Convert Key to Verifier when verifying a related signature
lukpueh commented 2 weeks ago

Btw. creating a Signer is currently a bit cumbersome:

https://github.com/gittuf/gittuf/blob/bd5d1d715414e66910e00fa1bc0d23e642af60cb/internal/signerverifier/dsse/dsse_test.go#L65-L78

NewSignerFromFile(path string) or NewSignerFromKey(key SSLibKey, path string) functions would be helpful. I can add those in a separate PR, if there is a need.