Skip to content

Commit 3f98b6e

Browse files
Luxy.cqaisjp
authored andcommitted
runcode: fix HTTP callback httpRun not checking for permissions (#179)
* [runcode]: Fix HTTP callback `httpRun` not checking for permissions * Remove unnessesary debug message
1 parent ebc29fd commit 3f98b6e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

[admin]/runcode/server.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,14 @@ addCommandHandler("crun",
7979
-- http interface run export
8080
function httpRun(commandstring)
8181
if not user then outputDebugString ( "httpRun can only be called via http", 2 ) return end
82+
83+
-- check acl permission
84+
local objectName = "user." .. getAccountName(user)
85+
86+
if(not hasObjectPermissionTo(objectName, "command.srun", false)) then
87+
return "Error: Permission denied"
88+
end
89+
8290
local notReturned
8391
--First we test with return
8492
local commandFunction,errorMsg = loadstring("return "..commandstring)

0 commit comments

Comments
 (0)