Skip to content

Commit 6f4c6e8

Browse files
committed
chore(cicd): add OWASP ZAP full scan
1 parent 0db1ccb commit 6f4c6e8

1 file changed

Lines changed: 46 additions & 32 deletions

File tree

.github/workflows/nodejs.yml

Lines changed: 46 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -92,37 +92,6 @@ jobs:
9292
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9393
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
9494

95-
# functional-tests:
96-
# runs-on: ubuntu-latest
97-
# needs: tests
98-
99-
# steps:
100-
# - name: Harden GitHub Actions Runner
101-
# uses: step-security/harden-runner@248ae51c2e8cc9622ecf50685c8bf7150c6e8813
102-
# with:
103-
# egress-policy: audit
104-
105-
# - name: Checkout
106-
# uses: actions/checkout@v2
107-
108-
# - name: Build docker image
109-
# run: docker build -t timoa/nodejs-encryption-api-example .
110-
111-
# - name: Start Docker container
112-
# run: docker-compose up -d
113-
114-
# - name: Check Docker container status
115-
# run: docker ps -a
116-
117-
# - name: Install dependencies
118-
# run: npm install
119-
120-
# - name: Run Functional tests
121-
# run: npm run test:functional
122-
123-
# - name: Stop Docker container
124-
# run: docker-compose down
125-
12695
# -- SAST SCAN --------------------------------------------------------------
12796
code-security:
12897
name: Code Security
@@ -145,7 +114,6 @@ jobs:
145114

146115
- name: Perform Scan
147116
uses: ShiftLeftSecurity/scan-action@master
148-
149117
env:
150118
WORKSPACE: https://github.com/${{ github.repository }}/blob/${{ github.sha }}
151119
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -156,13 +124,59 @@ jobs:
156124
name: reports
157125
path: reports
158126

127+
# -- ZAP Scan ---------------------------------------------------------------
128+
api-security:
129+
name: API Security
130+
runs-on: ubuntu-latest
131+
needs: tests
132+
# Skip any PR created by dependabot to avoid permission issues
133+
if: (github.actor != 'dependabot[bot]')
134+
135+
strategy:
136+
matrix:
137+
node: ['16']
138+
mongodb: ['5.0']
139+
140+
steps:
141+
- name: Harden GitHub Actions Runner
142+
uses: step-security/harden-runner@dd5681a7d0c66fb362664d618ef4a90d656f6516
143+
with:
144+
egress-policy: audit
145+
146+
- name: Checkout
147+
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
148+
149+
- name: Setup Node.js ${{ matrix.node }}
150+
uses: actions/setup-node@17f8bd926464a1afa4c6a11669539e9c1ba77048 # tag=v3.2.0
151+
with:
152+
node-version: ${{ matrix.node }}
153+
check-latest: true
154+
155+
- name: Install dependencies
156+
run: npm install
157+
158+
- name: Start MongoDB
159+
uses: supercharge/mongodb-github-action@e815fd8a9dfede09fd6e6c144f2c9f4875e933df # tag=1.7.0
160+
with:
161+
mongodb-version: ${{ matrix.mongodb }}
162+
mongodb-db: encryptionAPI
163+
164+
- name: Start the app
165+
run: npm start
166+
167+
- name: Run ZAP Scan
168+
uses: zaproxy/action-full-scan@v0.4.0
169+
with:
170+
target: http://localhost:3000
171+
159172
# -- PRE-RELEASE ------------------------------------------------------------
160173
pre-release:
161174
name: Prepare Release
162175
runs-on: ubuntu-latest
163176
needs:
164177
- code-quality
165178
- code-security
179+
- api-security
166180
if: github.ref == 'refs/heads/master'
167181

168182
steps:

0 commit comments

Comments
 (0)