Migrate to a digest
field instead of a of sha1
field in Kilnfile.lock
#297
Labels
digest
field instead of a of sha1
field in Kilnfile.lock
#297
We need to download releases whenever we update in order to calculate their sha1 sum. Most release sources support some other more secure algorithm. Usually shas256. We should use that and skip the downloads when we don't need it. Using sha256 might also be useful in creating a standards compliant software bill of materials.
Acceptance Criteria
The algorithm is based on the release source
Given a component release source natively supports a hashing algorithm
When a the component lock is created by GetMatchedRelease
Then a field
Digest
is set with that a value matching the component specDigest field spec
The following spec uses a modified BNF. The spec is a simplified version of (based on OCI image-spec).
The code can rely on a set digest field
Given a Kilnfile.lock has a field with key
sha1
matchingencoded
When the Kilnfile.lock is loaded
Then the cargo.ComponentLock has a field named
Digest
in Go and yaml keydigest
And the value is a digest with algorithm "sha1"
Backwards compatibility of Kiln with older Kilnfile.lock files
Code should not access the Digest field on a cargo.ComponentLock but should use a method returning both the digest and the encoded hash.
The SHA1 field on the Lock should be marked as deprecated and renamed (without IDE support) to something like LegacySHA1. All code accessing the SHA1 field should now use the new method.
Kilnfile.lock Migration Path
kiln update --hash
will download all releases calculate their sums and set the digest values with the sha256 algorithmkiln update
will calculate and set both the sha1 and digest fields for updated releasesReferences
We could support the full spec with minimal effort. This is a simplification so we can make an iterative change.
The text was updated successfully, but these errors were encountered: