Skip to content

Commit d818bf1

Browse files
authored
Add hash check for Kotlin, Minikube, AWS SAM CLI (#8596)
1 parent 567d749 commit d818bf1

File tree

3 files changed

+27
-9
lines changed

3 files changed

+27
-9
lines changed

images/linux/scripts/installers/aws.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
################################################################################
33
## File: aws.sh
44
## Desc: Installs the AWS CLI, Session Manager plugin for the AWS CLI, and AWS SAM CLI
5+
## Supply chain security: AWS SAM CLI - checksum validation
56
################################################################################
67

78
# Source the helpers for use with the script
@@ -15,11 +16,16 @@ unzip -qq /tmp/awscliv2.zip -d /tmp
1516
download_with_retries "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/ubuntu_64bit/session-manager-plugin.deb" "/tmp" "session-manager-plugin.deb"
1617
apt install /tmp/session-manager-plugin.deb
1718

18-
# Download & install the latest aws sam cli release
19-
zipName="aws-sam-cli-linux-x86_64.zip"
20-
zipUrl="https://github.com/aws/aws-sam-cli/releases/latest/download/${zipName}"
21-
download_with_retries $zipUrl "/tmp" $zipName
22-
unzip /tmp/${zipName} -d /tmp
19+
# Download the latest aws sam cli release
20+
aws_sam_cli_zip_name="aws-sam-cli-linux-x86_64.zip"
21+
download_with_retries "https://github.com/aws/aws-sam-cli/releases/latest/download/${aws_sam_cli_zip_name}" "/tmp" $aws_sam_cli_zip_name
22+
23+
# Supply chain security - AWS SAM CLI
24+
aws_sam_cli_hash=$(get_github_package_hash "aws" "aws-sam-cli" "${aws_sam_cli_zip_name}.. ")
25+
use_checksum_comparison "/tmp/${aws_sam_cli_zip_name}" "$aws_sam_cli_hash"
26+
27+
# Install the latest aws sam cli release
28+
unzip /tmp/${aws_sam_cli_zip_name} -d /tmp
2329
/tmp/install
2430

2531
invoke_tests "CLI.Tools" "AWS"

images/linux/scripts/installers/kotlin.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,22 @@
22
################################################################################
33
## File: kotlin.sh
44
## Desc: Installs Kotlin
5+
## Supply chain security: Kotlin - checksum validation
56
################################################################################
67

78
source $HELPER_SCRIPTS/install.sh
89

910
KOTLIN_ROOT="/usr/share"
10-
downloadUrl=$(get_github_package_download_url "JetBrains/kotlin" "contains(\"kotlin-compiler\")")
11-
download_with_retries "$downloadUrl" "/tmp"
11+
kotlin_zip_name="kotlin-compiler.zip"
12+
download_url=$(get_github_package_download_url "JetBrains/kotlin" "contains(\"kotlin-compiler\")")
13+
download_with_retries "$download_url" "/tmp" "$kotlin_zip_name"
1214

13-
unzip -qq /tmp/kotlin-compiler*.zip -d $KOTLIN_ROOT
15+
# Supply chain security - Kotlin
16+
kotlin_hash=$(get_github_package_hash "JetBrains" "kotlin" "kotlin-compiler" "" "latest" "false" "|" 3)
17+
use_checksum_comparison "/tmp/${kotlin_zip_name}" "$kotlin_hash"
18+
19+
unzip -qq /tmp/${kotlin_zip_name} -d $KOTLIN_ROOT
1420
rm $KOTLIN_ROOT/kotlinc/bin/*.bat
1521
ln -sf $KOTLIN_ROOT/kotlinc/bin/* /usr/bin
1622

17-
invoke_tests "Tools" "Kotlin"
23+
invoke_tests "Tools" "Kotlin"

images/linux/scripts/installers/kubernetes-tools.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
################################################################################
33
## File: kubernetes-tools.sh
44
## Desc: Installs kubectl, helm, kustomize
5+
## Supply chain security: minikube - checksum validation
56
################################################################################
67

78
# Source the helpers for use with the script
@@ -24,6 +25,11 @@ curl -fsSL https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
2425

2526
# Install minikube
2627
curl -fsSL -O https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
28+
29+
# Supply chain security - minikube
30+
minikube_hash=$(get_github_package_hash "kubernetes" "minikube" "linux-amd64" "" "latest" "false" ":" 2)
31+
use_checksum_comparison "minikube-linux-amd64" "$minikube_hash"
32+
2733
sudo install minikube-linux-amd64 /usr/local/bin/minikube
2834

2935
# Install kustomize

0 commit comments

Comments
 (0)