Commit Graph

29 Commits

Author SHA1 Message Date
1cb731cbdb refactor(drivers): organize backup modules into drivers subfolder
Some checks failed
lint / docker (push) Has been cancelled
- Move all backup_*.py files to libtisbackup/drivers/ subdirectory
- Move XenAPI.py and copy_vm_xcp.py to drivers/ (driver-specific)
- Create drivers/__init__.py with automatic driver imports
- Update tisbackup.py imports to use new structure
- Add pyvmomi>=8.0.0 as mandatory dependency
- Sync requirements.txt with pyproject.toml dependencies
- Add pylint>=3.0.0 and pytest-cov>=6.0.0 to dev dependencies
- Configure pylint and coverage tools in pyproject.toml
- Add conventional commits guidelines to CLAUDE.md
- Enhance .gitignore with comprehensive patterns for Python, IDEs, testing, and secrets
- Update CLAUDE.md documentation with new structure and tooling

Breaking Changes:
- Drivers must now be imported from libtisbackup.drivers instead of libtisbackup
- All backup driver files relocated to drivers/ subdirectory

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-05 23:54:26 +02:00
e6ee91babf feat(auth): enable Basic Auth as default authentication method
- Initialize authentication system on Flask app startup
- Default to Basic Auth if no [authentication] section in config
- Support TISBACKUP_AUTH_USERNAME and TISBACKUP_AUTH_PASSWORD env vars
- Generate secure random password if not configured with warning
- Protect all Flask routes with @auth.require_auth decorator
- Fallback to 'none' auth provider on initialization errors

Routes protected:
- / (backup_all)
- /config_number/ (set_config_number)
- /all_json (backup_all_json)
- /json (backup_json)
- /status.json (export_backup_status)
- /backups.json (last_backup_json)
- /last_backups (last_backup)
- /export_backup (export_backup)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-05 02:11:41 +02:00
68ff4238e0 fix(security): remove hardcoded Flask secret key
Replace hardcoded Flask secret key with environment variable to
prevent session hijacking and CSRF attacks.

Changes:
- Load secret key from TISBACKUP_SECRET_KEY environment variable
- Fall back to cryptographically secure random key using secrets module
- Log warning when random key is used (sessions won't persist)
- Add environment variable example to README.md Docker Compose config
- Add setup instructions in Configuration section

Security improvements:
- Eliminates hardcoded secret in source code
- Uses secrets.token_hex(32) for cryptographically strong random generation
- Sessions remain secure even without env var (though won't persist)
- Prevents session hijacking and CSRF bypass attacks

Documentation:
- Update README.md with TISBACKUP_SECRET_KEY setup instructions
- Include command to generate secure random key
- Update SECURITY_IMPROVEMENTS.md with implementation details
- Mark hardcoded secret key issue as resolved

Setup:
```bash
# Generate secure key
python3 -c "import secrets; print(secrets.token_hex(32))"

# Set in environment
export TISBACKUP_SECRET_KEY=your-key-here
```

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-05 01:29:16 +02:00
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
737f9bea38 fix iniparse
All checks were successful
lint / docker (push) Successful in 9m14s
fix code passing ruff linter
pre-commit ruff
pre-commit ruff format
2024-11-29 23:45:40 +01:00
e7e98d0b47 few fixes and lint compatible 2024-11-29 00:48:59 +01:00
8479c378ee fix basic 2024-11-29 00:32:39 +01:00
ffd9bf3d39 fix first pass 2024-11-28 23:20:19 +01:00
fggp
63f7339206 Corrected import of huey attribute 2022-12-26 14:02:49 +01:00
Francois PINOT
4393998b61 Added libtispackup to the Python path 2022-12-26 14:02:49 +01:00
htouvet
bc4b9811ed migrate to Python3 (from alejeune) 2022-04-25 10:02:43 +02:00
agauvrit
0f9a8ed1da forgot that print 2020-11-20 14:11:17 +01:00
agauvrit
f9df4effd3 add all_json API entrypoint and read_all_configs method 2020-11-20 14:11:16 +01:00
ssamson-tis
af9471e56b Fix '*' or name database in tisbackup gui 2015-10-27 15:23:45 +01:00
ssamson-tis
1805b22476 fix: previous fix 2015-07-28 14:41:52 +02:00
ssamson-tis
815241d9e8 fix: type sqlserver+ssh avec TisCompliance 2015-07-28 14:32:17 +02:00
ssamson-tis
aaa06bf4b9 Improve oracle backups 2015-07-17 17:27:42 +02:00
ssamson-tis
dea1df94b8 Fix : tisbackup_gui crash if there isn't database provided 2015-07-10 15:36:13 +02:00
ssamson-tis
74ae78c8d2 fix bugs on UI 2015-07-09 11:02:28 +02:00
ssamson-tis
a555b5d55c Remove old uwsgi references 2015-07-08 17:37:21 +02:00
ssamson-tis
9a561e66bb Fix bugs with huey 2015-07-08 16:02:14 +02:00
ssamson-tis
4c188d8f94 use huey to spool exports backups 2015-07-06 18:01:49 +02:00
ssamson-tis
ba022d64d3 Use new based theme on bootstrap 2015-07-03 16:18:48 +02:00
ssamson-tis
4ff384f5c7 First support to multiple tisbackup-config.ini files 2015-06-30 18:10:03 +02:00
ssamson-tis
ec4bd696e1 Fix wrong finish staus on status.json 2015-06-30 14:48:34 +02:00
ssamson-tis
575a951d5f improove perfermances with last_backups page 2015-06-29 15:16:19 +02:00
Jérémie Courrèges-Anglas
2fc54046c2 Just use the json module from the python distribution
One less requirement for packaging.
2014-11-20 16:10:55 +01:00
ssamson-tis
f7056732f4 Possibilité de choisir les backups à exporter sur disque dur externe 2014-07-25 15:06:51 +02:00
ssamson-tis
bd05ae8f25 Fist commit 2013-05-23 10:19:43 +02:00