Skip to content

Commit 79988b1

Browse files
fix: fix incorrect permission may introduce security vulnerabilities.
1 parent 91e8e83 commit 79988b1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

apps/common/utils/tool_code.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def __init__(self, sandbox=False):
2828
self.sandbox_so_path = f'{self.sandbox_path}/sandbox.so'
2929
try:
3030
if os.path.exists(self.sandbox_so_path):
31-
os.chmod(self.sandbox_so_path, 0o644)
31+
os.chmod(self.sandbox_so_path, 0o444)
3232
# 初始化host黑名单
3333
banned_hosts_file_path = f'{self.sandbox_path}/.SANDBOX_BANNED_HOSTS'
3434
if os.path.exists(banned_hosts_file_path):
@@ -40,7 +40,7 @@ def __init__(self, sandbox=False):
4040
banned_hosts = f"{banned_hosts},{hostname},{local_ip}"
4141
with open(banned_hosts_file_path, "w") as f:
4242
f.write(banned_hosts)
43-
os.chmod(banned_hosts_file_path, 0o644)
43+
os.chmod(banned_hosts_file_path, 0o444)
4444
except Exception as e:
4545
maxkb_logger.error(f'Failed to init SANDBOX_BANNED_HOSTS due to exception: {e}', exc_info=True)
4646
pass

0 commit comments

Comments
 (0)