Skip to content

Commit 3881d7b

Browse files
committed
Removed Mustache and replaced it with plain js templates.
1 parent 5ed4490 commit 3881d7b

4 files changed

Lines changed: 469 additions & 147 deletions

File tree

hooks/teams-webhook/__snapshots__/hook.test.js.snap

Lines changed: 303 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,317 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`should send a post request to the url when fired 1`] = `
3+
exports[`DefectDojo enbled should send a post request to the url when fired 1`] = `
44
[MockFunction] {
55
"calls": Array [
66
Array [
77
"http://example.com/foo/bar",
88
Object {
99
"findings": Array [],
10-
"paylod": "{
11-
\\"@type\\": \\"MessageCard\\",
12-
\\"@context\\": \\"https://schema.org/extensions\\",
13-
\\"summary\\": \\"Scan 09988cdf-1fc7-4f85-95ee-1b1d65dbc7cc\\",
14-
\\"themeColor\\": \\"0078D7\\",
15-
\\"title\\": \\"New security scan results (Type: Nmap) are available!\\",
16-
\\"sections\\": [
17-
{
18-
\\"activityTitle\\": \\"Scheduled scan: **'demo-scan-1601086432'**\\",
19-
\\"activitySubtitle\\": \\"Finished at 2020-05-25T02:38:13Z\\",
20-
\\"activityImage\\": \\"https://docs.securecodebox.io/img/Favicon.svg\\",
21-
\\"startGroup\\": true,
22-
\\"facts\\": [{"name":"high","value":"10"},{"name":"medium","value":"5"},{"name":"low","value":"2"},{"name":"informational","value":"1"}],
23-
\\"text\\": \\"__Findings Severity Overview:__\\"
10+
"paylod": Object {
11+
"@context": "https://schema.org/extensions",
12+
"@type": "MessageCard",
13+
"potentialAction": Array [
14+
Object {
15+
"@type": "OpenUri",
16+
"name": "Open DefectDojo",
17+
"targets": Array [
18+
Object {
19+
"os": "default",
20+
"uri": "htps://defect.dojo/",
21+
},
22+
],
23+
},
24+
Object {
25+
"@type": "OpenUri",
26+
"name": "Show Results in DefectDojo",
27+
"targets": Array [
28+
Object {
29+
"os": "default",
30+
"uri": "https://defect.dojo/project?id=09988cdf-1fc7-4f85-95ee-1b1d65dbc7cc",
31+
},
32+
],
33+
},
34+
],
35+
"sections": Array [
36+
Object {
37+
"activityImage": "https://docs.securecodebox.io/img/Favicon.svg",
38+
"activitySubtitle": "Finished at undefined",
39+
"activityTitle": "Scheduled scan: **'demo-scan-1601086432'**",
40+
"facts": Array [
41+
Object {
42+
"name": "high",
43+
"value": "10",
44+
},
45+
Object {
46+
"name": "medium",
47+
"value": "5",
48+
},
49+
Object {
50+
"name": "low",
51+
"value": "2",
52+
},
53+
Object {
54+
"name": "informational",
55+
"value": "1",
56+
},
57+
],
58+
"startGroup": true,
59+
"text": "__Findings Severity Overview:__",
60+
},
61+
Object {
62+
"facts": Array [
63+
Object {
64+
"name": "A Client Error response code was returned by the server",
65+
"value": "1",
66+
},
67+
Object {
68+
"name": "Information Disclosure - Sensitive Information in URL",
69+
"value": "1",
70+
},
71+
Object {
72+
"name": "Strict-Transport-Security Header Not Set",
73+
"value": "1",
74+
},
75+
],
76+
"text": "__Findings Category Overview:__",
77+
},
78+
],
79+
"summary": "Scan 09988cdf-1fc7-4f85-95ee-1b1d65dbc7cc",
80+
"themeColor": "0078D7",
81+
"title": "New security scan results (Type: {{scanType}}) are available!",
2482
},
25-
{
26-
\\"facts\\": [{"name":"A Client Error response code was returned by the server","value":"1"},{"name":"Information Disclosure - Sensitive Information in URL","value":"1"},{"name":"Strict-Transport-Security Header Not Set","value":"1"}],
27-
\\"text\\": \\"__Findings Category Overview:__\\"
28-
}
83+
},
84+
],
85+
],
86+
"results": Array [
87+
Object {
88+
"type": "return",
89+
"value": undefined,
90+
},
91+
],
92+
}
93+
`;
94+
95+
exports[`Kibana enbled example should send a post request to the url when fired 1`] = `
96+
[MockFunction] {
97+
"calls": Array [
98+
Array [
99+
"http://example.com/foo/bar",
100+
Object {
101+
"findings": Array [],
102+
"paylod": Object {
103+
"@context": "https://schema.org/extensions",
104+
"@type": "MessageCard",
105+
"potentialAction": Array [
106+
Object {
107+
"@type": "OpenUri",
108+
"name": "Open Kibana Dashboard",
109+
"targets": Array [
110+
Object {
111+
"os": "default",
112+
"uri": "htps://dashboard.yourservice/",
113+
},
114+
],
115+
},
116+
Object {
117+
"@type": "OpenUri",
118+
"name": "Show Results in Kibana Dashboard",
119+
"targets": Array [
120+
Object {
121+
"os": "default",
122+
"uri": "https://dashboard.yourservice/filter:09988cdf-1fc7-4f85-95ee-1b1d65dbc7cc",
123+
},
124+
],
125+
},
126+
],
127+
"sections": Array [
128+
Object {
129+
"activityImage": "https://docs.securecodebox.io/img/Favicon.svg",
130+
"activitySubtitle": "Finished at undefined",
131+
"activityTitle": "Scheduled scan: **'demo-scan-1601086432'**",
132+
"facts": Array [
133+
Object {
134+
"name": "high",
135+
"value": "10",
136+
},
137+
Object {
138+
"name": "medium",
139+
"value": "5",
140+
},
141+
Object {
142+
"name": "low",
143+
"value": "2",
144+
},
145+
Object {
146+
"name": "informational",
147+
"value": "1",
148+
},
149+
],
150+
"startGroup": true,
151+
"text": "__Findings Severity Overview:__",
152+
},
153+
Object {
154+
"facts": Array [
155+
Object {
156+
"name": "A Client Error response code was returned by the server",
157+
"value": "1",
158+
},
159+
Object {
160+
"name": "Information Disclosure - Sensitive Information in URL",
161+
"value": "1",
162+
},
163+
Object {
164+
"name": "Strict-Transport-Security Header Not Set",
165+
"value": "1",
166+
},
167+
],
168+
"text": "__Findings Category Overview:__",
169+
},
170+
],
171+
"summary": "Scan 09988cdf-1fc7-4f85-95ee-1b1d65dbc7cc",
172+
"themeColor": "0078D7",
173+
"title": "New security scan results (Type: {{scanType}}) are available!",
174+
},
175+
},
29176
],
30-
\\"potentialAction\\": [
31-
{
32-
\\"@type\\": \\"OpenUri\\",
33-
\\"name\\": \\"Open Dashboard\\",
34-
\\"targets\\": [
35-
{
36-
\\"os\\": \\"default\\",
37-
\\"uri\\": \\"\\"
38-
}
39-
]
177+
],
178+
"results": Array [
179+
Object {
180+
"type": "return",
181+
"value": undefined,
182+
},
183+
],
184+
}
185+
`;
186+
187+
exports[`vulnMngmEnabled ENV Vars missing test should result in a minimal payload 1`] = `
188+
[MockFunction] {
189+
"calls": Array [
190+
Array [
191+
"http://example.com/foo/bar",
192+
Object {
193+
"findings": Array [],
194+
"paylod": Object {
195+
"@context": "https://schema.org/extensions",
196+
"@type": "MessageCard",
197+
"sections": Array [
198+
Object {
199+
"activityImage": "https://docs.securecodebox.io/img/Favicon.svg",
200+
"activitySubtitle": "Finished at undefined",
201+
"activityTitle": "Scheduled scan: **'demo-scan-1601086432'**",
202+
"facts": Array [
203+
Object {
204+
"name": "high",
205+
"value": "10",
206+
},
207+
Object {
208+
"name": "medium",
209+
"value": "5",
210+
},
211+
Object {
212+
"name": "low",
213+
"value": "2",
214+
},
215+
Object {
216+
"name": "informational",
217+
"value": "1",
218+
},
219+
],
220+
"startGroup": true,
221+
"text": "__Findings Severity Overview:__",
222+
},
223+
Object {
224+
"facts": Array [
225+
Object {
226+
"name": "A Client Error response code was returned by the server",
227+
"value": "1",
228+
},
229+
Object {
230+
"name": "Information Disclosure - Sensitive Information in URL",
231+
"value": "1",
232+
},
233+
Object {
234+
"name": "Strict-Transport-Security Header Not Set",
235+
"value": "1",
236+
},
237+
],
238+
"text": "__Findings Category Overview:__",
239+
},
240+
],
241+
"summary": "Scan 09988cdf-1fc7-4f85-95ee-1b1d65dbc7cc",
242+
"themeColor": "0078D7",
243+
"title": "New security scan results (Type: {{scanType}}) are available!",
244+
},
245+
},
246+
],
247+
],
248+
"results": Array [
249+
Object {
250+
"type": "return",
251+
"value": undefined,
252+
},
253+
],
254+
}
255+
`;
256+
257+
exports[`vulnMngmEnabled disabled should send a post request to the url when fired 1`] = `
258+
[MockFunction] {
259+
"calls": Array [
260+
Array [
261+
"http://example.com/foo/bar",
262+
Object {
263+
"findings": Array [],
264+
"paylod": Object {
265+
"@context": "https://schema.org/extensions",
266+
"@type": "MessageCard",
267+
"sections": Array [
268+
Object {
269+
"activityImage": "https://docs.securecodebox.io/img/Favicon.svg",
270+
"activitySubtitle": "Finished at undefined",
271+
"activityTitle": "Scheduled scan: **'demo-scan-1601086432'**",
272+
"facts": Array [
273+
Object {
274+
"name": "high",
275+
"value": "10",
276+
},
277+
Object {
278+
"name": "medium",
279+
"value": "5",
280+
},
281+
Object {
282+
"name": "low",
283+
"value": "2",
284+
},
285+
Object {
286+
"name": "informational",
287+
"value": "1",
288+
},
289+
],
290+
"startGroup": true,
291+
"text": "__Findings Severity Overview:__",
292+
},
293+
Object {
294+
"facts": Array [
295+
Object {
296+
"name": "A Client Error response code was returned by the server",
297+
"value": "1",
298+
},
299+
Object {
300+
"name": "Information Disclosure - Sensitive Information in URL",
301+
"value": "1",
302+
},
303+
Object {
304+
"name": "Strict-Transport-Security Header Not Set",
305+
"value": "1",
306+
},
307+
],
308+
"text": "__Findings Category Overview:__",
309+
},
310+
],
311+
"summary": "Scan 09988cdf-1fc7-4f85-95ee-1b1d65dbc7cc",
312+
"themeColor": "0078D7",
313+
"title": "New security scan results (Type: {{scanType}}) are available!",
40314
},
41-
{
42-
\\"@type\\": \\"OpenUri\\",
43-
\\"name\\": \\"Show Results in Dashboard\\",
44-
\\"targets\\": [
45-
{
46-
\\"os\\": \\"default\\",
47-
\\"uri\\": \\"\\"
48-
}
49-
]
50-
}
51-
]
52-
}",
53315
},
54316
],
55317
],

0 commit comments

Comments
 (0)