Skip to content

Commit 1f9b2db

Browse files
build: added SFW in the build pipeline
Ticket: VL-3832
1 parent 8b5d8de commit 1f9b2db

File tree

3 files changed

+50
-12
lines changed

3 files changed

+50
-12
lines changed

.github/workflows/ci.yml

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ permissions:
1414
contents: read
1515
pull-requests: read
1616

17+
env:
18+
SOCKET_SECURITY_MODE: monitor # Options: monitor (non-blocking) or block (fails on vulnerabilities)
19+
1720
jobs:
1821
unit-test:
1922
runs-on: ubuntu-latest
@@ -24,6 +27,10 @@ jobs:
2427
node-version: [20.x, 22.x]
2528

2629
steps:
30+
- uses: socketdev/action@v1
31+
with:
32+
mode: firewall-free
33+
2734
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2835
with:
2936
ref: ${{ github.event.pull_request.head.sha }}
@@ -58,7 +65,7 @@ jobs:
5865

5966
- name: Install Packages
6067
if: steps.lerna-cache.outputs.cache-hit != 'true' || contains( github.event.pull_request.labels.*.name, 'SKIP_CACHE')
61-
run: yarn install --with-frozen-lockfile --ignore-scripts
68+
run: sfw yarn install --with-frozen-lockfile --ignore-scripts
6269

6370
- name: Check In-Repo Package Versions
6471
run: yarn run check-versions
@@ -90,6 +97,10 @@ jobs:
9097
check: ['lint', 'format', 'commit-lint', 'dependencies', 'audit']
9198

9299
steps:
100+
- uses: socketdev/action@v1
101+
with:
102+
mode: firewall-free
103+
93104
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
94105
with:
95106
ref: ${{ github.event.pull_request.head.sha }}
@@ -110,7 +121,7 @@ jobs:
110121

111122
- name: Install Packages
112123
if: steps.lerna-cache.outputs.cache-hit != 'true' || contains( github.event.pull_request.labels.*.name, 'SKIP_CACHE')
113-
run: yarn install --with-frozen-lockfile --ignore-scripts
124+
run: sfw yarn install --with-frozen-lockfile --ignore-scripts
114125

115126
- name: Lint Source Code
116127
if: matrix.check == 'lint'
@@ -138,6 +149,10 @@ jobs:
138149
runs-on: ubuntu-latest
139150

140151
steps:
152+
- uses: socketdev/action@v1
153+
with:
154+
mode: firewall-free
155+
141156
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
142157

143158
- name: Setup node 22
@@ -156,7 +171,7 @@ jobs:
156171

157172
- name: Install Packages
158173
if: steps.lerna-cache.outputs.cache-hit != 'true'
159-
run: yarn install --with-frozen-lockfile --ignore-scripts
174+
run: sfw yarn install --with-frozen-lockfile --ignore-scripts
160175

161176
- name: build packages
162177
env:
@@ -175,6 +190,10 @@ jobs:
175190
runs-on: ubuntu-22.04
176191

177192
steps:
193+
- uses: socketdev/action@v1
194+
with:
195+
mode: firewall-free
196+
178197
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
179198
with:
180199
ref: ${{ github.event.pull_request.head.sha }}
@@ -249,7 +268,7 @@ jobs:
249268

250269
- name: Install Packages
251270
if: steps.lerna-cache.outputs.cache-hit != 'true' || contains( github.event.pull_request.labels.*.name, 'SKIP_CACHE')
252-
run: yarn install --with-frozen-lockfile
271+
run: sfw yarn install --with-frozen-lockfile
253272

254273
- name: build packages
255274
if: steps.lerna-cache.outputs.cache-hit == 'true'
@@ -295,6 +314,7 @@ jobs:
295314
VERSION=${{ steps.build-info.outputs.version }}
296315
BUILD_DATE=${{ steps.build-info.outputs.date }}
297316
GIT_HASH=${{ github.sha }}
317+
SOCKET_SECURITY_MODE=${{ env.SOCKET_SECURITY_MODE }}
298318
299319
- name: Test Express Docker image
300320
id: docker-test
@@ -338,6 +358,10 @@ jobs:
338358
runs-on: ubuntu-latest
339359

340360
steps:
361+
- uses: socketdev/action@v1
362+
with:
363+
mode: firewall-free
364+
341365
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
342366
with:
343367
ref: ${{ github.event.pull_request.head.sha }}
@@ -358,7 +382,7 @@ jobs:
358382

