@govuk-pay/cli 0.0.15 → 0.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/resources/legacy-ruby-cli/README.md +10 -3
- package/resources/legacy-ruby-cli/config/secrets.yml +35 -64
- package/resources/legacy-ruby-cli/config/service_secrets.yml +4 -7
- package/resources/legacy-ruby-cli/lib/pay_cli/commands/aws.rb +0 -22
- package/resources/legacy-ruby-cli/lib/pay_cli/commands/doctor.rb +0 -1
- package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/config.rb +4 -0
- package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/config.yaml +2 -0
- package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/docker.rb +33 -3
- package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/all.yaml +120 -54
- package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/card.yaml +25 -42
- package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/docker-compose.erb +110 -5
- package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/services/egress/squid.conf +47 -0
- package/resources/legacy-ruby-cli/lib/pay_cli/commands/local.rb +40 -9
- package/resources/legacy-ruby-cli/lib/pay_cli/commands/ssm.rb +7 -60
- package/resources/legacy-ruby-cli/lib/pay_cli/entry_point.rb +0 -11
- package/resources/legacy-ruby-cli/lib/pay_cli/environment.rb +1 -1
- package/resources/legacy-ruby-cli/lib/pay_cli/secrets.rb +1 -1
- package/resources/legacy-ruby-cli/lib/pay_cli/aws/document.rb +0 -23
- package/resources/legacy-ruby-cli/lib/pay_cli/ec2.rb +0 -38
- package/resources/legacy-ruby-cli/vulnerability_scan/.nvmrc +0 -1
- package/resources/legacy-ruby-cli/vulnerability_scan/generate_vulnerability_report.js +0 -88
- package/resources/legacy-ruby-cli/vulnerability_scan/package.json +0 -15
- package/resources/legacy-ruby-cli/vulnerability_scan/scan.sh +0 -88
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# Script for scanning ECR docker vulnerabilities with "docker scout cves"
|
|
4
|
-
# https://docs.docker.com/engine/reference/commandline/scout_cves/
|
|
5
|
-
|
|
6
|
-
# **** Run this from the root of pay-infra to store reports in this folder. ****
|
|
7
|
-
|
|
8
|
-
# This will take about 5 minutes unless you already have the images cached locally.
|
|
9
|
-
# You will be prompted for your aws-vault auth/MFA code.
|
|
10
|
-
# The report will be stored in reports/vulnerability_scan_report-YYYY-MM-DD.csv
|
|
11
|
-
|
|
12
|
-
set -euo pipefail
|
|
13
|
-
|
|
14
|
-
ACCOUNT="staging"
|
|
15
|
-
ACCOUNT_ID="888564216586"
|
|
16
|
-
SOURCE_DIR=$(realpath "$(dirname "${BASH_SOURCE[0]}")")
|
|
17
|
-
REPORTS_FOLDER="$SOURCE_DIR/reports"
|
|
18
|
-
ARCHITECTURE_TO_SCAN="linux/amd64"
|
|
19
|
-
|
|
20
|
-
echo "🔍 checking for dependencies..."
|
|
21
|
-
|
|
22
|
-
declare -a commands=("aws" "aws-vault" "docker" "docker scout")
|
|
23
|
-
|
|
24
|
-
for cmd in "${commands[@]}"; do
|
|
25
|
-
# shellcheck disable=SC2086
|
|
26
|
-
if ! command -v $cmd &> /dev/null
|
|
27
|
-
then
|
|
28
|
-
echo "❌ $cmd"
|
|
29
|
-
exit 1
|
|
30
|
-
else
|
|
31
|
-
echo "✅ $cmd"
|
|
32
|
-
fi
|
|
33
|
-
done
|
|
34
|
-
|
|
35
|
-
# Login to ECR
|
|
36
|
-
echo "Logging into $ACCOUNT ECR"
|
|
37
|
-
aws-vault exec "$ACCOUNT" -- aws ecr get-login-password --region eu-west-1 | docker login --username AWS --password-stdin "${ACCOUNT_ID}.dkr.ecr.eu-west-1.amazonaws.com"
|
|
38
|
-
|
|
39
|
-
IMAGES=""
|
|
40
|
-
|
|
41
|
-
# Get a all ECS clusters
|
|
42
|
-
echo "Getting list of ECS clusters"
|
|
43
|
-
CLUSTERS=$(aws-vault exec "$ACCOUNT" -- aws ecs list-clusters --query clusterArns --output text)
|
|
44
|
-
|
|
45
|
-
for CLUSTER in $CLUSTERS; do
|
|
46
|
-
echo "Checking services in cluster $CLUSTER"
|
|
47
|
-
SERVICES=$(aws-vault exec "$ACCOUNT" -- aws ecs list-services --cluster "$CLUSTER" --query 'serviceArns' --output text | xargs -n1 | sort)
|
|
48
|
-
|
|
49
|
-
for SERVICE in $SERVICES; do
|
|
50
|
-
echo "Checking for container images in service $SERVICE"
|
|
51
|
-
TASK_DEFINITION=$(\
|
|
52
|
-
aws-vault exec "$ACCOUNT" -- \
|
|
53
|
-
aws ecs describe-services --cluster "$CLUSTER" --service "$SERVICE" --query 'services[].taskDefinition' --output text
|
|
54
|
-
)
|
|
55
|
-
CONTAINER_IMAGES=$(aws-vault exec "$ACCOUNT" -- aws ecs describe-task-definition --task-definition "$TASK_DEFINITION" --query 'taskDefinition.containerDefinitions[].image' --output text)
|
|
56
|
-
for CONTAINER_IMAGE in $CONTAINER_IMAGES; do
|
|
57
|
-
IMAGES="$IMAGES $CONTAINER_IMAGE"
|
|
58
|
-
done
|
|
59
|
-
done
|
|
60
|
-
done
|
|
61
|
-
|
|
62
|
-
for IMAGE in $(xargs -n1 <<<"$IMAGES" | sort | uniq); do
|
|
63
|
-
SHORT_REPO_AND_TAG=$(cut -d'/' -f 3 <<<"$IMAGE")
|
|
64
|
-
SHORT_REPO_NAME=$(cut -f 1 -d ":" <<<"$SHORT_REPO_AND_TAG")
|
|
65
|
-
IMAGE_TAG=$(cut -f 2 -d ":" <<<"$SHORT_REPO_AND_TAG")
|
|
66
|
-
|
|
67
|
-
echo "Scanning image $IMAGE"
|
|
68
|
-
docker scout cves --format sarif --platform "$ARCHITECTURE_TO_SCAN" --output "${REPORTS_FOLDER}/${SHORT_REPO_NAME}-${IMAGE_TAG}.json" "$IMAGE"
|
|
69
|
-
done
|
|
70
|
-
|
|
71
|
-
pushd "$SOURCE_DIR" >>/dev/null 2>&1
|
|
72
|
-
|
|
73
|
-
echo "Installing node dependencies"
|
|
74
|
-
npm install
|
|
75
|
-
|
|
76
|
-
echo
|
|
77
|
-
echo "|============================================================================================"
|
|
78
|
-
echo "| Generating vulnerability report"
|
|
79
|
-
echo "|============================================================================================"
|
|
80
|
-
node "${SOURCE_DIR}/generate_vulnerability_report.js"
|
|
81
|
-
echo "|============================================================================================"
|
|
82
|
-
echo
|
|
83
|
-
|
|
84
|
-
popd >>/dev/null 2>&1
|
|
85
|
-
|
|
86
|
-
# Clean up report JSON files once done
|
|
87
|
-
echo "Removing JSON report files..."
|
|
88
|
-
rm $REPORTS_FOLDER/*.json
|