Skip to content
This repository was archived by the owner on Oct 14, 2020. It is now read-only.

Commit 9516e7d

Browse files
authored
Merge pull request #12 from secureCodeBox/bug/hook-sdk-patching-crash
Fix crash in Hook SDK
2 parents 6b0e5f8 + 70105de commit 9516e7d

File tree

21 files changed

+88
-53
lines changed

21 files changed

+88
-53
lines changed

.github/workflows/ci.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ jobs:
102102
path: ./parser-sdk/nodejs/
103103
tag_with_ref: true
104104
tag_with_sha: true
105+
tags: "ci-local"
105106
# Actual Parsers
106107
- uses: docker/build-push-action@v1
107108
name: "Build & Push Amass Parser Image"
@@ -112,6 +113,7 @@ jobs:
112113
path: ./scanner/amass/parser/
113114
tag_with_ref: true
114115
tag_with_sha: true
116+
build_args: baseImageTag=ci-local
115117
- uses: docker/build-push-action@v1
116118
name: "Build & Push kube-hunter Parser Image"
117119
with:
@@ -121,6 +123,7 @@ jobs:
121123
path: ./scanner/kube-hunter/parser/
122124
tag_with_ref: true
123125
tag_with_sha: true
126+
build_args: baseImageTag=ci-local
124127
- uses: docker/build-push-action@v1
125128
name: "Build & Push Nikto Parser Image"
126129
with:
@@ -130,6 +133,7 @@ jobs:
130133
path: ./scanner/nikto/parser/
131134
tag_with_ref: true
132135
tag_with_sha: true
136+
build_args: baseImageTag=ci-local
133137
- uses: docker/build-push-action@v1
134138
name: "Build & Push Nmap Parser Image"
135139
with:
@@ -139,6 +143,7 @@ jobs:
139143
path: ./scanner/nmap/parser/
140144
tag_with_ref: true
141145
tag_with_sha: true
146+
build_args: baseImageTag=ci-local
142147
- uses: docker/build-push-action@v1
143148
name: "Build & Push ssh_scan Parser Image"
144149
with:
@@ -148,6 +153,7 @@ jobs:
148153
path: ./scanner/ssh_scan/parser/
149154
tag_with_ref: true
150155
tag_with_sha: true
156+
build_args: baseImageTag=ci-local
151157
- uses: docker/build-push-action@v1
152158
name: "Build & Push SSLyze Parser Image"
153159
with:
@@ -157,6 +163,7 @@ jobs:
157163
path: ./scanner/sslyze/parser/
158164
tag_with_ref: true
159165
tag_with_sha: true
166+
build_args: baseImageTag=ci-local
160167
- uses: docker/build-push-action@v1
161168
name: "Build & Push test-scan Parser Image"
162169
with:
@@ -166,6 +173,7 @@ jobs:
166173
path: ./scanner/test-scan/parser/
167174
tag_with_ref: true
168175
tag_with_sha: true
176+
build_args: baseImageTag=ci-local
169177
- uses: docker/build-push-action@v1
170178
name: "Build & Push Trivy Parser Image"
171179
with:
@@ -175,6 +183,7 @@ jobs:
175183
path: ./scanner/trivy/parser/
176184
tag_with_ref: true
177185
tag_with_sha: true
186+
build_args: baseImageTag=ci-local
178187
- uses: docker/build-push-action@v1
179188
name: "Build & Push OWASP Zap Parser Image"
180189
with:
@@ -184,6 +193,7 @@ jobs:
184193
path: ./scanner/zap/parser/
185194
tag_with_ref: true
186195
tag_with_sha: true
196+
build_args: baseImageTag=ci-local
187197
hookImages:
188198
name: "Build / Hooks"
189199
runs-on: ubuntu-latest
@@ -198,6 +208,7 @@ jobs:
198208
repository: scbexperimental/hook-sdk-nodejs
199209
path: ./hook-sdk/nodejs/
200210
tag_with_ref: true
211+
tags: "ci-local"
201212
# Actual PersistenceProviders
202213
- uses: docker/build-push-action@v1
203214
name: "Build & Push Elastic PersistenceProvider Hook Image"
@@ -207,6 +218,7 @@ jobs:
207218
repository: scbexperimental/persistence-elastic
208219
path: ./hooks/persistence-elastic/
209220
tag_with_ref: true
221+
build_args: baseImageTag=ci-local
210222
- uses: docker/build-push-action@v1
211223
name: "Build & Push Elastic PersistenceProvider Dashboard Importer Image"
212224
with:
@@ -223,6 +235,7 @@ jobs:
223235
repository: scbexperimental/generic-webhook
224236
path: ./hooks/generic-webhook/
225237
tag_with_ref: true
238+
build_args: baseImageTag=ci-local
226239
- uses: docker/build-push-action@v1
227240
name: "Build & Push ImperativeSubsequentScans Hook Image"
228241
with:
@@ -231,6 +244,7 @@ jobs:
231244
repository: scbexperimental/hook-imperative-subsequent-scans
232245
path: ./hooks/imperative-subsequent-scans/
233246
tag_with_ref: true
247+
build_args: baseImageTag=ci-local
234248
- uses: docker/build-push-action@v1
235249
name: "Build & Push UpdateField Hook Image"
236250
with:
@@ -240,6 +254,7 @@ jobs:
240254
path: ./hooks/update-field/
241255
tag_with_ref: true
242256
tag_with_sha: true
257+
build_args: baseImageTag=ci-local
243258
scannerImages:
244259
# Note we only build images for scanner that don't provider official public container images
245260
name: "Build / Scanner"

