Diff

plugins/mod_tokenauth.lua @ 12914:2b4661bd39e2

mod_tokenauth: Add some sanity checking of the new optional parameters
author Matthew Wild <mwild1@gmail.com>
date Wed, 01 Mar 2023 13:02:51 +0000
parent 12913:012fa81d1f5d
child 12915:70f6a8dceb1d
line wrap: on
line diff
--- a/plugins/mod_tokenauth.lua	Wed Mar 01 13:01:21 2023 +0000
+++ b/plugins/mod_tokenauth.lua	Wed Mar 01 13:02:51 2023 +0000
@@ -25,6 +25,10 @@
 		return nil, "invalid-host";
 	end
 
+	if (token_data and type(token_data) ~= "table") or (token_purpose and type(token_purpose ~= "string")) then
+		return nil, "bad-request";
+	end
+
 	local token_info = {
 		owner = actor_jid;
 		created = os.time();