Coverage for portality/api/current/data_objects/common.py: 93%

15 statements  

« prev     ^ index     » next       coverage.py v6.4.2, created at 2022-07-22 15:59 +0100

1def _check_for_script(data): 

2 for key, value in data.items(): 

3 if value: 

4 if isinstance(value, dict): 

5 if _check_for_script(value): 

6 return True 

7 elif isinstance(value, str): 

8 if "<script>" in value: 

9 return True 

10 elif isinstance(value, list): 

11 for x in value: 

12 if isinstance(x, str): 

13 if "<script>" in value: 

14 return True 

15 return False