Coverage for /home/runner/work/viur-core/viur-core/viur/src/viur/core/bones/raw.py: 40%

8 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2024-09-03 13:41 +0000

1from viur.core.bones.base import BaseBone, ReadFromClientError, ReadFromClientErrorSeverity 

2 

3 

4class RawBone(BaseBone): 

5 """ 

6 Stores its data without applying any pre/post-processing or filtering. Can be used to store 

7 non-html content. 

8 Use the dot-notation like "raw.markdown" or similar to describe subsequent types. 

9 

10 ..Warning: Using this bone will lead to security vulnerabilities like reflected XSS unless the 

11 data is either otherwise validated/stripped or from a trusted source! Don't use this unless 

12 you fully understand it's implications! 

13 """ 

14 type = "raw" 

15 

16 def singleValueFromClient(self, value, skel, bone_name, client_data): 

17 err = self.isInvalid(value) 

18 if err: 

19 return self.getEmptyValue(), [ReadFromClientError(ReadFromClientErrorSeverity.Invalid, err)] 

20 return value, None