From cf373850e93d3dff92df31acd3107e1e23ae2a53 Mon Sep 17 00:00:00 2001 From: "Chaurasiya, Payal" Date: Wed, 25 Dec 2024 21:52:54 -0800 Subject: [PATCH] Replace xml.etree.ElementTree.parse with its defusedxml Signed-off-by: Chaurasiya, Payal --- test-requirements.txt | 1 + tests/end_to_end/utils/summary_helper.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/test-requirements.txt b/test-requirements.txt index bb2fc0421b..1f808c2f37 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -4,3 +4,4 @@ paramiko pytest==8.3.4 pytest-asyncio==0.25.0 pytest-mock==3.14.0 +defusedxml==0.7.1 diff --git a/tests/end_to_end/utils/summary_helper.py b/tests/end_to_end/utils/summary_helper.py index a832a281c7..25b29ad9fd 100644 --- a/tests/end_to_end/utils/summary_helper.py +++ b/tests/end_to_end/utils/summary_helper.py @@ -1,7 +1,7 @@ # Copyright 2020-2023 Intel Corporation # SPDX-License-Identifier: Apache-2.0 -import xml.etree.ElementTree as ET +from defusedxml.ElementTree import parse as defused_parse from lxml import etree import os from pathlib import Path @@ -17,7 +17,7 @@ print(f"Results XML file not found at {result_xml}. Exiting...") exit(1) -tree = ET.parse(result_xml, parser=parser) +tree = defused_parse(result_xml, parser=parser) # Get the root element testsuites = tree.getroot()