File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 55import subprocess
66import sys
77from textwrap import dedent
8-
8+ import socket
99import uuid_utils .compat as uuid
1010from django .utils .translation import gettext_lazy as _
1111
@@ -28,7 +28,15 @@ def __init__(self, sandbox=False):
2828 if self .sandbox :
2929 os .system (f"chown -R { self .user } :root { self .sandbox_path } " )
3030 self .banned_keywords = CONFIG .get ("SANDBOX_PYTHON_BANNED_KEYWORDS" , 'nothing_is_banned' ).split (',' );
31- self .banned_hosts = CONFIG .get ("SANDBOX_PYTHON_BANNED_HOSTS" , '' );
31+ banned_hosts = CONFIG .get ("SANDBOX_PYTHON_BANNED_HOSTS" , '' ).strip ()
32+ try :
33+ if banned_hosts :
34+ hostname = socket .gethostname ()
35+ local_ip = socket .gethostbyname (hostname )
36+ banned_hosts = f"{ banned_hosts } ,{ hostname } ,{ local_ip } "
37+ except Exception :
38+ pass
39+ self .banned_hosts = banned_hosts
3240
3341 def _createdir (self ):
3442 old_mask = os .umask (0o077 )
You can’t perform that action at this time.
0 commit comments