Skip to content

Commit 19d7d59

Browse files
J12934rfelber
andcommitted
First base implementation.
Co-authored-by: Robert Seedorff <Robert.Seedorff@iteratec.com>
1 parent 6727caa commit 19d7d59

19 files changed

Lines changed: 5207 additions & 1 deletion

hooks/teams-webhook/.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/

hooks/teams-webhook/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

hooks/teams-webhook/.helmignore

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*~
18+
# Various IDEs
19+
.project
20+
.idea/
21+
*.tmproj
22+
.vscode/
23+
# Node.js files
24+
node_modules/*
25+
package.json
26+
package-lock.json
27+
src/*
28+
config/*
29+
Dockerfile
30+
.dockerignore

hooks/teams-webhook/Chart.lock

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dependencies: []
2+
digest: sha256:643d5437104296e21d906ecb15b2c96ad278f20cfc4af53b12bb6069bd853726
3+
generated: "2020-05-26T16:56:03.119255+02:00"

hooks/teams-webhook/Chart.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: v2
2+
name: teams-webhook
3+
description: Lets you send a findings result summary as webhook to MS Teams, after a scan is completed.
4+
5+
type: application
6+
7+
version: 0.1.0
8+
9+
appVersion: latest
10+
11+
dependencies: []

hooks/teams-webhook/Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
ARG baseImageTag
2+
FROM node:12-alpine as build
3+
RUN mkdir -p /home/app
4+
WORKDIR /home/app
5+
COPY package.json package-lock.json ./
6+
RUN npm ci --production
7+
8+
FROM scbexperimental/hook-sdk-nodejs:${baseImageTag:-latest}
9+
WORKDIR /home/app/hook-wrapper/hook/
10+
COPY --from=build --chown=app:app /home/app/node_modules/ ./node_modules/
11+
COPY --chown=app:app ./hook.js ./hook.js

hooks/teams-webhook/README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ usecase: "Publishes Scan Summary to MS Teams."
1010

1111
## Deployment
1212

13-
Installing the Teams WebHook hook will add a ReadOnly Hook to your namespace.
13+
Installing the Teams WebHook hook will add a ReadOnly Hook to your namespace.
1414

1515
> 🔧 The implementation is currently work-in-progress and still undergoing major changes. It'll be released here once it has stabilized.
16+
17+
```bash
18+
helm upgrade --install twh ./hooks/teams-webhook/ --set webhookUrl="http://example.com/my/webhook/target"
19+
```
20+
> ✍ This documentation is currently work-in-progress.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
title: "MS Teams WebHook"
3+
category: "hook"
4+
type: "integration"
5+
state: "roadmap"
6+
usecase: "Publishes Scan Summary to MS Teams."
7+
---
8+
9+
<!-- end -->
10+
11+
## Deployment
12+
13+
Installing the Teams WebHook hook will add a ReadOnly Hook to your namespace.
14+
15+
> 🔧 The implementation is currently work-in-progress and still undergoing major changes. It'll be released here once it has stabilized.
16+
17+
18+
```bash
19+
helm upgrade --install twh ./hooks/teams-webhook/ --set webhookUrl="http://example.com/my/webhook/target"
20+
```
21+
> ✍ This documentation is currently work-in-progress.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports.post = jest.fn();
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`should send a post request to the url when fired 1`] = `
4+
[MockFunction] {
5+
"calls": Array [
6+
Array [
7+
"http://example.com/foo/bar",
8+
Object {
9+
"findings": Array [],
10+
"paylod": Object {
11+
"@context": "https://schema.org/extensions",
12+
"@type": "MessageCard",
13+
"potentialAction": Array [
14+
Object {
15+
"@type": "OpenUri",
16+
"name": "Open Dashboard",
17+
"targets": Array [
18+
Object {
19+
"os": "default",
20+
"uri": "https://your-dashboard.url/",
21+
},
22+
],
23+
},
24+
Object {
25+
"@type": "OpenUri",
26+
"name": "Show Results in Dashboard",
27+
"targets": Array [
28+
Object {
29+
"os": "default",
30+
"uri": "https://your-dashboard.url/",
31+
},
32+
],
33+
},
34+
],
35+
"sections": Array [
36+
Object {
37+
"activityImage": "https://raw.githubusercontent.com/secureCodeBox/securecodebox.github.io/gh-source/static/Favicon.png",
38+
"activitySubtitle": "Finished at 2020-05-25T02:38:13Z",
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": "Open Ports:",
65+
"value": "3",
66+
},
67+
Object {
68+
"name": "Hosts:",
69+
"value": "8",
70+
},
71+
],
72+
"text": "__Findings Category Overview:__",
73+
},
74+
],
75+
"summary": "Scan 09988cdf-1fc7-4f85-95ee-1b1d65dbc7cc",
76+
"themeColor": "0078D7",
77+
"title": "New security scan Nmap results are available!",
78+
},
79+
},
80+
],
81+
],
82+
"results": Array [
83+
Object {
84+
"type": "return",
85+
"value": undefined,
86+
},
87+
],
88+
}
89+
`;

0 commit comments

Comments
 (0)