Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
code.vt.edu will be down for maintenance from 0530-0630 EDT Wednesday, April 9th
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
d8c22dbe
Commit
d8c22dbe
authored
11 years ago
by
Ned Batchelder
Browse files
Options
Downloads
Patches
Plain Diff
Add a Django setting for course allowed to run unsafe code.
parent
d7ea1daf
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lms/djangoapps/courseware/module_render.py
+9
-0
9 additions, 0 deletions
lms/djangoapps/courseware/module_render.py
lms/envs/common.py
+9
-0
9 additions, 0 deletions
lms/envs/common.py
with
18 additions
and
0 deletions
lms/djangoapps/courseware/module_render.py
+
9
−
0
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
)
...
...
This diff is collapsed.
Click to expand it.
lms/envs/common.py
+
9
−
0
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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment