Implement secret functionality

In order to validate requests a field called `secret` has to be sent
containing a secret key which validates the request. A hook will be
executed only if the secret sent with the request matches the hook's
secret.
This commit is contained in:
finga 2021-03-19 10:16:46 +01:00 committed by finga
parent ea19c7e413
commit b370d59b40
3 changed files with 33 additions and 12 deletions

View file

@ -1,17 +1,22 @@
---
hooks:
hook1:
action: "echo hookaction1"
action: /usr/bin/local/script_xy.sh
secrets:
- secret_key_01
- secret_key_02
filters:
match_ref:
pointer: "/ref"
regex: "refs/heads/master"
pointer: /ref
regex: refs/heads/master
hook2:
action: "echo hookaction2"
action: /usr/bin/local/script_xyz.sh
secrets:
- secret_key03
filters:
match_ref:
pointer: "/ref"
regex: "refs/heads/master"
pointer: /ref
regex: refs/heads/master
match_after:
pointer: "/after"
regex: "f6e5fe4fe37df76629112d55cc210718b6a55e7e"
pointer: /after
regex: f6e5fe4fe37df76629112d55cc210718b6a55e7e