|
3 | 3 | set -o pipefail |
4 | 4 |
|
5 | 5 | PACKAGES=( |
6 | | - "debug@4" |
7 | | - "chalk@5" |
| 6 | + "debug@4.4.1" |
| 7 | + "chalk@5.6.0" |
8 | 8 | # "debug" |
9 | 9 | # "chalk" |
10 | | - # "debug@4.4.2" |
11 | | - # "chalk@5.6.1" |
| 10 | + # "debug@4" |
| 11 | + # "chalk@5" |
12 | 12 | ) |
13 | 13 |
|
14 | | -rm -rf app |
15 | | -mkdir -p app |
16 | | -cd app |
17 | | -npm init -y |
| 14 | +if [[ "${RECREATE:-}" == "false" ]]; then |
| 15 | + cd app |
| 16 | +else |
| 17 | + rm -rf app |
| 18 | + mkdir -p app |
| 19 | + cd app |
| 20 | + npm init -y |
| 21 | +fi |
18 | 22 |
|
19 | | -# Always do a fresh install to get the latest allowed sub dependencies. |
20 | | -npm install @instana/collector --save |
21 | | -npm install @instana/serverless-collector --save |
22 | | -npm install @instana/aws-lambda --save |
23 | | -npm install @instana/aws-fargate --save |
24 | | -npm install @instana/google-cloud-run --save |
25 | | -npm install @instana/azure-container-services --save |
| 23 | +if [[ "${ONLY_SCAN:-}" != "true" ]]; then |
| 24 | + if [[ "${MODE:-}" == "local" ]]; then |
| 25 | + echo -e "\nInstalling local packages from local.\n" |
26 | 26 |
|
27 | | -echo "Checking for vulnerable packages..." |
| 27 | + # Get the version from the package.json in ../../packages/collector |
| 28 | + CURRENT_VERSION=$(node -p "require('../../../packages/collector/package.json').version") |
| 29 | + |
| 30 | + instanaPkgs=( |
| 31 | + "collector" |
| 32 | + "serverless-collector" |
| 33 | + "aws-lambda" |
| 34 | + "aws-fargate" |
| 35 | + "google-cloud-run" |
| 36 | + "azure-container-services" |
| 37 | + # Adding the sub dependencies is important, because otherwise we cannot test changes. |
| 38 | + "core" |
| 39 | + "serverless" |
| 40 | + "shared-metrics" |
| 41 | + ) |
| 42 | + |
| 43 | + cd "../../../packages" |
| 44 | + |
| 45 | + for pkg in "${instanaPkgs[@]}"; do |
| 46 | + cd "$pkg" |
| 47 | + rm -rf *.tgz |
| 48 | + npm pack |
| 49 | + cd .. |
| 50 | + done |
| 51 | + |
| 52 | + cd ../bin/vulnerability/app |
| 53 | + |
| 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 |
| 60 | + |
| 61 | + # 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 |
| 65 | + 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 |
| 72 | + fi |
| 73 | +fi |
| 74 | + |
| 75 | +echo "Checking for vulnerable packages in $PWD..." |
28 | 76 |
|
29 | 77 | for pkg in "${PACKAGES[@]}"; do |
30 | 78 | out="$(npm ls "$pkg" 2>&1 || true)" |
|
0 commit comments