|
Download tasks/codeql_python_benchmark51_v2/pyvul-7c7eaf17f0df49603ae4/post_context.md from Benchanything/checkerbench: direct link, hf CLI and curl.
- Browser
- Download file 1.13 kB
-
https://huggingface.co/datasets/Benchanything/checkerbench/resolve/main/tasks/codeql_python_benchmark51_v2/pyvul-7c7eaf17f0df49603ae4/post_context.md
- Command line
-
hf download hf://datasets/Benchanything/checkerbench/tasks/codeql_python_benchmark51_v2/pyvul-7c7eaf17f0df49603ae4/post_context.md
-
curl -L -o post_context.md https://huggingface.co/datasets/Benchanything/checkerbench/resolve/main/tasks/codeql_python_benchmark51_v2/pyvul-7c7eaf17f0df49603ae4/post_context.md
1.13 kB
Patch-overlapping Python context after the fix
pyanyapi/interfaces.py — class:YAMLInterface (lines 272-279)
class YAMLInterface(DictInterface):
_error_message = 'YAML data can not be parsed.'
def perform_parsing(self):
try:
return yaml.safe_load(self.content)
except yaml.error.YAMLError:
raise ResponseParseError(self._error_message, self.content)
pyanyapi/interfaces.py — function:YAMLInterface.perform_parsing (lines 275-279)
def perform_parsing(self):
try:
return yaml.safe_load(self.content)
except yaml.error.YAMLError:
raise ResponseParseError(self._error_message, self.content)
tests/test_parsers.py — function:test_yaml_parser_vulnerability (lines 66-72)
def test_yaml_parser_vulnerability():
"""
In case of usage of yaml.load `test` value will be equal to 0.
"""
parsed = YAMLParser({'test': 'container > test'}).parse('!!python/object/apply:os.system ["exit 0"]')
with pytest.raises(ResponseParseError):
parsed.test