Issue
User: Dev User (dev@example.com)
Student message: Error initializing workspace files
Instructor message: Error initializing workspace files
ID: 1099
Date: 2024-09-18 13:00:34-05 (CDT)

Console log:

Dynamic file 1: Dynamic workspace file does not include a name. File ignored.
invalid_encoding.bin: Dynamic workspace file has unsupported file encoding (utf-4). File ignored.
../outside_home.txt: Dynamic workspace file has an absolute path or includes a name that traverses outside the home directory. File ignored.
path/../../outside_home.txt: Dynamic workspace file has an absolute path or includes a name that traverses outside the home directory. File ignored.
/home/prairie/absolute.txt: Dynamic workspace file has an absolute path or includes a name that traverses outside the home directory. File ignored.
server.py: Dynamic workspace file points to a local file outside the question directory. File ignored.
no_contents.txt: Dynamic workspace file has neither "contents" nor "questionFile". Blank file created.

Associated data:

{
    "course": {
        "id": "2",
        "path": "/PrairieLearn/testCourse",
        "title": "Test Course",
        "branch": "master",
        "options": {
            "devModeFeatures": [],
            "useNewQuestionRenderer": true
        },
        "created_at": {},
        "deleted_at": null,
        "repository": null,
        "short_name": "QA 101",
        "commit_hash": null,
        "sync_errors": null,
        "sharing_name": null,
        "sharing_token": "0763f051-e7aa-439e-8e22-c21b6213ca3f",
        "sync_warnings": "",
        "example_course": false,
        "institution_id": "1",
        "template_course": false,
        "display_timezone": "America/Chicago",
        "sync_job_sequence_id": null,
        "yearly_enrollment_limit": null,
        "course_instance_enrollment_limit": null
    },
    "variant": {
        "id": "11764",
        "date": {},
        "open": true,
        "broken": false,
        "number": 1,
        "params": {
            "a": "STRING",
            "_workspace_files": [
                {
                    "name": "dynamic.txt",
                    "contents": "This is a dynamic file.\n"
                },
                {
                    "contents": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
                    "encoding": "hex"
                },
                {
                    "name": "invalid_encoding.bin",
                    "contents": "ABEiM0RVZneImaq7zN3u/w==",
                    "encoding": "utf-4"
                },
                {
                    "name": "../outside_home.txt",
                    "contents": "This file should not be created\n"
                },
                {
                    "name": "path/../../outside_home.txt",
                    "contents": "This file should also not be created\n"
                },
                {
                    "name": "/home/prairie/absolute.txt",
                    "contents": "This file should also not be created\n"
                },
                {
                    "name": "server.py",
                    "questionFile": "../workspace/server.py"
                },
                {
                    "name": "no_contents.txt"
                }
            ],
            "_required_file_names": [],
            "_workspace_required_file_names": []
        },
        "options": {},
        "user_id": "1",
        "duration": 0,
        "group_id": null,
        "broken_at": null,
        "broken_by": null,
        "course_id": "2",
        "num_tries": 0,
        "question_id": "204",
        "true_answer": {
            "b": 53
        },
        "variant_seed": "k9hsfz",
        "workspace_id": "753",
        "authn_user_id": "1",
        "first_duration": null,
        "course_instance_id": null,
        "instance_question_id": null
    },
    "question": {
        "id": "204",
        "qid": "workspaceInvalidDynamicFiles",
        "type": "Freeform",
        "uuid": "d7e80f01-e4ea-406e-9d64-f5fffcf7cb49",
        "title": "Workspace test with invalid files",
        "number": 638,
        "options": null,
        "topic_id": "40",
        "course_id": "2",
        "directory": "workspaceInvalidDynamicFiles",
        "deleted_at": null,
        "sync_errors": null,
        "client_files": [
            "client.js",
            "question.html",
            "answer.html"
        ],
        "dependencies": {},
        "sync_warnings": "",
        "grading_method": "Internal",
        "partial_credit": true,
        "single_variant": false,
        "workspace_args": null,
        "workspace_home": "/home/prairie",
        "workspace_port": 8080,
        "shared_publicly": false,
        "workspace_image": "prairielearn/workspace-xtermjs",
        "template_directory": null,
        "show_correct_answer": true,
        "sync_job_sequence_id": null,
        "workspace_environment": {},
        "workspace_url_rewrite": null,
        "external_grading_files": null,
        "external_grading_image": null,
        "workspace_graded_files": [],
        "external_grading_enabled": null,
        "external_grading_timeout": null,
        "external_grading_entrypoint": null,
        "shared_publicly_with_source": false,
        "workspace_enable_networking": null,
        "external_grading_environment": {},
        "external_grading_enable_networking": null
    },
    "workspace": {
        "id": "753",
        "state": "uninitialized",
        "message": null,
        "version": 1,
        "hostname": null,
        "reset_at": null,
        "created_at": {},
        "running_at": null,
        "stopped_at": null,
        "launch_port": 0,
        "launch_uuid": null,
        "launched_at": null,
        "rebooted_at": null,
        "heartbeat_at": null,
        "disk_usage_bytes": null,
        "running_duration": 0,
        "state_updated_at": {},
        "workspace_host_id": null,
        "launching_duration": 0,
        "message_updated_at": {}
    }
}

