Skip to content

Commit f0a514c

Browse files
build: upgrade dependencies (#870)
## What This PR reapplies #866 that was previously reverted in #869. It contains upgrade for multiple dependencies to address critical- and high-level CVE. In addition to #866, it: * upgrades `npm` to address [CVE-2024-21538](https://scout.docker.com/vulnerabilities/id/CVE-2024-21538?s=github&n=cross-spawn&t=npm&vr=%3E%3D7.0.0%2C%3C7.0.5&utm_source=desktop&utm_medium=ExternalLink). * Sets `NODE_NO_WARNINGS=1` env in Dockerfile ([ref](https://nodejs.org/api/cli.html#node_no_warnings1)) in order to suppress Node.js deprecation warnings, that may interrupt end-user automations, that rely on exact CLi output. * Migrates from `pkg`, which is no longer maintained, to its fork `@yao-pkg/pkg`.
1 parent 7e49659 commit f0a514c

7 files changed

+2782
-2529
lines changed

.nvmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v18.17.1
1+
v22.11.0

Dockerfile

+8-13
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,39 @@
11
# go hub binary
2-
FROM golang:alpine as go
2+
FROM golang:alpine AS go
33
RUN apk --update add ca-certificates git
44
RUN go install github.com/github/hub@latest
55

66
# python yq binary
7-
FROM six8/pyinstaller-alpine:alpine-3.6-pyinstaller-v3.4 as yq
7+
FROM six8/pyinstaller-alpine:alpine-3.6-pyinstaller-v3.4 AS yq
88
ARG YQ_VERSION=2.10.0
99
ENV PATH="/pyinstaller:$PATH"
1010
RUN pip install yq==${YQ_VERSION}
1111
RUN pyinstaller --noconfirm --onefile --log-level DEBUG --clean --distpath /tmp/ $(which yq)
1212

1313
# kubectl binary
14-
FROM bitnami/kubectl:1.27.4 as kubectl
14+
FROM bitnami/kubectl:1.30.6 AS kubectl
1515

1616
# Main
17-
FROM node:18.17.1-alpine3.18
18-
17+
FROM node:22.11.0-alpine3.20
1918
RUN apk --update add --no-cache \
2019
bash \
2120
ca-certificates \
2221
curl \
2322
git \
2423
jq
25-
24+
RUN npm upgrade -g npm
2625
COPY --from=go /go/bin/hub /usr/local/bin/hub
2726
COPY --from=yq /tmp/yq /usr/local/bin/yq
2827
COPY --from=kubectl /opt/bitnami/kubectl/bin/kubectl /usr/local/bin/
29-
3028
WORKDIR /cf-cli
31-
3229
COPY package.json yarn.lock check-version.js run-check-version.js /cf-cli/
33-
3430
RUN yarn install --prod --frozen-lockfile && \
3531
yarn cache clean
36-
3732
COPY . /cf-cli
38-
3933
RUN yarn generate-completion
40-
4134
RUN ln -s $(pwd)/lib/interface/cli/codefresh /usr/local/bin/codefresh
42-
4335
RUN codefresh components update --location components
36+
37+
# Node.js warnings must be suppressed to ensure that automations relying on exact output are not disrupted
38+
ENV NODE_NO_WARNINGS=1
4439
ENTRYPOINT ["codefresh"]

Dockerfile-debian

+5-11
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ RUN pip install yq==${YQ_VERSION}
1111
RUN pyinstaller --noconfirm --onefile --log-level DEBUG --clean --distpath /tmp/ $(which yq)
1212

1313
# kubectl binary
14-
FROM bitnami/kubectl:1.27.4 as kubectl
14+
FROM bitnami/kubectl:1.30.6 as kubectl
1515

1616
# Main
17-
FROM node:18.17.1-bullseye-slim
18-
17+
FROM node:22.11.0-bullseye-slim
1918
RUN apt update \
2019
&& apt -y install \
2120
apt-transport-https \
@@ -26,24 +25,19 @@ RUN apt update \
2625
git \
2726
jq \
2827
&& ln -s /bin/busybox /usr/bin/[[
29-
28+
RUN npm upgrade -g npm
3029
COPY --from=go /go/bin/hub /usr/local/bin/hub
3130
COPY --from=yq /tmp/yq /usr/local/bin/yq
3231
COPY --from=kubectl /opt/bitnami/kubectl/bin/kubectl /usr/local/bin/
33-
3432
WORKDIR /cf-cli
35-
3633
COPY package.json yarn.lock check-version.js run-check-version.js /cf-cli/
37-
3834
RUN yarn install --prod --frozen-lockfile && \
3935
yarn cache clean
40-
4136
COPY . /cf-cli
42-
4337
RUN yarn generate-completion
44-
4538
RUN ln -s $(pwd)/lib/interface/cli/codefresh /usr/local/bin/codefresh
46-
4739
RUN codefresh components update --location components
4840

41+
# Node.js warnings must be suppressed to ensure that automations relying on exact output are not disrupted
42+
ENV NODE_NO_WARNINGS=1
4943
ENTRYPOINT ["codefresh"]

Dockerfile-debian-rootless

+5-13
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ RUN pip install yq==${YQ_VERSION}
1111
RUN pyinstaller --noconfirm --onefile --log-level DEBUG --clean --distpath /tmp/ $(which yq)
1212

1313
# kubectl binary
14-
FROM bitnami/kubectl:1.27.4 as kubectl
14+
FROM bitnami/kubectl:1.30.6 as kubectl
1515

1616
# Main
17-
FROM node:18.17.1-bullseye-slim
18-
17+
FROM node:22.11.0-bullseye-slim
1918
RUN apt update \
2019
&& apt -y install \
2120
bash \
@@ -25,26 +24,18 @@ RUN apt update \
2524
git \
2625
jq \
2726
&& ln -s /bin/busybox /usr/bin/[[
28-
27+
RUN npm upgrade -g npm
2928
COPY --from=go /go/bin/hub /usr/local/bin/hub
3029
COPY --from=yq /tmp/yq /usr/local/bin/yq
3130
COPY --from=kubectl /opt/bitnami/kubectl/bin/kubectl /usr/local/bin/
32-
3331
WORKDIR /cf-cli
34-
3532
COPY package.json yarn.lock check-version.js run-check-version.js /cf-cli/
36-
3733
RUN yarn install --prod --frozen-lockfile && \
3834
yarn cache clean
39-
4035
COPY . /cf-cli
41-
4236
RUN yarn generate-completion
43-
4437
RUN ln -s $(pwd)/lib/interface/cli/codefresh /usr/local/bin/codefresh
45-
4638
RUN codefresh components update --location components
47-
4839
# we keep /root as home directory because cli by default looks for $HOME/.cfconfig
4940
# and we do not want to break user automation if they used to bind their .cfconfig
5041
# to the /root/.cfconfig
@@ -53,6 +44,7 @@ RUN useradd -m -d /root -s /bin/sh cfu \
5344
&& chgrp -R $(id -g cfu) /root /cf-cli \
5445
&& chmod -R g+rwX /root
5546

47+
# Node.js warnings must be suppressed to ensure that automations relying on exact output are not disrupted
48+
ENV NODE_NO_WARNINGS=1
5649
USER cfu
57-
5850
ENTRYPOINT ["codefresh"]

Dockerfile-rootless

+5-13
Original file line numberDiff line numberDiff line change
@@ -11,37 +11,28 @@ RUN pip install yq==${YQ_VERSION}
1111
RUN pyinstaller --noconfirm --onefile --log-level DEBUG --clean --distpath /tmp/ $(which yq)
1212

1313
# kubectl binary
14-
FROM bitnami/kubectl:1.27.4 as kubectl
14+
FROM bitnami/kubectl:1.30.6 as kubectl
1515

1616
# Main
17-
FROM node:18.17.1-alpine3.18
18-
17+
FROM node:22.11.0-alpine3.20
1918
RUN apk --update add --no-cache \
2019
bash \
2120
ca-certificates \
2221
curl \
2322
git \
2423
jq
25-
24+
RUN npm upgrade -g npm
2625
COPY --from=go /go/bin/hub /usr/local/bin/hub
2726
COPY --from=yq /tmp/yq /usr/local/bin/yq
2827
COPY --from=kubectl /opt/bitnami/kubectl/bin/kubectl /usr/local/bin/
29-
3028
WORKDIR /cf-cli
31-
3229
COPY package.json yarn.lock check-version.js run-check-version.js /cf-cli/
33-
3430
RUN yarn install --prod --frozen-lockfile && \
3531
yarn cache clean
36-
3732
COPY . /cf-cli
38-
3933
RUN yarn generate-completion
40-
4134
RUN ln -s $(pwd)/lib/interface/cli/codefresh /usr/local/bin/codefresh
42-
4335
RUN codefresh components update --location components
44-
4536
# we keep /root as home directory because cli by default looks for $HOME/.cfconfig
4637
# and we do not want to break user automation if they used to bind their .cfconfig
4738
# to the /root/.cfconfig
@@ -50,6 +41,7 @@ RUN adduser -D -h /root -s /bin/sh cfu \
5041
&& chgrp -R $(id -g cfu) /root /cf-cli \
5142
&& chmod -R g+rwX /root
5243

44+
# Node.js warnings must be suppressed to ensure that automations relying on exact output are not disrupted
45+
ENV NODE_NO_WARNINGS=1
5346
USER cfu
54-
5547
ENTRYPOINT ["codefresh"]

package.json

+10-16
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codefresh",
3-
"version": "0.88.2",
3+
"version": "0.88.3",
44
"description": "Codefresh command line utility",
55
"main": "index.js",
66
"preferGlobal": true,
@@ -9,7 +9,7 @@
99
"test": "jest .spec.js --coverage",
1010
"e2e": "bash e2e/e2e.spec.sh",
1111
"eslint": "eslint --fix lib/logic/**",
12-
"pkg": "pkg . -t node16-alpine-x64,node16-alpine-arm64,node16-macos-x64,node16-linux-x64,node16-win-x64,node16-linux-arm64 --out-path ./dist",
12+
"pkg": "npx pkg . -t node22-alpine-x64,node22-alpine-arm64,node22-macos-x64,node22-linux-x64,node22-win-x64,node22-linux-arm64 --out-path ./dist",
1313
"serve-docs": "yarn build-local-docs && cd temp && hugo server -D",
1414
"serve-docs-beta": "ALLOW_BETA_COMMANDS=true yarn build-local-docs && cd temp && hugo server -D",
1515
"build-local-docs": "node ./docs/index.js",
@@ -32,17 +32,10 @@
3232
"assets": "lib/**/*.hbs"
3333
},
3434
"resolutions": {
35-
"websocket-extensions": "^0.1.4",
36-
"lodash": "^4.17.21",
3735
"json-schema": "^0.4.0",
38-
"ajv": "^6.12.6",
39-
"normalize-url": "^4.5.1",
4036
"ansi-regex": "^5.0.1",
41-
"y18n": "^4.0.1",
42-
"shelljs": "^0.8.5",
43-
"codefresh-sdk/swagger-client/qs": "6.9.7",
44-
"kubernetes-client/qs": "6.9.7",
45-
"**/request/qs": "6.5.3"
37+
"kubernetes-client/@kubernetes/client-node": ">=0.22.2",
38+
"tough-cookie": "^4.1.3"
4639
},
4740
"dependencies": {
4841
"@codefresh-io/docker-reference": "^0.0.5",
@@ -64,7 +57,7 @@
6457
"figlet": "^1.4.0",
6558
"filesize": "^3.5.11",
6659
"firebase": "git+https://github.com/codefresh-io/firebase.git#80b2ed883ff281cd67b53bd0f6a0bbd6f330fed5",
67-
"flat": "^4.1.1",
60+
"flat": "^5.0.2",
6861
"inquirer": "^7.1.0",
6962
"js-yaml": "^3.10.0",
7063
"kefir": "^3.8.1",
@@ -79,7 +72,7 @@
7972
"promise-retry": "^2.0.1",
8073
"recursive-readdir": "^2.2.3",
8174
"request": "^2.88.0",
82-
"request-promise": "^4.2.2",
75+
"request-promise": "^4.2.6",
8376
"requestretry": "^7.0.2",
8477
"rimraf": "^2.6.2",
8578
"semver": "^7.5.4",
@@ -92,13 +85,13 @@
9285
},
9386
"devDependencies": {
9487
"@types/node-forge": "^1.0.1",
88+
"@yao-pkg/pkg": "^6.1.1",
9589
"eslint": "^7.32.0",
9690
"eslint-config-airbnb-base": "^15.0.0",
9791
"eslint-plugin-import": "^2.25.4",
9892
"eslint-plugin-jest": "^27.6.3",
9993
"hugo-cli": "^0.5.4",
100-
"jest": "^29.7.0",
101-
"pkg": "5.5.2"
94+
"jest": "^29.7.0"
10295
},
10396
"bugs": {
10497
"url": "https://github.com/codefresh-io/cli/issues"
@@ -114,5 +107,6 @@
114107
"setupFiles": [
115108
"./test-setup.js"
116109
]
117-
}
110+
},
111+
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
118112
}

0 commit comments

Comments
 (0)