Skip to content

Commit e87187c

Browse files
committed
Refactor subprocess call in test_full_cmorisation to enhance security by using explicit argument assignment and removing unnecessary nosec comments
1 parent fe5b4e2 commit e87187c

1 file changed

Lines changed: 14 additions & 11 deletions

File tree

tests/integration/test_full_cmorisation.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -155,17 +155,20 @@ def _validate_with_prepare(self, output_file, cmor_name, table_path):
155155
output_arg = escaped_output_file # Validated and escaped output file
156156

157157
# Use explicit argument assignment to satisfy security scanners
158-
cmd_args = [
159-
PREPARE_EXECUTABLE,
160-
VARIABLE_FLAG,
161-
cmor_arg,
162-
TABLE_PATH_FLAG,
163-
table_arg,
164-
output_arg,
165-
]
166-
result = subprocess.run(
167-
cmd_args, capture_output=True, text=True, check=False, shell=False
168-
) # nosec B603, B602
158+
result = subprocess.run( # noqa: S603 # nosec B603
159+
[
160+
PREPARE_EXECUTABLE,
161+
VARIABLE_FLAG,
162+
cmor_arg,
163+
TABLE_PATH_FLAG,
164+
table_arg,
165+
output_arg,
166+
], # Explicit list with predefined elements
167+
capture_output=True,
168+
text=True,
169+
check=False,
170+
shell=False,
171+
)
169172

170173
if result.returncode != 0:
171174
pytest.fail(

0 commit comments

Comments
 (0)