Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,17 @@ mv $MERGE_DIR/test_student/test_student.py $MERGE_DIR/test_student.py
# Student code runs as ag, whose uid may match the owner of files mounted from the host. Stop it from
# changing the tests and the submission, since tests read them after student code has run (for
# example, a data file the tests_dir fixture reads to compute expected values).
if ! { chown -R root:root "$MERGE_DIR" && chmod -R go-w "$MERGE_DIR"; }; then
# Also stop it from reading the test files, which can hold expected values and reference code. It can
# only pass through the folders to reach student/, which workspace mode imports from. The grader reads
# leading code, setup code, helper modules and data files, and hands them to the sandbox.
protect_grading_files() {
chown -R root:root "$MERGE_DIR" || return 1
chmod -R go-rwx "$MERGE_DIR" || return 1
chmod go+x "$MERGE_DIR" "$MERGE_DIR/test_student" || return 1
chmod -R go+rX "$MERGE_DIR/test_student/student"
}

if ! protect_grading_files; then
echo '{"succeeded": false, "score": 0.0, "message": "The autograder could not protect its grading files. Please contact course staff and have them check the logs for this submission."}' > "$OUT_DIR/results.json"
echo "ERROR: could not protect $MERGE_DIR"
exit 1
Expand Down
Loading