tutor-contrib-codejail 20.0.0__tar.gz → 21.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. {tutor_contrib_codejail-20.0.0/tutor_contrib_codejail.egg-info → tutor_contrib_codejail-21.0.0}/PKG-INFO +43 -41
  2. {tutor_contrib_codejail-20.0.0 → tutor_contrib_codejail-21.0.0}/README.rst +40 -36
  3. {tutor_contrib_codejail-20.0.0 → tutor_contrib_codejail-21.0.0}/setup.py +2 -4
  4. {tutor_contrib_codejail-20.0.0 → tutor_contrib_codejail-21.0.0/tutor_contrib_codejail.egg-info}/PKG-INFO +43 -41
  5. {tutor_contrib_codejail-20.0.0 → tutor_contrib_codejail-21.0.0}/tutor_contrib_codejail.egg-info/SOURCES.txt +6 -9
  6. tutor_contrib_codejail-21.0.0/tutor_contrib_codejail.egg-info/requires.txt +1 -0
  7. {tutor_contrib_codejail-20.0.0 → tutor_contrib_codejail-21.0.0}/tutorcodejail/__about__.py +1 -1
  8. {tutor_contrib_codejail-20.0.0 → tutor_contrib_codejail-21.0.0}/tutorcodejail/patches/k8s-deployments +49 -12
  9. {tutor_contrib_codejail-20.0.0 → tutor_contrib_codejail-21.0.0}/tutorcodejail/patches/k8s-services +2 -0
  10. tutor_contrib_codejail-21.0.0/tutorcodejail/patches/kustomization-configmapgenerator +17 -0
  11. {tutor_contrib_codejail-20.0.0 → tutor_contrib_codejail-21.0.0}/tutorcodejail/patches/local-docker-compose-jobs-services +1 -1
  12. tutor_contrib_codejail-21.0.0/tutorcodejail/patches/local-docker-compose-services +43 -0
  13. tutor_contrib_codejail-21.0.0/tutorcodejail/plugin.py +155 -0
  14. tutor_contrib_codejail-21.0.0/tutorcodejail/templates/codejail/apps/codejail-service-v2/tutor.py +34 -0
  15. tutor_contrib_codejail-21.0.0/tutorcodejail/templates/codejail/apps/profiles/openedx-codejail-service.profile +132 -0
  16. {tutor_contrib_codejail-20.0.0 → tutor_contrib_codejail-21.0.0}/tutorcodejail/templates/codejail/build/codejail/Dockerfile +19 -15
  17. tutor_contrib_codejail-21.0.0/tutorcodejail/templates/codejail/build/codejail-service/Dockerfile +173 -0
  18. tutor_contrib_codejail-21.0.0/tutorcodejail/templates/codejail/build/codejail_apparmor/Dockerfile +14 -0
  19. tutor_contrib_codejail-20.0.0/tutor_contrib_codejail.egg-info/requires.txt +0 -1
  20. tutor_contrib_codejail-20.0.0/tutorcodejail/patches/k8s-jobs +0 -21
  21. tutor_contrib_codejail-20.0.0/tutorcodejail/patches/kustomization-configmapgenerator +0 -6
  22. tutor_contrib_codejail-20.0.0/tutorcodejail/patches/kustomization-resources +0 -1
  23. tutor_contrib_codejail-20.0.0/tutorcodejail/patches/local-docker-compose-services +0 -13
  24. tutor_contrib_codejail-20.0.0/tutorcodejail/plugin.py +0 -162
  25. tutor_contrib_codejail-20.0.0/tutorcodejail/templates/codejail/build/codejail_apparmor/Dockerfile +0 -14
  26. tutor_contrib_codejail-20.0.0/tutorcodejail/templates/codejail/k8s/.gitignore +0 -0
  27. tutor_contrib_codejail-20.0.0/tutorcodejail/templates/codejail/k8s/hpa.yml +0 -18
  28. tutor_contrib_codejail-20.0.0/tutorcodejail/templates/codejail/tasks/.gitignore +0 -0
  29. tutor_contrib_codejail-20.0.0/tutorcodejail/templates/codejail/tasks/codejail-apparmor/init +0 -5
  30. {tutor_contrib_codejail-20.0.0 → tutor_contrib_codejail-21.0.0}/LICENSE +0 -0
  31. {tutor_contrib_codejail-20.0.0 → tutor_contrib_codejail-21.0.0}/MANIFEST.in +0 -0
  32. {tutor_contrib_codejail-20.0.0 → tutor_contrib_codejail-21.0.0}/setup.cfg +0 -0
  33. {tutor_contrib_codejail-20.0.0 → tutor_contrib_codejail-21.0.0}/tutor_contrib_codejail.egg-info/dependency_links.txt +0 -0
  34. {tutor_contrib_codejail-20.0.0 → tutor_contrib_codejail-21.0.0}/tutor_contrib_codejail.egg-info/entry_points.txt +0 -0
  35. {tutor_contrib_codejail-20.0.0 → tutor_contrib_codejail-21.0.0}/tutor_contrib_codejail.egg-info/top_level.txt +0 -0
  36. {tutor_contrib_codejail-20.0.0 → tutor_contrib_codejail-21.0.0}/tutorcodejail/__init__.py +0 -0
  37. {tutor_contrib_codejail-20.0.0 → tutor_contrib_codejail-21.0.0}/tutorcodejail/patches/.gitignore +0 -0
  38. {tutor_contrib_codejail-20.0.0 → tutor_contrib_codejail-21.0.0}/tutorcodejail/patches/cms-env +0 -0
  39. {tutor_contrib_codejail-20.0.0 → tutor_contrib_codejail-21.0.0}/tutorcodejail/patches/lms-env +0 -0
  40. {tutor_contrib_codejail-20.0.0 → tutor_contrib_codejail-21.0.0}/tutorcodejail/patches/local-docker-compose-dev-services +0 -0
  41. {tutor_contrib_codejail-20.0.0 → tutor_contrib_codejail-21.0.0}/tutorcodejail/templates/codejail/apps/.gitignore +0 -0
  42. {tutor_contrib_codejail-20.0.0/tutorcodejail/templates/codejail/apps/config → tutor_contrib_codejail-21.0.0/tutorcodejail/templates/codejail/apps/codejail}/tutor.py +0 -0
  43. /tutor_contrib_codejail-20.0.0/tutorcodejail/templates/codejail/apps/profiles/docker-edx-sandbox → /tutor_contrib_codejail-21.0.0/tutorcodejail/templates/codejail/apps/profiles/docker-edx-sandbox.profile +0 -0
  44. {tutor_contrib_codejail-20.0.0 → tutor_contrib_codejail-21.0.0}/tutorcodejail/templates/codejail/build/.gitignore +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tutor-contrib-codejail
