Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ Committing with `git commit -s` will add the sign-off at the end of the commit m
- Simon Hülkenberg <simon.huelkenberg@iteratec.com>
- Johanna Walker <johanna.walker@iteratec.com>
- Felix Belz <felix.belz@iteratec.com>
- Mateusz Majcher <m.majcher91@gmail.com>
8 changes: 7 additions & 1 deletion hooks/generic-webhook/hook/hook.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,18 @@ async function handle({
getFindings,
scan,
webhookUrl = process.env["WEBHOOK_URL"],
webhookUser = process.env["WEBHOOK_USER"],
webhookPassword = process.env["WEBHOOK_PASSWORD"],
axios = require('axios')
}) {
const findings = await getFindings();

console.log(`Sending ${findings.length} findings to ${webhookUrl}`);

await axios.post(webhookUrl, { scan, findings });
if (webhookUser && webhookPassword){
await axios.post(webhookUrl, {scan, findings }, {auth: {username: webhookUser, password: webhookPassword}});
}else{
await axios.post(webhookUrl, {scan, findings });
}
}
module.exports.handle = handle;
12 changes: 12 additions & 0 deletions hooks/generic-webhook/templates/webhook-hook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@ spec:
env:
- name: WEBHOOK_URL
value: {{ .Values.webhookUrl | quote }}
- name: WEBHOOK_USER
valueFrom:
secretKeyRef:
name: {{ .Values.hook.authentication.basic.userSecret }}
key: {{ .Values.hook.authentication.basic.usernameKey }}
optional: true
- name: WEBHOOK_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.hook.authentication.basic.userSecret }}
key: {{ .Values.hook.authentication.basic.passwordKey }}
optional: true
affinity:
{{- toYaml .Values.hook.affinity | nindent 4 }}
tolerations:
Expand Down
10 changes: 10 additions & 0 deletions hooks/generic-webhook/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,13 @@ hook:

# hook.tolerations -- Optional tolerations settings that control how the hook job is scheduled (see: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/)
tolerations: []

# hook.authentication -- Optional basic authentication credentials
authentication:
basic:
# -- Link a pre-existing generic secret with `usernameKey` and `passwordKey` key / value pairs
userSecret: generic-webhook-credentials
# -- Name of the username key in the `userSecret` secret. Use this if you already have a secret with different key / value pairs
usernameKey: username
# -- Name of the password key in the `userSecret` secret. Use this if you already have a secret with different key / value pairs
passwordKey: password