-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Since we have a working directory for each webhook under user's home directory, I think we could make use it to allow creating webhook-specific secret using an approach similar to the .htpasswd file.
For example, after a user creates a webhook,
$ hpcutil webhook create {qsubScript}The user can optionally secure it by using the client:
$ hpcutil webhook secure {webhookID} --secret {webhookSecret}or these two steps can be combined in one command:
$ hpcutil webhook create {subscript} --secret {webhookSecret}Under the hood, the client tool writes the (oneway-hashed) secret in a file (e.g. secret) in the webhook's working directory.
When there is a trigger to the webhook, the server checks whether there is such secret file available in its working directory, if so, it tries to match the secret received from the HTTP request header to the secret in the file. The following qsub command is only performed if there is a match.
If the webhook folder doesn't have the secret file in it, the trigger is then accepted without the check. This allows the user to remove (and reset) the secret easily by just remove the secret file.