Skip to content

Commit f9d6875

Browse files
committed
chore: scanned more packages
refs https://jsw.ibm.com/browse/INSTA-55012
1 parent 282a1af commit f9d6875

File tree

2 files changed

+517
-27
lines changed

2 files changed

+517
-27
lines changed

bin/vulnerability/find-dependencies.sh

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,22 @@
33
set -o pipefail
44

55
PACKAGES=(
6-
"debug@4.4.2"
7-
"chalk@5.6.1"
8-
# "debug"
9-
# "chalk"
10-
# "debug@4"
11-
# "chalk@5"
6+
$(<./packages.txt)
127
)
138

149
if [[ "${RECREATE:-}" == "false" ]]; then
1510
cd app
1611
else
12+
echo -e "\n🧹 Creating the test app.\n"
1713
rm -rf app
1814
mkdir -p app
1915
cd app
20-
npm init -y
16+
npm init -y >/dev/null
2117
fi
2218

2319
if [[ "${ONLY_SCAN:-}" != "true" ]]; then
2420
if [[ "${MODE:-}" == "local" ]]; then
25-
echo -e "\nInstalling local packages from local.\n"
21+
echo -e "\n💁‍♀️ Installing local packages from local.\n"
2622

2723
# Get the version from the package.json in ../../packages/collector
2824
CURRENT_VERSION=$(node -p "require('../../../packages/collector/package.json').version")
@@ -51,36 +47,47 @@ if [[ "${ONLY_SCAN:-}" != "true" ]]; then
5147

5248
cd ../bin/vulnerability/app
5349

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
6056

6157
# 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
6561
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
7269
fi
7370
fi
7471

75-
echo "Checking for vulnerable packages in $PWD..."
72+
echo -e "🧐 Checking for vulnerable packages\n"
73+
echo -e "-----------------------------------\n"
7674

7775
for pkg in "${PACKAGES[@]}"; do
7876
out="$(npm ls --all "$pkg" 2>&1 || true)"
7977

80-
echo -e "\n"
81-
8278
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
8491
else
8592
printf "❌ COMPROMISED $pkg"
8693
echo -e "\n"

0 commit comments

Comments
 (0)