3
- Version: 20.0.0
3
+ Version: 21.0.0
4
4
  Summary: Codejail plugin for Tutor
5
5
  Home-page: https://github.com/github/tutor-contrib-codejail
6
6
  Author: eduNEXT
@@ -12,14 +12,12 @@ Classifier: Intended Audience :: Developers
12
12
  Classifier: License :: OSI Approved :: GNU Affero General Public License v3
13
13
  Classifier: Operating System :: OS Independent
14
14
  Classifier: Programming Language :: Python
15
- Classifier: Programming Language :: Python :: 3.8
16
- Classifier: Programming Language :: Python :: 3.9
17
15
  Classifier: Programming Language :: Python :: 3.10
18
16
  Classifier: Programming Language :: Python :: 3.11
19
17
  Classifier: Programming Language :: Python :: 3.12
20
- Requires-Python: >=3.8
18
+ Requires-Python: >=3.10
21
19
  License-File: LICENSE
22
- Requires-Dist: tutor<21,>=20.0.0
20
+ Requires-Dist: tutor~=21.0
23
21
  Dynamic: author
24
22
  Dynamic: classifier
25
23
  Dynamic: description
@@ -34,27 +32,38 @@ Dynamic: summary
34
32
  Codejail plugin for `Tutor`_
35
33
  ============================
36
34
 
37
- Tutor plugin that configures and runs a `Codejail Service`_ using a REST API. `Codejail`_ allows for the
38
- secure execution of untrusted code within sandboxes, providing a safe environment for running potentially dangerous code.
35
+ Tutor plugin that configures and runs a `Codejail Service`_ using a REST API.
36
+ `Codejail`_ allows for the secure execution of untrusted code within sandboxes,
37
+ providing a safe environment for running potentially dangerous code.
38
+
39
+ Starting from the Ulmo release, the codejail plugin is transitioning to an
40
+ alternative implementation of the safe-exec API ( `Codejail Service V2`_).
41
+ You can opt-in to use this new implementation on Ulmo before it finally becomes
42
+ the default on the Verawood release.
39
43
 
40
44
  .. _Tutor: https://docs.tutor.overhang.io
41
45
  .. _Codejail Service: https://github.com/eduNEXT/codejailservice
46
+ .. _Codejail Service V2: https://github.com/openedx/codejail-service
42
47
  .. _Codejail: https://github.com/openedx/codejail
43
48
 
44
49
  Installation
45
50
  ------------
46
51
 
47
- To install the latest version run:
52
+ To install the latest version, run:
48
53
 
49
54
  .. code-block:: bash
50
55
 
56
+ pip install tutor-contrib-codejail
57
+ # or install from the source
51
58
  pip install git+https://github.com/edunext/tutor-contrib-codejail
52
59
 
53
60
  You can install a specific version by adding the tag, branch, or commit:
54
61
 
55
62
  .. code-block:: bash
56
63
 
57
- pip install git+https://github.com/edunext/tutor-contrib-codejail@v18.0.0
64
+ pip install tutor-contrib-codejail~=21.0
65
+ # or install from the source
66
+ pip install git+https://github.com/edunext/tutor-contrib-codejail@v21.0.0
58
67
 
59
68
  Usage
60
69
  -----
@@ -69,7 +78,6 @@ Run the initialization jobs to install the required AppArmor profile on your hos
69
78
  .. code-block:: bash
70
79
 
71
80
  tutor config save
72
- tutor local do init --limit codejail
73
81
 
74
82
  Finally, the platform can be run as usual:
75
83
 
@@ -85,29 +93,35 @@ Configuration
85
93
  To customize the configuration, update the following settings in Tutor:
86
94
 
87
95
  - ``CODEJAIL_APPARMOR_DOCKER_IMAGE``: (default: ``docker.io/ednxops/codejail_apparmor_loader:latest``)
96
+ - ``CODEJAIL_DOCKER_IMAGE_V2`` : (default: ``{{ CODEJAIL_DOCKER_IMAGE }}-v2``)
88
97
  - ``CODEJAIL_DOCKER_IMAGE``: (default: ``docker.io/ednxops/codejailservice:{{__version__}}``)