359383
- name: Install Packages
360384
if: steps.lerna-cache.outputs.cache-hit != 'true' || contains( github.event.pull_request.labels.*.name, 'SKIP_CACHE')
361-
run: yarn install --with-frozen-lockfile --ignore-scripts
385+
run: sfw yarn install --with-frozen-lockfile --ignore-scripts
362386

363387
- name: Check Dockerfile is up to date
364388
run: |
@@ -373,6 +397,10 @@ jobs:
373397
runs-on: ubuntu-latest
374398

375399
steps:
400+
- uses: socketdev/action@v1
401+
with:
402+
mode: firewall-free
403+
376404
- name: Checkout PR
377405
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
378406
with:
@@ -394,15 +422,15 @@ jobs:
394422

395423
- name: Install Packages
396424
if: steps.lerna-cache.outputs.cache-hit != 'true'
397-
run: yarn install --with-frozen-lockfile --ignore-scripts
425+
run: sfw yarn install --with-frozen-lockfile --ignore-scripts
398426

399427
- name: Build packages
400428
env:
401429
DISABLE_V8_COMPILE_CACHE: '1'
402430
run: yarn run postinstall
403431

404432
- name: Install OpenAPI Generator at root
405-
run: yarn add -W @api-ts/openapi-generator@v5
433+
run: sfw yarn add -W @api-ts/openapi-generator@v5
406434

407435
- name: Download and install vacuum v0.18.1
408436
run: |

.github/workflows/publish.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,19 @@ permissions:
1111
concurrency:
1212
group: ${{ github.workflow }}-${{ github.ref }}
1313

14+
env:
15+
SOCKET_SECURITY_MODE: monitor # Options: monitor (non-blocking) or block (fails on vulnerabilities)
16+
1417
jobs:
1518
publish:
1619
name: Publish Release
1720
runs-on: ubuntu-latest
1821

1922
steps:
23+
- uses: socketdev/action@v1
24+
with:
25+
mode: firewall-free
26+
2027
- name: Checkout repository
2128
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2229

@@ -26,7 +33,7 @@ jobs:
2633
node-version-file: .nvmrc
2734

2835
- name: Install BitGoJS
29-
run: yarn install --with-frozen-lockfile
36+
run: sfw yarn install --with-frozen-lockfile
3037

3138
- name: Set Environment Variable for Alpha
3239
if: github.ref != 'refs/heads/master' # only publish changes if on feature branches
@@ -56,7 +63,7 @@ jobs:
5663
npx tsx ./scripts/prepare-release.ts ${{ env.preid }}
5764
5865
- name: Rebuild packages
59-
run: yarn
66+
run: sfw yarn
6067

6168
- name: Commit Local Changes
6269
run: git commit -am "Auto updated ${{ env.preid }} branch" --no-verify || echo "No changes to commit"

Dockerfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,23 @@ COPY modules ./modules
1313
RUN find modules \! -name "package.json" -mindepth 2 -maxdepth 2 -print | xargs rm -rf
1414

1515
FROM node:22.16.0-bookworm-slim@sha256:2f3571619daafc6b53232ebf2fcc0817c1e64795e92de317c1684a915d13f1a5 AS builder
16+
ARG SOCKET_SECURITY_MODE=monitor
17+
ENV SOCKET_SECURITY_MODE=${SOCKET_SECURITY_MODE}
1618
RUN apt-get update && apt-get install -y git python3 make g++ libtool autoconf automake
19+
RUN npm i -g sfw
1720
WORKDIR /tmp/bitgo
1821
COPY --from=filter-packages-json /tmp/bitgo .
1922
# (skip postinstall) https://github.com/yarnpkg/yarn/issues/4100#issuecomment-388944260
20-
RUN NOYARNPOSTINSTALL=1 yarn install --pure-lockfile --network-timeout 120000
23+
RUN NOYARNPOSTINSTALL=1 sfw yarn install --pure-lockfile --network-timeout 120000
2124

2225
COPY . .
2326
RUN \
2427
# clean up unnecessary local node_modules and dist
2528
rm -rf modules/**/node_modules modules/**/dist && \
2629
# install with dev deps so we can run the prepare script
27-
yarn install --frozen-lockfile && \
30+
sfw yarn install --frozen-lockfile && \
2831
# install again to prune dev deps
29-
yarn install --production --frozen-lockfile --non-interactive --ignore-scripts && \
32+
sfw yarn install --production --frozen-lockfile --non-interactive --ignore-scripts && \
3033
# remove any src code leftover (we only want dist)
3134
rm -r modules/*/src
3235

0 commit comments

Comments
 (0)