feat(runner): add the own code runner contract, client and nsjail service

This commit is contained in:
shira committed 2026-10-11 08:23:42 +03:00
1 parent 5e1db37746
commit cdf6bcbb91
109 files changed
+24084 -28

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
# Isolation probe: the program is an unprivileged user that cannot become
# root or take ownership for root.
import os
checks = [os.getuid() != 0, os.geteuid() != 0, os.getgid() != 0, os.getegid() != 0]
for attempt in (lambda: os.setuid(0), lambda: os.setgid(0)):
try:
attempt()
checks.append(False)
except OSError:
checks.append(True)
with open("/tmp/owned", "w"):
pass
try:
os.chown("/tmp/owned", 0, 0)
checks.append(False)
except OSError:
checks.append(True)
print("unprivileged" if all(checks) else "privileged")