@govuk-pay/cli 0.0.7 → 0.0.9
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/Gemfile.lock +2 -2
- package/resources/legacy-ruby-cli/config/secrets.yml +81 -9
- package/resources/legacy-ruby-cli/config/service_secrets.yml +25 -9
- package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/config.yaml +3 -0
- package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/all.yaml +760 -0
- package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/card.yaml +508 -0
- package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/custom.yaml +71 -0
- package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/java.yaml +456 -0
- package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/services/ssl/certs/publicapi-proxy.crt +18 -0
- package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/services/ssl/keys/publicapi-proxy.key +28 -0
- package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/toolbox.yaml +473 -0
- package/resources/legacy-ruby-cli/lib/pay_cli/commands/local.rb +3 -2
- package/resources/legacy-ruby-cli/rds_access/connect.sh +30 -4
- package/resources/legacy-ruby-cli/vulnerability_scan/generate_vulnerability_report.js +52 -55
- package/resources/legacy-ruby-cli/vulnerability_scan/package.json +15 -0
- package/resources/legacy-ruby-cli/vulnerability_scan/scan.sh +56 -25
- package/resources/legacy-ruby-cli/vulnerability_scan/reports/.gitkeep +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vulnerability_scan",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "generate_vulnerability_report.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [],
|
|
10
|
+
"author": "",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"csv-stringify": "^6"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -11,46 +11,77 @@
|
|
|
11
11
|
|
|
12
12
|
set -euo pipefail
|
|
13
13
|
|
|
14
|
-
|
|
15
14
|
ACCOUNT="staging"
|
|
16
15
|
ACCOUNT_ID="888564216586"
|
|
17
|
-
|
|
16
|
+
SOURCE_DIR=$(realpath "$(dirname "${BASH_SOURCE[0]}")")
|
|
17
|
+
REPORTS_FOLDER="$SOURCE_DIR/reports"
|
|
18
|
+
ARCHITECTURE_TO_SCAN="linux/amd64"
|
|
18
19
|
|
|
19
20
|
echo "🔍 checking for dependencies..."
|
|
20
21
|
|
|
21
|
-
declare -a commands=("aws" "
|
|
22
|
+
declare -a commands=("aws" "aws-vault" "docker" "docker scout")
|
|
22
23
|
|
|
23
|
-
for
|
|
24
|
-
|
|
24
|
+
for cmd in "${commands[@]}"; do
|
|
25
|
+
# shellcheck disable=SC2086
|
|
26
|
+
if ! command -v $cmd &> /dev/null
|
|
25
27
|
then
|
|
26
|
-
echo "❌ $
|
|
28
|
+
echo "❌ $cmd"
|
|
27
29
|
exit 1
|
|
28
30
|
else
|
|
29
|
-
echo "✅ $
|
|
31
|
+
echo "✅ $cmd"
|
|
30
32
|
fi
|
|
31
33
|
done
|
|
32
34
|
|
|
33
35
|
# Login to ECR
|
|
34
|
-
echo "Logging into
|
|
35
|
-
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"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
|
51
60
|
done
|
|
52
61
|
|
|
53
|
-
|
|
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
|
|
54
85
|
|
|
55
86
|
# Clean up report JSON files once done
|
|
56
87
|
echo "Removing JSON report files..."
|
|
File without changes
|