From 9cce9e6d67c5d8c1c111300926d09e21e244d45f Mon Sep 17 00:00:00 2001 From: Lilian Date: Tue, 28 Feb 2023 14:45:41 +0100 Subject: [PATCH] add math module to allowed modules --- backend/api/services/exoValidation.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/backend/api/services/exoValidation.py b/backend/api/services/exoValidation.py index 208b67d..80825e7 100644 --- a/backend/api/services/exoValidation.py +++ b/backend/api/services/exoValidation.py @@ -1,19 +1,20 @@ import ast -from multiprocessing import Manager +import os import random import re import string -from fastapi.exceptions import HTTPException -from fastapi import UploadFile, status +from multiprocessing import Manager + import sympy -from tortoise.validators import Validator +from fastapi import UploadFile, status +from fastapi.exceptions import HTTPException from tortoise.exceptions import ValidationError -import types -from services.timeout import Process + from services.io import is_binary_file -import os -VALIDATED_MODULES = ["random", "string", "sympy"] +from services.timeout import Process + +VALIDATED_MODULES = ["random", "string", "sympy", "math"] def checkExoSupportCompatibility(obj): isPdf = False if (obj['pdf'] == None or ( obj['calcul'] == False and obj['pdf'] == False)) else True