Skip to content

Commit 5b3aa74

Browse files
committed
Fix Codacy findings on PR 202
- use-defused-xml: switch test XML parse to defusedxml.ElementTree; justify the write-only xml.etree import in reports.py (no untrusted parsing) - dangerous-subprocess-use-audit: nosemgrep on the Qt-free subprocess probe (fixed argv, sys.executable, no shell) - pylint not-callable: disable on registry.usb_client getter guarded by callable()
1 parent 532d982 commit 5b3aa74

4 files changed

Lines changed: 4 additions & 3 deletions

File tree

je_auto_control/utils/remote_desktop/registry.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@ def webrtc_usb_client(self):
363363
if viewer is None:
364364
return None
365365
getter = getattr(viewer, "usb_client", None)
366+
# pylint: disable=not-callable # reason: guarded by callable(getter)
366367
return getter() if callable(getter) else None
367368

368369

je_auto_control/utils/test_suite/reports.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import json
1414
import uuid
15-
import xml.etree.ElementTree as ET
15+
import xml.etree.ElementTree as ET # nosemgrep # nosec B405 # reason: write-only XML generation; never parses untrusted input
1616
from pathlib import Path
1717
from typing import Any, Dict, List
1818

test/unit_test/headless/test_assertions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def test_assertion_import_stays_qt_free():
3030
"qt = [m for m in sys.modules if 'PySide6' in m]\n"
3131
"import json; print(json.dumps(qt))\n"
3232
)
33-
result = subprocess.run( # nosec B603
33+
result = subprocess.run( # nosec B603 # nosemgrep
3434
[sys.executable, "-c", script],
3535
capture_output=True, text=True, check=True, timeout=60,
3636
)

test/unit_test/headless/test_test_suite.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""Headless tests for the QA suite runner, reports, and quarantine."""
2-
import xml.etree.ElementTree as ET
2+
import defusedxml.ElementTree as ET
33
from pathlib import Path
44

55
import pytest

0 commit comments

Comments
 (0)