Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
d8c22dbe
Commit
d8c22dbe
authored
May 02, 2013
by
Ned Batchelder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a Django setting for course allowed to run unsafe code.
parent
d7ea1daf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
lms/djangoapps/courseware/module_render.py
+9
-0
lms/envs/common.py
+9
-0
No files found.
lms/djangoapps/courseware/module_render.py
View file @
d8c22dbe
...
...
@@ -274,6 +274,14 @@ def get_module_for_descriptor(user, request, descriptor, model_data_cache, cours
statsd
.
increment
(
"lms.courseware.question_answered"
,
tags
=
tags
)
def
can_execute_unsafe_code
():
# To decide if we can run unsafe code, we check the course id against
# a list of regexes configured on the server.
for
regex
in
settings
.
COURSES_WITH_UNSAFE_CODE
:
if
re
.
match
(
regex
,
course_id
):
return
True
return
False
# TODO (cpennington): When modules are shared between courses, the static
# prefix is going to have to be specific to the module, not the directory
# that the xml was loaded from
...
...
@@ -301,6 +309,7 @@ def get_module_for_descriptor(user, request, descriptor, model_data_cache, cours
open_ended_grading_interface
=
open_ended_grading_interface
,
s3_interface
=
s3_interface
,
cache
=
cache
,
can_execute_unsafe_code
=
can_execute_unsafe_code
,
)
# pass position specified in URL to module through ModuleSystem
system
.
set
(
'position'
,
position
)
...
...
lms/envs/common.py
View file @
d8c22dbe
...
...
@@ -251,6 +251,15 @@ CODE_JAIL = {
'user'
:
'sandbox'
,
}
# Some courses are allowed to run unsafe code. This is a list of regexes, one
# of them must match the course id for that course to run unsafe code.
#
# For example:
#
# COURSES_WITH_UNSAFE_CODE = [
# r"Harvard/XY123.1/.*"
# ]
COURSES_WITH_UNSAFE_CODE
=
[]
############################ SIGNAL HANDLERS ################################
# This is imported to register the exception signal handling that logs exceptions
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment