TISbackup/libtisbackup
k3nny debc753f13 fix(security): replace os.popen/os.system with subprocess for command injection prevention
Replace all deprecated and unsafe command execution methods with
secure subprocess.run() calls using list arguments.

Changes:
- Replace os.popen() with subprocess.run() in tisbackup_gui.py
- Replace os.system() with subprocess.run() in tasks.py and backup_xva.py
- Add input validation for device/partition names (regex-based)
- Fix file operations to use context managers (with statement)
- Remove wildcard import from shutil
- Add timeout protection to all subprocess calls (5-30s)
- Improve error handling with proper try/except blocks

Security improvements:
- Prevent command injection vulnerabilities in USB disk operations
- Validate device paths with regex before system calls
- Use list arguments instead of shell=True to prevent injection
- Add proper error handling instead of silent failures

Code quality improvements:
- Replace deprecated os.popen() (deprecated since Python 2.6)
- Use context managers for file operations
- Remove wildcard imports for cleaner namespace
- Add comprehensive error handling and logging

Documentation:
- Add SECURITY_IMPROVEMENTS.md documenting all changes
- Document remaining security issues and recommendations
- Include testing recommendations and migration notes

BREAKING CHANGE: None - all changes are backward compatible

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-05 01:23:53 +02:00
..
iniparse fix(tisbackup): fix iniparse wrong check 2025-04-14 23:37:16 +02:00
__init__.py EOF & whitespace 2024-11-29 00:54:09 +01:00
backup_mysql.py Fix replace 2025-03-07 22:54:14 +01:00
backup_null.py fix iniparse 2024-11-29 23:45:40 +01:00
backup_oracle.py Fix re.compile / re.match warnings 2025-03-07 22:51:20 +01:00
backup_pgsql.py Fix re.compile / re.match warnings 2025-03-07 22:51:20 +01:00
backup_rsync_btrfs.py Fix re.compile / re.match warnings 2025-03-07 22:51:20 +01:00
backup_rsync.py Fix re.compile / re.match warnings 2025-03-07 22:51:20 +01:00
backup_samba4.py Fix re.compile / re.match warnings 2025-03-07 22:51:20 +01:00
backup_sqlserver.py Fix re.compile / re.match warnings 2025-03-07 22:51:20 +01:00
backup_switch.py Fix re.compile / re.match warnings 2025-03-07 22:51:20 +01:00
backup_vmdk.py fix iniparse 2024-11-29 23:45:40 +01:00
backup_xcp_metadata.py Fix re.compile / re.match warnings 2025-03-07 22:51:20 +01:00
backup_xva.py fix(security): replace os.popen/os.system with subprocess for command injection prevention 2025-10-05 01:23:53 +02:00
common.py Fix re.compile / re.match warnings 2025-03-07 22:51:20 +01:00
copy_vm_xcp.py fix iniparse 2024-11-29 23:45:40 +01:00
XenAPI.py fix iniparse 2024-11-29 23:45:40 +01:00