Skip to content

Commit

Permalink
image upload: use unique blob name for AWS images uploaded to S3 (#2830)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
malt3 authored Jan 17, 2024
1 parent 6259815 commit b893356
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/osimage/uplosi/uplosiupload.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit b893356

Please sign in to comment.