aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2022-07-20 13:08:07 +0200
committerKim Alvefur <zash@zash.se>2022-07-20 13:08:07 +0200
commitcdd5608f4a42e7740536d09eeda14451924c9657 (patch)
treee5ba8bb820241a6cc2a77d70d4138b7d0c0ab5d1
parent55378f128acb817baab9fbeb412768f1a748a969 (diff)
downloadprosody-cdd5608f4a42e7740536d09eeda14451924c9657.tar.gz
prosody-cdd5608f4a42e7740536d09eeda14451924c9657.zip
moduleapi: Stricter type check for actor in permission check
Non-table but truthy values would trigger "attempt to index a foo value" on the next line otherwise
-rw-r--r--core/moduleapi.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/moduleapi.lua b/core/moduleapi.lua
index c1d8851e..8790a9d3 100644
--- a/core/moduleapi.lua
+++ b/core/moduleapi.lua
@@ -645,7 +645,7 @@ function api:may(action, context)
end
local session = context.origin or context.session;
- if not session then
+ if type(session) ~= "table" then
error("Unable to identify actor session from context");
end
if session.type == "s2sin" or (session.type == "c2s" and session.host ~= self.host) then