image upload: use unique blob name for AWS images uploaded to S3

When uploading images to AWS, they need to be uploaded to S3 first.
Since blob names are not unique between attestation variants, there
was a possibility for one S3 upload to be used for the wrong AMI.
This commit is contained in:
Malte Poll 2024-01-17 14:07:42 +01:00
parent 6259815869
commit db645ee4ad

View File

@ -173,7 +173,7 @@ func imageVersion(csp cloudprovider.Provider, version versionsapi.Version, times
func extendAWSConfig(awsConfig map[string]any, version versionsapi.Version, attestationVariant string, timestamp time.Time) {
awsConfig["amiName"] = awsAMIName(version, attestationVariant, timestamp)
awsConfig["snapshotName"] = awsAMIName(version, attestationVariant, timestamp)
awsConfig["blobName"] = fmt.Sprintf("image-%s-%s-%d.raw", version.Stream(), version.Version(), timestamp.Unix())
awsConfig["blobName"] = fmt.Sprintf("image-%s-%s-%s-%d.raw", version.Stream(), version.Version(), attestationVariant, timestamp.Unix())
}
func awsAMIName(version versionsapi.Version, attestationVariant string, timestamp time.Time) string {