Skip to content

Commit 31f0af6

Browse files
committed
Integrate new Zap reports
1 parent 85f00aa commit 31f0af6

File tree

6 files changed

+907
-72
lines changed

6 files changed

+907
-72
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# the Business Source License, use of this software will be governed
88
# by the Apache License, Version 2.0
99

10-
FROM node:16-alpine
10+
FROM node:17-alpine
1111

1212
ARG LOCAL_USER_ID
1313
ARG LOCAL_GROUP_ID

config/config.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,6 @@ const schema = {
137137
doc: 'The location of the report.',
138138
format: String,
139139
default: '/var/log/purpleteam/outcomes/'
140-
},
141-
formats: {
142-
doc: 'The supported formats that reports will be written in.',
143-
format: Array,
144-
default: ['html', 'json', 'md']
145140
}
146141
},
147142
upload: {

src/api/app/do/sUt.aPi.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class Api extends Sut {
5050
scanningStrategy: Joi.string().min(2).regex(/^[-\w/]{1,200}$/).default('ApiStandard'),
5151
postScanningStrategy: Joi.string().min(2).regex(/^[-\w/]{1,200}$/).default('ApiStandard'),
5252
reportingStrategy: Joi.string().min(2).regex(/^[-\w/]{1,200}$/).default('Standard'),
53+
reports: Joi.object({ templateThemes: Joi.array().items(Joi.object({ name: Joi.string().min(1).max(100).regex(/^[a-z0-9]+/i).required() })).required() }),
5354
username: Joi.string().min(2).required(),
5455
openApi: Joi.object({
5556
importFileContentBase64: Joi.string().base64({ paddingRequired: true }),
@@ -177,7 +178,8 @@ class Api extends Sut {
177178
args: {
178179
log: this.log,
179180
publisher: this.publisher,
180-
sutPropertiesSubSet: this.getProperties('testSession')
181+
baseUrl: this.baseUrl(),
182+
sutPropertiesSubSet: this.getProperties(['testSession', 'context'])
181183
}
182184
};
183185
}

src/api/app/do/sUt.browserApp.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class BrowserApp extends Sut {
5656
scanningStrategy: Joi.string().min(2).regex(/^[-\w/]{1,200}$/).default('BrowserAppStandard'),
5757
postScanningStrategy: Joi.string().min(2).regex(/^[-\w/]{1,200}$/).default('BrowserAppStandard'),
5858
reportingStrategy: Joi.string().min(2).regex(/^[-\w/]{1,200}$/).default('Standard'),
59+
reports: Joi.object({ templateThemes: Joi.array().items(Joi.object({ name: Joi.string().min(1).max(100).regex(/^[a-z0-9]+/i).required() })).required() }),
5960
username: Joi.string().min(2).required(),
6061
password: Joi.string().min(2),
6162
aScannerAttackStrength: Joi.string().valid(...this.#configSchemaProps.sut._cvtProperties.aScannerAttackStrength.format).uppercase().default(this.config.get('sut.aScannerAttackStrength')), // eslint-disable-line no-underscore-dangle
@@ -222,7 +223,8 @@ class BrowserApp extends Sut {
222223
args: {
223224
log: this.log,
224225
publisher: this.publisher,
225-
sutPropertiesSubSet: this.getProperties('testSession')
226+
baseUrl: this.baseUrl(),
227+
sutPropertiesSubSet: this.getProperties(['testSession', 'context'])
226228
}
227229
};
228230
}

src/emissaries/zAp.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ const internals = {
2121
apiKey: Joi.string().required(),
2222
apiFeedbackSpeed: Joi.number().integer().positive(),
2323
reportDir: Joi.string().required().valid(config.get('emissary.report.dir')),
24-
reportFormats: Joi.array().default(config.get('emissary.report.formats')),
2524
uploadDir: Joi.string().required().valid(config.get('emissary.upload.dir')),
2625
spider: Joi.object({
2726
maxDepth: Joi.number().integer().positive(),
@@ -114,9 +113,6 @@ internals.zApApiRoutes = {
114113
newContext: async (params) => internals.zApApi('JSON/context/action/newContext/', { searchParams: new URLSearchParams(params) })
115114
},
116115
core: {
117-
htmlreport: async (params) => internals.zApApi('OTHER/core/other/htmlreport/', { responseType: 'text', searchParams: new URLSearchParams(params) }),
118-
jsonreport: async (params) => internals.zApApi('OTHER/core/other/jsonreport/', { searchParams: new URLSearchParams(params) }),
119-
mdreport: async (params) => internals.zApApi('OTHER/core/other/mdreport/', { responseType: 'text', searchParams: new URLSearchParams(params) }),
120116
viewNumberOfAlerts: async (params) => internals.zApApi('JSON/core/view/numberOfAlerts/', { searchParams: new URLSearchParams(params) }),
121117
viewUrls: async (params) => internals.zApApi('JSON/core/view/urls/', { searchParams: new URLSearchParams(params) })
122118
},
@@ -221,7 +217,7 @@ const postScanProcess = (sUt) => {
221217

222218
const createReports = async (sUt) => {
223219
const { Strategy, args } = sUt.getReportingStrategy();
224-
const reporting = new Strategy({ ...args, emissaryPropertiesSubSet: getProperties(['reportDir', 'reportFormats']), zAp: { aPi: internals.zApApiRoutes } });
220+
const reporting = new Strategy({ ...args, emissaryPropertiesSubSet: getProperties(['uploadDir', 'reportDir']), zAp: { aPi: internals.zApApiRoutes } });
225221
await reporting.createReports();
226222
};
227223

0 commit comments

Comments
 (0)