aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2024-10-03 19:45:43 +0100
committerGravatar Chris Lovering <[email protected]>2024-10-03 22:01:49 +0100
commit81573b2d0144ece5490948706918233b887f86c1 (patch)
tree01aa69179233af70bb76adcc0f09c061a5124449
parentAdd specific error for when the specified binary path does not exist (diff)
Also check if the specified binary path is execuatable
-rw-r--r--snekbox/api/resources/eval.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/snekbox/api/resources/eval.py b/snekbox/api/resources/eval.py
index 88bbf96..943ecff 100644
--- a/snekbox/api/resources/eval.py
+++ b/snekbox/api/resources/eval.py
@@ -132,6 +132,8 @@ class EvalResource:
raise falcon.HTTPBadRequest(title="binary_path does not exist")
if not binary_path.is_file():
raise falcon.HTTPBadRequest(title="binary_path is not a file")
+ if not binary_path.stat().st_mode & 0o100 == 0o100:
+ raise falcon.HTTPBadRequest(title="binary_path is not executable")
try:
result = self.nsjail.python3(