System data:

{
    "courseErrData": {
        "errors": [
            {
                "msg": "Dynamic workspace file does not include a name. File ignored.",
                "data": {
                    "contents": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
                    "encoding": "hex"
                },
                "file": "Dynamic file 1"
            },
            {
                "msg": "Dynamic workspace file has unsupported file encoding (utf-4). File ignored.",
                "data": {
                    "name": "invalid_encoding.bin",
                    "contents": "ABEiM0RVZneImaq7zN3u/w==",
                    "encoding": "utf-4"
                },
                "file": "invalid_encoding.bin"
            },
            {
                "msg": "Dynamic workspace file has an absolute path or includes a name that traverses outside the home directory. File ignored.",
                "data": {
                    "name": "../outside_home.txt",
                    "contents": "This file should not be created\n"
                },
                "file": "../outside_home.txt"
            },
            {
                "msg": "Dynamic workspace file has an absolute path or includes a name that traverses outside the home directory. File ignored.",
                "data": {
                    "name": "path/../../outside_home.txt",
                    "contents": "This file should also not be created\n"
                },
                "file": "path/../../outside_home.txt"
            },
            {
                "msg": "Dynamic workspace file has an absolute path or includes a name that traverses outside the home directory. File ignored.",
                "data": {
                    "name": "/home/prairie/absolute.txt",
                    "contents": "This file should also not be created\n"
                },
                "file": "/home/prairie/absolute.txt"
            },
            {
                "msg": "Dynamic workspace file points to a local file outside the question directory. File ignored.",
                "data": {
                    "name": "server.py",
                    "questionFile": "../workspace/server.py"
                },
                "file": "server.py"
            },
            {
                "msg": "Dynamic workspace file has neither \"contents\" nor \"questionFile\". Blank file created.",
                "data": {
                    "name": "no_contents.txt"
                },
                "file": "no_contents.txt"
            }
        ],
        "outputBoth": "Dynamic file 1: Dynamic workspace file does not include a name. File ignored.\ninvalid_encoding.bin: Dynamic workspace file has unsupported file encoding (utf-4). File ignored.\n../outside_home.txt: Dynamic workspace file has an absolute path or includes a name that traverses outside the home directory. File ignored.\npath/../../outside_home.txt: Dynamic workspace file has an absolute path or includes a name that traverses outside the home directory. File ignored.\n/home/prairie/absolute.txt: Dynamic workspace file has an absolute path or includes a name that traverses outside the home directory. File ignored.\nserver.py: Dynamic workspace file points to a local file outside the question directory. File ignored.\nno_contents.txt: Dynamic workspace file has neither \"contents\" nor \"questionFile\". Blank file created."
    }
}
Workspace test with invalid files

This is a question to test workspace user access, but with invalid files. Initializing the workspace is expected to create an issue with multiple errors. You can press the button to launch an Xterm.js workspace.

Open workspace
Correct answer
Student view placeholder
In student views this area is used for assessment and score info.
Staff information
Staff user:
Dev User
dev@example.com

Question:
Title:
Workspace test with invalid files
Started at:
2024-09-18 01:01:39 (CDT)
Duration:
0 s
Show/Hide answer
{
  "b": 53
}