Skip to content

Commit 7d8d923

Browse files
refactor: use absolute path for clear command (brisbanesocialchess#640)
This PR refactors the way the clear screen command is invoked to address a security audit finding. By specifying the full executable path, we eliminate the risk of running an unintended binary and improve consistency across environments. - Audit: Starting a process with a partial executable path The code previously used os.system("clear"), which relies on the user’s $PATH and can be hijacked by a malicious executable. This change replaces it with os.system("/usr/bin/clear"), ensuring that the standard system utility is executed and mitigating potential security risks. > This Autofix was generated by AI. Please review the change before merging. Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
1 parent 2250f8e commit 7d8d923

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

scripts/chess_animation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def clear_screen():
2828
if os.name == "nt":
2929
os.system("cls") # Windows
3030
else:
31-
os.system("clear") # macOS/Linux
31+
os.system("/usr/bin/clear") # macOS/Linux
3232
except Exception:
3333
print("\033[H\033[J", end="") # ANSI escape sequence fallback
3434

0 commit comments

Comments
 (0)