From ac703e9ebb36c1c4c4050c862327c534a587492a Mon Sep 17 00:00:00 2001 From: Ray Smets Date: Fri, 24 Nov 2023 10:09:03 -0800 Subject: [PATCH] [shutil] used thanks to trunk calling out security implication of the native os cp command via the script. --- narrator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/narrator.py b/narrator.py index 1bd83d8..589aaf3 100644 --- a/narrator.py +++ b/narrator.py @@ -1,6 +1,7 @@ import base64 import errno import os +import shutil import time from dotenv import load_dotenv @@ -63,9 +64,8 @@ def play_audio(text): # Copy the image analyzed to the same directory as the audio file image_path = os.path.join(os.getcwd(), "./frames/frame.jpg") new_image_path = os.path.join(dir_path, "image.jpg") - os.system(f"cp {image_path} {new_image_path}") + shutil.copy(image_path, new_image_path) - # Play the audio play(audio)