|
3 | 3 | set -o pipefail |
4 | 4 |
|
5 | 5 | PACKAGES=( |
6 | | - "debug@4.4.2" |
7 | | - "chalk@5.6.1" |
8 | | - # "debug" |
9 | | - # "chalk" |
10 | | - # "debug@4" |
11 | | - # "chalk@5" |
| 6 | + $(<./packages.txt) |
12 | 7 | ) |
13 | 8 |
|
14 | 9 | if [[ "${RECREATE:-}" == "false" ]]; then |
15 | 10 | cd app |
16 | 11 | else |
| 12 | + echo -e "\n🧹 Creating the test app.\n" |
17 | 13 | rm -rf app |
18 | 14 | mkdir -p app |
19 | 15 | cd app |
20 | | - npm init -y |
| 16 | + npm init -y >/dev/null |
21 | 17 | fi |
22 | 18 |
|
23 | 19 | if [[ "${ONLY_SCAN:-}" != "true" ]]; then |
24 | 20 | if [[ "${MODE:-}" == "local" ]]; then |
25 | | - echo -e "\nInstalling local packages from local.\n" |
| 21 | + echo -e "\n💁♀️ Installing local packages from local.\n" |
26 | 22 |
|
27 | 23 | # Get the version from the package.json in ../../packages/collector |
28 | 24 | CURRENT_VERSION=$(node -p "require('../../../packages/collector/package.json').version") |
@@ -51,36 +47,47 @@ if [[ "${ONLY_SCAN:-}" != "true" ]]; then |
51 | 47 |
|
52 | 48 | cd ../bin/vulnerability/app |
53 | 49 |
|
54 | | - npm install ../../../packages/collector/instana-collector-${CURRENT_VERSION}.tgz --save |
55 | | - npm install ../../../packages/serverless-collector/instana-serverless-collector-${CURRENT_VERSION}.tgz --save |
56 | | - npm install ../../../packages/aws-lambda/instana-aws-lambda-${CURRENT_VERSION}.tgz --save |
57 | | - npm install ../../../packages/aws-fargate/instana-aws-fargate-${CURRENT_VERSION}.tgz --save |
58 | | - npm install ../../../packages/google-cloud-run/instana-google-cloud-run-${CURRENT_VERSION}.tgz --save |
59 | | - npm install ../../../packages/azure-container-services/instana-azure-container-services-${CURRENT_VERSION}.tgz --save |
| 50 | + npm install ../../../packages/collector/instana-collector-${CURRENT_VERSION}.tgz --save >/dev/null |
| 51 | + npm install ../../../packages/serverless-collector/instana-serverless-collector-${CURRENT_VERSION}.tgz --save >/dev/null |
| 52 | + npm install ../../../packages/aws-lambda/instana-aws-lambda-${CURRENT_VERSION}.tgz --save >/dev/null |
| 53 | + npm install ../../../packages/aws-fargate/instana-aws-fargate-${CURRENT_VERSION}.tgz --save >/dev/null |
| 54 | + npm install ../../../packages/google-cloud-run/instana-google-cloud-run-${CURRENT_VERSION}.tgz --save >/dev/null |
| 55 | + npm install ../../../packages/azure-container-services/instana-azure-container-services-${CURRENT_VERSION}.tgz --save >/dev/null |
60 | 56 |
|
61 | 57 | # Simulate that the sub dependencies got updated (override!) |
62 | | - npm install ../../../packages/core/instana-core-${CURRENT_VERSION}.tgz --save |
63 | | - npm install ../../../packages/serverless/instana-serverless-${CURRENT_VERSION}.tgz -- |
64 | | - npm install ../../../packages/shared-metrics/instana-shared-metrics-${CURRENT_VERSION}.tgz --save |
| 58 | + npm install ../../../packages/core/instana-core-${CURRENT_VERSION}.tgz --save >/dev/null |
| 59 | + npm install ../../../packages/serverless/instana-serverless-${CURRENT_VERSION}.tgz --save >/dev/null |
| 60 | + npm install ../../../packages/shared-metrics/instana-shared-metrics-${CURRENT_VERSION}.tgz --save >/dev/null |
65 | 61 | else |
66 | | - npm install @instana/collector --save |
67 | | - npm install @instana/serverless-collector --save |
68 | | - npm install @instana/aws-lambda --save |
69 | | - npm install @instana/aws-fargate --save |
70 | | - npm install @instana/google-cloud-run --save |
71 | | - npm install @instana/azure-container-services --save |
| 62 | + echo -e "\n💁♀️ Installing released packages.\n" |
| 63 | + npm install @instana/collector --save >/dev/null |
| 64 | + npm install @instana/serverless-collector --save >/dev/null |
| 65 | + npm install @instana/aws-lambda --save >/dev/null |
| 66 | + npm install @instana/aws-fargate --save >/dev/null |
| 67 | + npm install @instana/google-cloud-run --save >/dev/null |
| 68 | + npm install @instana/azure-container-services --save >/dev/null |
72 | 69 | fi |
73 | 70 | fi |
74 | 71 |
|
75 | | -echo "Checking for vulnerable packages in $PWD..." |
| 72 | +echo -e "🧐 Checking for vulnerable packages\n" |
| 73 | +echo -e "-----------------------------------\n" |
76 | 74 |
|
77 | 75 | for pkg in "${PACKAGES[@]}"; do |
78 | 76 | out="$(npm ls --all "$pkg" 2>&1 || true)" |
79 | 77 |
|
80 | | - echo -e "\n" |
81 | | - |
82 | 78 | if printf "%s" "$out" | grep -q "(empty)"; then |
83 | | - echo "✅ $pkg is not a dependency of Instana." |
| 79 | + echo "✅ No direct dependency on $pkg" |
| 80 | + packageName="${pkg%@*}" |
| 81 | + out2="$(npm ls --all "$packageName" 2>&1 || true)" |
| 82 | + |
| 83 | + if ! printf "%s" "$out2" | grep -q "(empty)"; then |
| 84 | + echo "⚠️ BUT $packageName is general dependency of Instana. Please investigate!" |
| 85 | + echo -e "\n" |
| 86 | + printf "%s" "$out2" |
| 87 | + echo -e "\n" |
| 88 | + else |
| 89 | + echo "✅ No issues with $pkg" |
| 90 | + fi |
84 | 91 | else |
85 | 92 | printf "❌ COMPROMISED $pkg" |
86 | 93 | echo -e "\n" |
|
0 commit comments