Configure code jail for cms
This commit is contained in:
@@ -176,6 +176,14 @@ SERVER_EMAIL = ENV_TOKENS.get('SERVER_EMAIL', SERVER_EMAIL)
|
||||
MKTG_URLS = ENV_TOKENS.get('MKTG_URLS', MKTG_URLS)
|
||||
TECH_SUPPORT_EMAIL = ENV_TOKENS.get('TECH_SUPPORT_EMAIL', TECH_SUPPORT_EMAIL)
|
||||
|
||||
for name, value in ENV_TOKENS.get("CODE_JAIL", {}).items():
|
||||
oldvalue = CODE_JAIL.get(name)
|
||||
if isinstance(oldvalue, dict):
|
||||
for subname, subvalue in value.items():
|
||||
oldvalue[subname] = subvalue
|
||||
else:
|
||||
CODE_JAIL[name] = value
|
||||
|
||||
COURSES_WITH_UNSAFE_CODE = ENV_TOKENS.get("COURSES_WITH_UNSAFE_CODE", [])
|
||||
|
||||
ASSET_IGNORE_REGEX = ENV_TOKENS.get('ASSET_IGNORE_REGEX', ASSET_IGNORE_REGEX)
|
||||
|
||||
@@ -342,6 +342,8 @@ MIDDLEWARE_CLASSES = (
|
||||
# Detects user-requested locale from 'accept-language' header in http request
|
||||
'django.middleware.locale.LocaleMiddleware',
|
||||
|
||||
'codejail.django_integration.ConfigureCodeJailMiddleware',
|
||||
|
||||
# needs to run after locale middleware (or anything that modifies the request context)
|
||||
'edxmako.middleware.MakoMiddleware',
|
||||
|
||||
@@ -412,6 +414,21 @@ MODULESTORE = {
|
||||
}
|
||||
}
|
||||
|
||||
#################### Python sandbox ############################################
|
||||
|
||||
CODE_JAIL = {
|
||||
# Path to a sandboxed Python executable. None means don't bother.
|
||||
'python_bin': None,
|
||||
# User to run as in the sandbox.
|
||||
'user': 'sandbox',
|
||||
|
||||
# Configurable limits.
|
||||
'limits': {
|
||||
# How many CPU seconds can jailed code use?
|
||||
'CPU': 1,
|
||||
},
|
||||
}
|
||||
|
||||
############################ DJANGO_BUILTINS ################################
|
||||
# Change DEBUG in your environment settings files, not here
|
||||
DEBUG = False
|
||||
|
||||
Reference in New Issue
Block a user