@@ -222,7 +222,10 @@ def resolved_command(command: str) -> str:
222222def open_file (filepath : str , * , prefer_vscode : bool = False ) -> None :
223223 """Open a file with the platform default opener or VS Code."""
224224 if prefer_vscode :
225- subprocess .run ([resolved_command ("code" ), filepath ], check = True )
225+
226+ # Reviewed: command is resolved from PATH and shell=False is used.
227+ # The filepath is passed as a single argument to the editor.
228+ subprocess .run ([resolved_command ("code" ), filepath ], check = True ) # nosec B603
226229 return
227230
228231 if sys .platform .startswith ("win" ):
@@ -233,7 +236,12 @@ def open_file(filepath: str, *, prefer_vscode: bool = False) -> None:
233236 mac_open = "/usr/bin/open"
234237 if not Path (mac_open ).is_file ():
235238 mac_open = resolved_command ("open" )
236- subprocess .run ([mac_open , filepath ], check = True )
239+
240+ # Reviewed: macOS opener is fixed/resolved and shell=False is used.
241+ # The filepath is passed as a single argument.
242+ subprocess .run ([mac_open , filepath ], check = True ) # nosec B603
237243 return
238244
239- subprocess .run ([resolved_command ("xdg-open" ), filepath ], check = True )
245+ # Reviewed: opener command is resolved from PATH and shell=False is used.
246+ # The filepath is passed as a single argument.
247+ subprocess .run ([resolved_command ("xdg-open" ), filepath ], check = True ) # nosec B603
0 commit comments