hook-sdk/nodejs/hook-wrapper.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ async function updateFindings(findings) {
121121
},
122122
},
123123
},
124+
undefined,
125+
undefined,
126+
undefined,
124127
{ headers: { "content-type": "application/merge-patch+json" } }
125128
);
126129
console.log("Updated status successfully");

hooks/generic-webhook/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
ARG baseImageTag
12
FROM node:12-alpine as build
23
RUN mkdir -p /home/app
34
WORKDIR /home/app
45
COPY package.json package-lock.json ./
56
RUN npm ci --production
67

7-
FROM scbexperimental/hook-sdk-nodejs:latest
8+
FROM scbexperimental/hook-sdk-nodejs:${baseImageTag:-latest}
89
WORKDIR /home/app/hook-wrapper/hook/
910
COPY --from=build --chown=app:app /home/app/node_modules/ ./node_modules/
1011
COPY --chown=app:app ./hook.js ./hook.js
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# This image doesn't install the hooks dependencies, as it only has the @kubernetes/client-node dependencies which is already installed via the hook-sdk
22

3-
FROM scbexperimental/hook-sdk-nodejs:latest
3+
ARG baseImageTag
4+
FROM scbexperimental/hook-sdk-nodejs:${baseImageTag:-latest}
45
WORKDIR /home/app/hook-wrapper/hook/
56
COPY --chown=app:app hook.js scan-helpers.js ./
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
ARG baseImageTag
12
FROM node:12-alpine as build
23
RUN mkdir -p /home/app
34
WORKDIR /home/app
45
COPY package.json package-lock.json ./
56
RUN npm ci --production
67

7-
FROM scbexperimental/hook-sdk-nodejs:latest
8+
FROM scbexperimental/hook-sdk-nodejs:${baseImageTag:-latest}
89
WORKDIR /home/app/hook-wrapper/hook/
910
COPY --from=build --chown=app:app /home/app/node_modules/ ./node_modules/
1011
COPY --chown=app:app ./hook.js ./hook.js

hooks/persistence-elastic/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
image:
66
registry: docker.io
77
repository: scbexperimental/persistence-elastic
8-
tag: hooks
8+
tag: latest
99
digest: null
1010

1111
indexPrefix: "scbv2"

hooks/update-field/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
ARG baseImageTag
12
FROM node:12-alpine as build
23
RUN mkdir -p /home/app
34
WORKDIR /home/app
45
COPY package.json package-lock.json ./
56
RUN npm ci --production
67

7-
FROM scbexperimental/hook-sdk-nodejs:latest
8+
FROM scbexperimental/hook-sdk-nodejs:${baseImageTag:-latest}
89
WORKDIR /home/app/hook-wrapper/hook/
910
COPY --from=build --chown=app:app /home/app/node_modules/ ./node_modules/
1011
COPY --chown=app:app ./hook.js ./hook.js

parser-sdk/nodejs/package-lock.json

Lines changed: 36 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

parser-sdk/nodejs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"author": "iteratec GmbH",
1111
"license": "Apache-2.0",
1212
"dependencies": {
13-
"@kubernetes/client-node": "^0.11.1",
13+
"@kubernetes/client-node": "^0.12.0",
1414
"axios": "^0.19.0",
1515
"uuid": "^3.3.3",
1616
"ws": "^7.2.3"

parser-sdk/nodejs/parser-wrapper.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ async function updateScanStatus(findings) {
4747
},
4848
},
4949
},
50+
undefined,
51+
undefined,
52+
undefined,
5053
{ headers: { "content-type": "application/merge-patch+json" } }
5154
);
5255
console.log("Updated status successfully");

0 commit comments

Comments
 (0)