89
- - ``CODEJAIL_ENFORCE_APPARMOR`` (default: ``True``)
90
98
  - ``CODEJAIL_ENABLE_K8S_DAEMONSET`` (default: ``False``)
99
+ - ``CODEJAIL_ENFORCE_APPARMOR`` (default: ``True``)
100
+ - ``CODEJAIL_EXTRA_PIP_REQUIREMENTS`` (default: ``[]``)
101
+ - ``CODEJAIL_SANDBOX_PYTHON_VERSION`` (default: ``3.11.9``)
102
+ - ``CODEJAIL_SERVICE_REPOSITORY`` (default: ``https://github.com/edunext/codejailservice.git```)
103
+ - ``CODEJAIL_SERVICE_VERSION`` (default: ``{{ OPENEDX_COMMON_VERSION }}``),
91
104
  - ``CODEJAIL_SKIP_INIT`` (default: ``False``)
92
- - ``CODEJAIL_SANDBOX_PYTHON_VERSION`` (default: ``3.8.6``)
93
- - ``CODEJAIL_EXTRA_PIP_REQUIREMENTS`` (optional) A list of pip requirements to add to your sandbox.
94
- - ``CODEJAIL_SERVICE_VERSION`` (default: ``release/redwood.1``),
95
- - ``CODEJAIL_SERVICE_REPOSITORY`` (default ``https://github.com/edunext/codejailservice.git```)
96
-
97
- .. code-block:: yaml
105
+ - ``SERVICE_V2_REPOSITORY``: (default: ``https://github.com/openedx/codejail-service.git``)
106
+ - ``SERVICE_V2_VERSION``: (default: ``{{ OPENEDX_COMMON_VERSION }}``)
107
+ - ``USE_SERVICE_V2``: (default: ``False``)
98
108
 
99
- CODEJAIL_EXTRA_PIP_REQUIREMENTS:
100
- - pybryt
109
+ The ``CODEJAIL_V2_*`` settings are meant to be used only during the Ulmo
110
+ release and will be phased-out during the Verawood release.
101
111
 
112
+ To opt-in to the new implementation of the code-exec API set ``USE_SERVICE_V2``
113
+ to ``True`` and re-deploy your environment. If you are using a a custom image
114
+ for the codejail service you will need to rebuild it with ``USE_SERVICE_V2``
115
+ set to ``True``.
102
116
 
103
117
  Custom Image
104
118
  ~~~~~~~~~~~~
105
119
 
106
- In most cases, you can work with the provided docker image for the release. However, you will need to re-build the docker image when:
120
+ In most cases, you can work with the provided Docker image for the release. However, you will need to rebuild the Docker image when:
107
121
 
108
122
  . Additional requirements are included in the sandbox via ``CODEJAIL_EXTRA_PIP_REQUIREMENTS``.
109
123
  - A different version of Python is set for the sandbox environment via ``CODEJAIL_SANDBOX_PYTHON_VERSION``.
110
- - The custom version of edx-platform that changes the contents of requirements/edx-sandbox.
124
+ - You are using a custom version of edx-platform that changes the contents of requirements/edx-sandbox.
111
125
 
112
126
  Create a new image running:
113
127
 
@@ -141,6 +155,12 @@ Compatibility
141
155
  +------------------+---------------+
142
156
  | Redwood | >= 18.x |
143
157
  +------------------+---------------+
158
+ | Sumac | >= 19.x |
159
+ +------------------+---------------+
160
+ | Teak | >= 20.x |
161
+ +------------------+---------------+
162
+ | Ulmo | >= 21.x |
163
+ +------------------+---------------+
144
164
 
145
165
  **NOTE**: For the Open edX version of the Lilac release, the changes required for the Codejail service to interact with ``edx-platform`` are
146
166
  not included in ``open-release/lilac.master``. To use the service with the changes, please review `this PR`_.
@@ -152,12 +172,12 @@ Kubernetes Support
152
172
 
153
173
  The CodeJail service provides a sandbox to run arbitrary code. Security enforcement
154
174
  in the sandbox is done through *AppArmor*, this means that AppArmor must be installed
155
- in the host machine and the `provided profile`_ must be loaded.
175
+ in the host machine, and the `provided profile`_ must be loaded.
156
176
 
157
177
  .. _provided profile: tutorcodejail/templates/codejail/apps/profiles/docker-edx-sandbox
158
178
 
159
179
  The plugin provides an init task running a privileged container capable of loading the AppArmor profile onto your machine.
160
- This is only compatible with a docker installation.
180
+ This is only compatible with a Docker installation.
161
181
 
162
182
  For Kubernetes environments, ensure each node has AppArmor installed and the profile loaded. Optionally,
163
183
  set ``CODEJAIL_ENABLE_K8S_DAEMONSET`` to True to use a DaemonSet for loading the AppArmor profile,
@@ -187,24 +207,6 @@ Once the course is imported, go to any section and select an exercise (`section
187
207
 
188
208
  In this case, the section's content will render correctly and work as specified in the instructions of the problem.
189
209
 
190
- Possible failure case
191
- ~~~~~~~~~~~~~~~~~~~~~
192
-
193
- In case you forget to run ``tutor local do init --limit codejail`` for AppArmor profile, this error in
194
- ``Studio`` will arise::
195
-
196
- Error formatting HTML for the problem:
197
- cannot create LoncapaProblem block-v1:edX+DemoX+Demo_Course+type@problem+block@integral1: Error while
198
- executing script code: Codejail API Service is unavailable. Please try again in a few minutes.
199
-
200
- .. image:: ./docs/resources/Codejailfail.png
201
- :width: 750px
202
- :align: center
203
- :alt: Example when codejail is not working
204
-
205
- This indicates that the Codejail service is either not turned on or not working properly. Please ensure to follow
206
- the steps outlined in the usage section to prevent this issue.
207
-
208
210
  How to Contribute
209
211
  -----------------
210
212
 
@@ -1,27 +1,38 @@
1
1
  Codejail plugin for `Tutor`_
2
2
  ============================
3
3
 
4
- Tutor plugin that configures and runs a `Codejail Service`_ using a REST API. `Codejail`_ allows for the
5
- secure execution of untrusted code within sandboxes, providing a safe environment for running potentially dangerous code.
4
+ Tutor plugin that configures and runs a `Codejail Service`_ using a REST API.
5
+ `Codejail`_ allows for the secure execution of untrusted code within sandboxes,
6
+ providing a safe environment for running potentially dangerous code.
7
+
8
+ Starting from the Ulmo release, the codejail plugin is transitioning to an
9
+ alternative implementation of the safe-exec API ( `Codejail Service V2`_).
10
+ You can opt-in to use this new implementation on Ulmo before it finally becomes
11
+ the default on the Verawood release.
6
12
 
7
13
  .. _Tutor: https://docs.tutor.overhang.io
8
14
  .. _Codejail Service: https://github.com/eduNEXT/codejailservice
15
+ .. _Codejail Service V2: https://github.com/openedx/codejail-service
9
16
  .. _Codejail: https://github.com/openedx/codejail
10
17
 
11
18
  Installation
12
19
  ------------
13
20
 
14
- To install the latest version run:
21
+ To install the latest version, run:
15
22
 
16
23
  .. code-block:: bash
17
24
 
25
+ pip install tutor-contrib-codejail
26
+ # or install from the source
18
27
  pip install git+https://github.com/edunext/tutor-contrib-codejail
19
28
 
20
29
  You can install a specific version by adding the tag, branch, or commit:
21
30
 
22
31
  .. code-block:: bash
23
32
 
24
- pip install git+https://github.com/edunext/tutor-contrib-codejail@v18.0.0
33
+ pip install tutor-contrib-codejail~=21.0
34
+ # or install from the source
35
+ pip install git+https://github.com/edunext/tutor-contrib-codejail@v21.0.0
25
36
 
26
37
  Usage
27
38
  -----
@@ -36,7 +47,6 @@ Run the initialization jobs to install the required AppArmor profile on your hos
36
47
  .. code-block:: bash
37
48
 
38
49
  tutor config save
39
- tutor local do init --limit codejail
40
50
 
41
51
  Finally, the platform can be run as usual:
42
52
 
@@ -52,29 +62,35 @@ Configuration
52
62
  To customize the configuration, update the following settings in Tutor:
53
63
 
54
64
  - ``CODEJAIL_APPARMOR_DOCKER_IMAGE``: (default: ``docker.io/ednxops/codejail_apparmor_loader:latest``)
65
+ - ``CODEJAIL_DOCKER_IMAGE_V2`` : (default: ``{{ CODEJAIL_DOCKER_IMAGE }}-v2``)
55
66
  - ``CODEJAIL_DOCKER_IMAGE``: (default: ``docker.io/ednxops/codejailservice:{{__version__}}``)
56
- - ``CODEJAIL_ENFORCE_APPARMOR`` (default: ``True``)
57
67
  - ``CODEJAIL_ENABLE_K8S_DAEMONSET`` (default: ``False``)
68
+ - ``CODEJAIL_ENFORCE_APPARMOR`` (default: ``True``)
69
+ - ``CODEJAIL_EXTRA_PIP_REQUIREMENTS`` (default: ``[]``)
70
+ - ``CODEJAIL_SANDBOX_PYTHON_VERSION`` (default: ``3.11.9``)
71
+ - ``CODEJAIL_SERVICE_REPOSITORY`` (default: ``https://github.com/edunext/codejailservice.git```)
72
+ - ``CODEJAIL_SERVICE_VERSION`` (default: ``{{ OPENEDX_COMMON_VERSION }}``),
58
73
  - ``CODEJAIL_SKIP_INIT`` (default: ``False``)
59
- - ``CODEJAIL_SANDBOX_PYTHON_VERSION`` (default: ``3.8.6``)
60
- - ``CODEJAIL_EXTRA_PIP_REQUIREMENTS`` (optional) A list of pip requirements to add to your sandbox.
61
- - ``CODEJAIL_SERVICE_VERSION`` (default: ``release/redwood.1``),
62
- - ``CODEJAIL_SERVICE_REPOSITORY`` (default ``https://github.com/edunext/codejailservice.git```)
63
-
64
- .. code-block:: yaml
74
+ - ``SERVICE_V2_REPOSITORY``: (default: ``https://github.com/openedx/codejail-service.git``)
75
+ - ``SERVICE_V2_VERSION``: (default: ``{{ OPENEDX_COMMON_VERSION }}``)
76
+ - ``USE_SERVICE_V2``: (default: ``False``)
65
77
 
66
- CODEJAIL_EXTRA_PIP_REQUIREMENTS:
67
- - pybryt
78
+ The ``CODEJAIL_V2_*`` settings are meant to be used only during the Ulmo
79
+ release and will be phased-out during the Verawood release.
68
80
 
81
+ To opt-in to the new implementation of the code-exec API set ``USE_SERVICE_V2``
82
+ to ``True`` and re-deploy your environment. If you are using a a custom image
83
+ for the codejail service you will need to rebuild it with ``USE_SERVICE_V2``
84
+ set to ``True``.
69
85
 
70
86
  Custom Image
71
87
  ~~~~~~~~~~~~
72
88
 
73
- In most cases, you can work with the provided docker image for the release. However, you will need to re-build the docker image when:
89
+ In most cases, you can work with the provided Docker image for the release. However, you will need to rebuild the Docker image when:
74
90
 
75
91
  . Additional requirements are included in the sandbox via ``CODEJAIL_EXTRA_PIP_REQUIREMENTS``.
76
92
  - A different version of Python is set for the sandbox environment via ``CODEJAIL_SANDBOX_PYTHON_VERSION``.
77
- - The custom version of edx-platform that changes the contents of requirements/edx-sandbox.
93
+ - You are using a custom version of edx-platform that changes the contents of requirements/edx-sandbox.
78
94
 
79
95
  Create a new image running:
80
96
 
@@ -108,6 +124,12 @@ Compatibility
108
124
  +------------------+---------------+
109
125
  | Redwood | >= 18.x |
110
126
  +------------------+---------------+
127
+ | Sumac | >= 19.x |
128
+ +------------------+---------------+
129
+ | Teak | >= 20.x |
130
+ +------------------+---------------+
131
+ | Ulmo | >= 21.x |
132
+ +------------------+---------------+
111
133
 
112
134
  **NOTE**: For the Open edX version of the Lilac release, the changes required for the Codejail service to interact with ``edx-platform`` are
113
135
  not included in ``open-release/lilac.master``. To use the service with the changes, please review `this PR`_.
@@ -119,12 +141,12 @@ Kubernetes Support
119
141
 
120
142
  The CodeJail service provides a sandbox to run arbitrary code. Security enforcement
121
143
  in the sandbox is done through *AppArmor*, this means that AppArmor must be installed
122
- in the host machine and the `provided profile`_ must be loaded.
144
+ in the host machine, and the `provided profile`_ must be loaded.
123
145
 
124
146
  .. _provided profile: tutorcodejail/templates/codejail/apps/profiles/docker-edx-sandbox
125
147
 
126
148
  The plugin provides an init task running a privileged container capable of loading the AppArmor profile onto your machine.
127
- This is only compatible with a docker installation.
149
+ This is only compatible with a Docker installation.
128
150
 
129
151
  For Kubernetes environments, ensure each node has AppArmor installed and the profile loaded. Optionally,
130
152
  set ``CODEJAIL_ENABLE_K8S_DAEMONSET`` to True to use a DaemonSet for loading the AppArmor profile,
@@ -154,24 +176,6 @@ Once the course is imported, go to any section and select an exercise (`section
154
176
 
155
177
  In this case, the section's content will render correctly and work as specified in the instructions of the problem.
156
178
 
157
- Possible failure case
158
- ~~~~~~~~~~~~~~~~~~~~~
159
-
160
- In case you forget to run ``tutor local do init --limit codejail`` for AppArmor profile, this error in
161
- ``Studio`` will arise::
162
-
163
- Error formatting HTML for the problem:
164
- cannot create LoncapaProblem block-v1:edX+DemoX+Demo_Course+type@problem+block@integral1: Error while
165
- executing script code: Codejail API Service is unavailable. Please try again in a few minutes.
166
-
167
- .. image:: ./docs/resources/Codejailfail.png
168
- :width: 750px
169
- :align: center
170
- :alt: Example when codejail is not working
171
-
172
- This indicates that the Codejail service is either not turned on or not working properly. Please ensure to follow
173
- the steps outlined in the usage section to prevent this issue.
174
-
175
179
  How to Contribute
176
180
  -----------------
177
181
 
@@ -43,8 +43,8 @@ setup(
43
43
  long_description=load_readme(),
44
44
  packages=find_packages(exclude=["tests*"]),
45
45
  include_package_data=True,
46
- python_requires=">=3.8",
47
- install_requires=["tutor>=20.0.0,<21"],
46
+ python_requires=">=3.10",
47
+ install_requires=["tutor~=21.0"],
48
48
  entry_points={"tutor.plugin.v1": ["codejail = tutorcodejail.plugin"]},
49
49
  classifiers=[
50
50
  "Development Status :: 3 - Alpha",
@@ -52,8 +52,6 @@ setup(
52
52
  "License :: OSI Approved :: GNU Affero General Public License v3",
53
53
  "Operating System :: OS Independent",
54
54
  "Programming Language :: Python",
55
- "Programming Language :: Python :: 3.8",
56
- "Programming Language :: Python :: 3.9",
57
55
  "Programming Language :: Python :: 3.10",
58
56
  "Programming Language :: Python :: 3.11",
59
57
  "Programming Language :: Python :: 3.12",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tutor-contrib-codejail
3
- Version: 20.0.0
3
+ Version: 21.0.0
4
4
  Summary: Codejail plugin for Tutor
5
5
  Home-page: https://github.com/github/tutor-contrib-codejail
6
6
  Author: eduNEXT
@@ -12,14 +12,12 @@ Classifier: Intended Audience :: Developers
12
12
  Classifier: License :: OSI Approved :: GNU Affero General Public License v3
13
13
  Classifier: Operating System :: OS Independent
14
14
  Classifier: Programming Language :: Python
15
- Classifier: Programming Language :: Python :: 3.8
16
- Classifier: Programming Language :: Python :: 3.9
17
15
  Classifier: Programming Language :: Python :: 3.10
18
16
  Classifier: Programming Language :: Python :: 3.11
19
17
  Classifier: Programming Language :: Python :: 3.12
20
- Requires-Python: >=3.8
18
+ Requires-Python: >=3.10
21
19
  License-File: LICENSE
22
- Requires-Dist: tutor<21,>=20.0.0
20
+ Requires-Dist: tutor~=21.0
23
21
  Dynamic: author
24
22
  Dynamic: classifier
25
23
  Dynamic: description
@@ -34,27 +32,38 @@ Dynamic: summary
34
32
  Codejail plugin for `Tutor`_
35
33
  ============================
36
34
 
37
- Tutor plugin that configures and runs a `Codejail Service`_ using a REST API. `Codejail`_ allows for the
38
- secure execution of untrusted code within sandboxes, providing a safe environment for running potentially dangerous code.
35
+ Tutor plugin that configures and runs a `Codejail Service`_ using a REST API.
36
+ `Codejail`_ allows for the secure execution of untrusted code within sandboxes,
37
+ providing a safe environment for running potentially dangerous code.
38
+
39
+ Starting from the Ulmo release, the codejail plugin is transitioning to an
40
+ alternative implementation of the safe-exec API ( `Codejail Service V2`_).
41
+ You can opt-in to use this new implementation on Ulmo before it finally becomes
42
+ the default on the Verawood release.
39
43
 
40
44
  .. _Tutor: https://docs.tutor.overhang.io
41
45
  .. _Codejail Service: https://github.com/eduNEXT/codejailservice
46
+ .. _Codejail Service V2: https://github.com/openedx/codejail-service
42
47
  .. _Codejail: https://github.com/openedx/codejail
43
48
 
44
49
  Installation
45
50
  ------------
46
51
 
47
- To install the latest version run:
52
+ To install the latest version, run:
48
53
 
49
54
  .. code-block:: bash
50
55
 
56
+ pip install tutor-contrib-codejail
57
+ # or install from the source
51
58
  pip install git+https://github.com/edunext/tutor-contrib-codejail
52
59
 
53
60
  You can install a specific version by adding the tag, branch, or commit:
54
61
 
55
62
  .. code-block:: bash
56
63
 
57
- pip install git+https://github.com/edunext/tutor-contrib-codejail@v18.0.0
64
+ pip install tutor-contrib-codejail~=21.0
65
+ # or install from the source
66
+ pip install git+https://github.com/edunext/tutor-contrib-codejail@v21.0.0
58
67
 
59
68
  Usage
60
69
  -----
@@ -69,7 +78,6 @@ Run the initialization jobs to install the required AppArmor profile on your hos
69
78
  .. code-block:: bash
70
79
 
71
80
  tutor config save
72
- tutor local do init --limit codejail
73
81
 
74
82
  Finally, the platform can be run as usual:
75
83
 
@@ -85,29 +93,35 @@ Configuration
85
93
  To customize the configuration, update the following settings in Tutor:
86
94
 
87
95
  - ``CODEJAIL_APPARMOR_DOCKER_IMAGE``: (default: ``docker.io/ednxops/codejail_apparmor_loader:latest``)
96
+ - ``CODEJAIL_DOCKER_IMAGE_V2`` : (default: ``{{ CODEJAIL_DOCKER_IMAGE }}-v2``)
88
97
  - ``CODEJAIL_DOCKER_IMAGE``: (default: ``docker.io/ednxops/codejailservice:{{__version__}}``)
89
- - ``CODEJAIL_ENFORCE_APPARMOR`` (default: ``True``)
90
98
  - ``CODEJAIL_ENABLE_K8S_DAEMONSET`` (default: ``False``)
99
+ - ``CODEJAIL_ENFORCE_APPARMOR`` (default: ``True``)
100
+ - ``CODEJAIL_EXTRA_PIP_REQUIREMENTS`` (default: ``[]``)
101
+ - ``CODEJAIL_SANDBOX_PYTHON_VERSION`` (default: ``3.11.9``)
102
+ - ``CODEJAIL_SERVICE_REPOSITORY`` (default: ``https://github.com/edunext/codejailservice.git```)
103
+ - ``CODEJAIL_SERVICE_VERSION`` (default: ``{{ OPENEDX_COMMON_VERSION }}``),
91
104
  - ``CODEJAIL_SKIP_INIT`` (default: ``False``)
92
- - ``CODEJAIL_SANDBOX_PYTHON_VERSION`` (default: ``3.8.6``)
93
- - ``CODEJAIL_EXTRA_PIP_REQUIREMENTS`` (optional) A list of pip requirements to add to your sandbox.
94
- - ``CODEJAIL_SERVICE_VERSION`` (default: ``release/redwood.1``),
95
- - ``CODEJAIL_SERVICE_REPOSITORY`` (default ``https://github.com/edunext/codejailservice.git```)
96
-
97
- .. code-block:: yaml
105
+ - ``SERVICE_V2_REPOSITORY``: (default: ``https://github.com/openedx/codejail-service.git``)
106
+ - ``SERVICE_V2_VERSION``: (default: ``{{ OPENEDX_COMMON_VERSION }}``)
107
+ - ``USE_SERVICE_V2``: (default: ``False``)
98
108
 
99
- CODEJAIL_EXTRA_PIP_REQUIREMENTS:
100
- - pybryt
109
+ The ``CODEJAIL_V2_*`` settings are meant to be used only during the Ulmo
110
+ release and will be phased-out during the Verawood release.
101
111
 
112
+ To opt-in to the new implementation of the code-exec API set ``USE_SERVICE_V2``
113
+ to ``True`` and re-deploy your environment. If you are using a a custom image
114
+ for the codejail service you will need to rebuild it with ``USE_SERVICE_V2``
115
+ set to ``True``.
102
116
 
103
117
  Custom Image
104
118
  ~~~~~~~~~~~~
105
119
 
106
- In most cases, you can work with the provided docker image for the release. However, you will need to re-build the docker image when:
120
+ In most cases, you can work with the provided Docker image for the release. However, you will need to rebuild the Docker image when:
107
121
 
108
122
  . Additional requirements are included in the sandbox via ``CODEJAIL_EXTRA_PIP_REQUIREMENTS``.
109
123
  - A different version of Python is set for the sandbox environment via ``CODEJAIL_SANDBOX_PYTHON_VERSION``.
110
- - The custom version of edx-platform that changes the contents of requirements/edx-sandbox.
124
+ - You are using a custom version of edx-platform that changes the contents of requirements/edx-sandbox.
111
125
 
112
126
  Create a new image running:
113
127
 
@@ -141,6 +155,12 @@ Compatibility
141
155
  +------------------+---------------+
142
156
  | Redwood | >= 18.x |
143
157
  +------------------+---------------+
158
+ | Sumac | >= 19.x |
159
+ +------------------+---------------+
160
+ | Teak | >= 20.x |
161
+ +------------------+---------------+
162
+ | Ulmo | >= 21.x |
163
+ +------------------+---------------+
144
164
 
145
165
  **NOTE**: For the Open edX version of the Lilac release, the changes required for the Codejail service to interact with ``edx-platform`` are
146
166
  not included in ``open-release/lilac.master``. To use the service with the changes, please review `this PR`_.
@@ -152,12 +172,12 @@ Kubernetes Support
152
172
 
153
173
  The CodeJail service provides a sandbox to run arbitrary code. Security enforcement
154
174
  in the sandbox is done through *AppArmor*, this means that AppArmor must be installed
155
- in the host machine and the `provided profile`_ must be loaded.
175
+ in the host machine, and the `provided profile`_ must be loaded.
156
176
 
157
177
  .. _provided profile: tutorcodejail/templates/codejail/apps/profiles/docker-edx-sandbox
158
178
 
159
179
  The plugin provides an init task running a privileged container capable of loading the AppArmor profile onto your machine.
160
- This is only compatible with a docker installation.
180
+ This is only compatible with a Docker installation.
161
181
 
162
182
  For Kubernetes environments, ensure each node has AppArmor installed and the profile loaded. Optionally,
163
183
  set ``CODEJAIL_ENABLE_K8S_DAEMONSET`` to True to use a DaemonSet for loading the AppArmor profile,
@@ -187,24 +207,6 @@ Once the course is imported, go to any section and select an exercise (`section
187
207
 
188
208
  In this case, the section's content will render correctly and work as specified in the instructions of the problem.
189
209
 
190
- Possible failure case
191
- ~~~~~~~~~~~~~~~~~~~~~
192
-
193
- In case you forget to run ``tutor local do init --limit codejail`` for AppArmor profile, this error in
194
- ``Studio`` will arise::
195
-
196
- Error formatting HTML for the problem:
197
- cannot create LoncapaProblem block-v1:edX+DemoX+Demo_Course+type@problem+block@integral1: Error while
198
- executing script code: Codejail API Service is unavailable. Please try again in a few minutes.
199
-
200
- .. image:: ./docs/resources/Codejailfail.png
201
- :width: 750px
202
- :align: center
203
- :alt: Example when codejail is not working
204
-
205
- This indicates that the Codejail service is either not turned on or not working properly. Please ensure to follow
206
- the steps outlined in the usage section to prevent this issue.
207
-
208
210
  How to Contribute
209
211
  -----------------
210
212
 
@@ -15,21 +15,18 @@ tutorcodejail/plugin.py
15
15
  tutorcodejail/patches/.gitignore
16
16
  tutorcodejail/patches/cms-env
17
17
  tutorcodejail/patches/k8s-deployments
18
- tutorcodejail/patches/k8s-jobs
19
18
  tutorcodejail/patches/k8s-services
20
19
  tutorcodejail/patches/kustomization-configmapgenerator
21
- tutorcodejail/patches/kustomization-resources
22
20
  tutorcodejail/patches/lms-env
23
21
  tutorcodejail/patches/local-docker-compose-dev-services
24
22
  tutorcodejail/patches/local-docker-compose-jobs-services
25
23
  tutorcodejail/patches/local-docker-compose-services
26
24
  tutorcodejail/templates/codejail/apps/.gitignore
27
- tutorcodejail/templates/codejail/apps/config/tutor.py
28
- tutorcodejail/templates/codejail/apps/profiles/docker-edx-sandbox
25
+ tutorcodejail/templates/codejail/apps/codejail/tutor.py
26
+ tutorcodejail/templates/codejail/apps/codejail-service-v2/tutor.py
27
+ tutorcodejail/templates/codejail/apps/profiles/docker-edx-sandbox.profile
28
+ tutorcodejail/templates/codejail/apps/profiles/openedx-codejail-service.profile
29
29
  tutorcodejail/templates/codejail/build/.gitignore
30
30
  tutorcodejail/templates/codejail/build/codejail/Dockerfile
31
- tutorcodejail/templates/codejail/build/codejail_apparmor/Dockerfile
32
- tutorcodejail/templates/codejail/k8s/.gitignore
33
- tutorcodejail/templates/codejail/k8s/hpa.yml
34
- tutorcodejail/templates/codejail/tasks/.gitignore
35
- tutorcodejail/templates/codejail/tasks/codejail-apparmor/init
31
+ tutorcodejail/templates/codejail/build/codejail-service/Dockerfile
32
+ tutorcodejail/templates/codejail/build/codejail_apparmor/Dockerfile
@@ -1,2 +1,2 @@
1
1
  """Helps you keep your cool when creating dozens of open edX and eduNEXT environments."""
2
- __version__ = "20.0.0"
2
+ __version__ = "21.0.0"
@@ -1,4 +1,5 @@
1
1
  ---
2
+ {% if CODEJAIL_USE_SERVICE_V2 %}
2
3
  apiVersion: apps/v1
3
4
  kind: Deployment
4
5
  metadata:
@@ -13,11 +14,49 @@ spec:
13
14
  metadata:
14
15
  labels:
15
16
  app.kubernetes.io/name: codejailservice
16
- annotations:
17
- {% if CODEJAIL_ENFORCE_APPARMOR %}
18
- container.apparmor.security.beta.kubernetes.io/codejailservice: "localhost/docker-edx-sandbox"
19
- {% endif %}
20
17
  spec:
18
+ securityContext:
19
+ appArmorProfile:
20
+ type: Localhost
21
+ localhostProfile: openedx_codejail_service
22
+ containers:
23
+ - name: codejailservice
24
+ image: {{ CODEJAIL_DOCKER_IMAGE_V2 }}
25
+ ports:
26
+ - containerPort: 8550
27
+ env:
28
+ - name: DJANGO_SETTINGS_MODULE
29
+ value: codejail_service.settings.tutor
30
+ volumeMounts:
31
+ - mountPath: /app/codejail_service/settings/tutor.py
32
+ name: settings-codejail
33
+ subPath: tutor.py
34
+ volumes:
35
+ - name: settings-codejail
36
+ configMap:
37
+ name: settings-codejail
38
+ {% else %}
39
+ apiVersion: apps/v1
40
+ kind: Deployment
41
+ metadata:
42
+ name: codejailservice
43
+ labels:
44
+ app.kubernetes.io/name: codejailservice
45
+ spec:
46
+ selector:
47
+ matchLabels:
48
+ app.kubernetes.io/name: codejailservice
49
+ template:
50
+ metadata:
51
+ labels:
52
+ app.kubernetes.io/name: codejailservice
53
+ spec:
54
+ {% if CODEJAIL_ENFORCE_APPARMOR %}
55
+ securityContext:
56
+ appArmorProfile:
57
+ type: Localhost
58
+ localhostProfile: docker-edx-sandbox
59
+ {% endif %}
21
60
  containers:
22
61
  - name: codejailservice
23
62
  image: {{ CODEJAIL_DOCKER_IMAGE }}
@@ -30,17 +69,11 @@ spec:
30
69
  - mountPath: /openedx/codejailservice/codejailservice/tutor.py
31
70
  name: settings-codejail
32
71
  subPath: tutor.py
33
- resources:
34
- limits:
35
- cpu: "{{ CODEJAIL_LIMIT_CPU }}"
36
- memory: "{{ CODEJAIL_LIMIT_MEMORY }}"
37
- requests:
38
- cpu: "{{ CODEJAIL_REQUEST_CPU }}"
39
- memory: "{{ CODEJAIL_REQUEST_MEMORY }}"
40
72
  volumes:
41
73
  - name: settings-codejail
42
74
  configMap:
43
75
  name: settings-codejail
76
+ {% endif %}
44
77
  {% if CODEJAIL_ENABLE_K8S_DAEMONSET %}
45
78
  ---
46
79
  apiVersion: apps/v1
@@ -61,7 +94,11 @@ spec:
61
94
  spec:
62
95
  containers:
63
96
  - name: apparmor-loader
64
- image: google/apparmor-loader:latest
97
+ image: {{ CODEJAIL_APPARMOR_DOCKER_IMAGE }}
98
+ command:
99
+ - /usr/bin/loader
100
+ - -logtostderr
101
+ - -v=2
65
102
  args:
66
103
  # Tell the loader to pull the /profiles directory every 30 seconds.
67
104
  - -poll
@@ -3,6 +3,8 @@ apiVersion: v1
3
3
  kind: Service
4
4
  metadata:
5
5
  name: codejailservice
6
+ labels:
7
+ app.kubernetes.io/name: codejailservice
6
8
  spec:
7
9
  type: ClusterIP
8
10
  ports: