From 00f9a6a6869cef38d20db8c7a4aa493b5f62b257 Mon Sep 17 00:00:00 2001 From: zanninso Date: Wed, 18 Dec 2024 20:53:37 +0100 Subject: [PATCH 1/3] tests: removing eval redefine --- js/tests/elementary_test.js | 1 - 1 file changed, 1 deletion(-) diff --git a/js/tests/elementary_test.js b/js/tests/elementary_test.js index 58456bc1ad..e67daa11a0 100644 --- a/js/tests/elementary_test.js +++ b/js/tests/elementary_test.js @@ -1,5 +1,4 @@ Math.imul = undefined -eval = undefined // /*/ // ⚡ export const tests = [] const t = (f) => tests.push(f) From c4363dd68389bd71bac95ff11df9833f270cc944 Mon Sep 17 00:00:00 2001 From: zanninso Date: Wed, 18 Dec 2024 20:55:23 +0100 Subject: [PATCH 2/3] tests: adding option to prevent students from using eval for elementary exercise --- js/tests/entrypoint.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/js/tests/entrypoint.sh b/js/tests/entrypoint.sh index 6e89170da3..8bd2ced8e8 100755 --- a/js/tests/entrypoint.sh +++ b/js/tests/entrypoint.sh @@ -7,4 +7,9 @@ if test "$CODE_EDITOR_RUN_ONLY" = true; then exit fi +if test $EXERCISE = "elementary"; then + node --disallow-code-generation-from-strings /app/test.mjs "/jail/student" "${EXERCISE}" + exit +fi + node /app/test.mjs "/jail/student" "${EXERCISE}" From 0c8eb48bf9d40c102291d1976eb8a9774a251416 Mon Sep 17 00:00:00 2001 From: zanninso Date: Wed, 18 Dec 2024 21:05:45 +0100 Subject: [PATCH 3/3] tests: fixing format --- js/tests/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/tests/entrypoint.sh b/js/tests/entrypoint.sh index 8bd2ced8e8..9de509edd4 100755 --- a/js/tests/entrypoint.sh +++ b/js/tests/entrypoint.sh @@ -7,7 +7,7 @@ if test "$CODE_EDITOR_RUN_ONLY" = true; then exit fi -if test $EXERCISE = "elementary"; then +if test "$EXERCISE" = "elementary"; then node --disallow-code-generation-from-strings /app/test.mjs "/jail/student" "${EXERCISE}" exit fi