mirror of
https://github.com/QingdaoU/OnlineJudge.git
synced 2025-01-04 03:22:06 +00:00
指定使用nobody用户进行编译,防止#include</etc/shadow>等情况的发生
部分情况下,include敏感文件可能造成信息泄露。这里设置一下用户权限。
This commit is contained in:
parent
2a1db9fa67
commit
cf2fc9df1a
@ -91,7 +91,8 @@ class JudgeClient(object):
|
||||
out_file=os.path.join(self._judge_base_path, str(test_case_id) + ".out"),
|
||||
args=execute_command[1:],
|
||||
env=["PATH=" + os.environ["PATH"]],
|
||||
use_sandbox=self._language["use_sandbox"])
|
||||
use_sandbox=self._language["use_sandbox"],
|
||||
use_nobody=True)
|
||||
if run_result["flag"] == 0:
|
||||
output_md5, r = self._compare_output(test_case_id)
|
||||
if r:
|
||||
|
@ -20,7 +20,8 @@ def compile_(language_item, src_path, exe_path, judge_base_path):
|
||||
max_memory=2000000000,
|
||||
args=compile_args,
|
||||
env=["PATH=" + os.environ["PATH"]],
|
||||
use_sandbox=False)
|
||||
use_sandbox=False,
|
||||
use_nobody=True)
|
||||
|
||||
compile_output_handler = open(compiler_output_file)
|
||||
compile_output = compile_output_handler.read().strip()
|
||||
|
Loading…
Reference in New Issue
Block a user