Security: Fix command injection, path traversal, and hardcoded secrets #155
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Comprehensive security review identified and resolved 9 vulnerabilities across shell scripts, Python code, and web endpoints.
Command Injection (High)
scripts/uefi-tools/uuefi-apply.sh,scripts/secure-boot/keys-centralize.sh: Replacedeval "$*"with"$@"scripts/recovery/autonuke.py: Changedsubprocess.run()default toshell=Falsewithshlex.split()Secrets & Credentials (High)
web/hardware_database_server.py: Replaced hardcoded FlaskSECRET_KEYwithos.environ.get('SECRET_KEY', secrets.token_hex(32))Path Traversal (Critical)
web/hardware_database_server.py: Added alphanumeric validation and TOCTOU-resistant path resolution in download endpointInsecure Temp Files (Medium)
scripts/secure-boot/enable-secureboot-kexec.sh: Replaced predictable/tmp/phoenixboot_*.shwithmktempInput Validation (Medium)
scripts/recovery/nuclear-wipe.sh: Added device path regex validation, extracted to reusable functionDeprecated APIs
scripts/validation/detect_bootkit.py: Replacedos.system()withsubprocess.run()Breaking change?
Impacts security?
Includes tests?
How This Was Tested
Integration Instructions
Production deployments should set
SECRET_KEYenvironment variable forweb/hardware_database_server.py. If unset, a random key is generated (sessions invalidated on restart).Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.