Diff

mod_pubsub_github/mod_pubsub_github.lua @ 3515:f756e051fa02

mod_pubsub_github: Require a secret to be set (BC)
author Kim Alvefur <zash@zash.se>
date Sun, 31 Mar 2019 18:04:11 +0200
parent 3514:8811b7dbe6e2
child 3516:d94875c3ddda
line wrap: on
line diff
--- a/mod_pubsub_github/mod_pubsub_github.lua	Sun Mar 31 17:59:17 2019 +0200
+++ b/mod_pubsub_github/mod_pubsub_github.lua	Sun Mar 31 18:04:11 2019 +0200
@@ -9,6 +9,8 @@
 local github_actor = module:get_option_string("github_actor") or true;
 local secret = module:get_option("github_secret");
 
+assert(secret, "Please set 'github_secret'");
+
 local error_mapping = {
 	["forbidden"] = 403;
 	["item-not-found"] = 404;
@@ -18,7 +20,7 @@
 
 function handle_POST(event)
 	local request, response = event.request, event.response;
-	if secret and ("sha1=" .. hmac_sha1(secret, request.body, true)) ~= request.headers.x_hub_signature then
+	if ("sha1=" .. hmac_sha1(secret, request.body, true)) ~= request.headers.x_hub_signature then
 		return 401;
 	end
 	local data = json.decode(request.body);