Add manual backup creation and delete buttons to Update Manager#1255
Add manual backup creation and delete buttons to Update Manager#1255Sebbeben wants to merge 10 commits intoPart-DB:masterfrom
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1255 +/- ##
============================================
+ Coverage 55.42% 56.26% +0.83%
- Complexity 8266 8291 +25
============================================
Files 610 610
Lines 26513 26594 +81
============================================
+ Hits 14694 14962 +268
+ Misses 11819 11632 -187 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- Add "Create Backup" button in the backups tab for on-demand backups - Add delete buttons (trash icons) for update logs and backups - New controller routes with CSRF protection and permission checks - Use data-turbo-confirm for CSP-safe confirmation dialogs - Add deleteLog() method to UpdateExecutor with filename validation
…ple from auto-update - Decouple backup creation/restore UI from can_auto_update so Docker and other non-git installations can use backup features - Add backup download endpoint for saving backups externally - Fix SQLite restore to use configured DATABASE_URL path instead of hardcoded var/app.db (affects Docker and custom SQLite paths) - Show Docker-specific warning about var/backups/ not being persisted - Pass is_docker flag to template via InstallationTypeDetector
- Controller tests: auth, CSRF validation, 404 for missing backups, restore disabled check - UpdateExecutor: deleteLog validation, non-existent file, successful deletion - BackupManager: deleteBackup validation for missing/non-zip files
9a82359 to
b15074e
Compare
Add happy-path tests for backup creation, deletion, download, and log deletion with valid CSRF tokens. Also test the locked state blocking backup creation.
|
The ability to download database dumps is quite critical, as it circumvents bascially any protection mechanism of Part-DB and allows access to even normally hidden infos like password hashes, secrets, etc. Thats why there should be an environment variable to enable/disable the backup download ability. Also this makes the downloadBackup endpoint quite critical. It should at very least have an CSFR token check. Also all more critical endpoints, should also do an |
829b321 to
c16b6c7
Compare
Address security review feedback from jbtronics: - Add IS_AUTHENTICATED_FULLY to all sensitive endpoints (create/delete backup, delete log, download backup, start update, restore) - Change backup download from GET to POST with CSRF token - Require password confirmation before downloading backups (backups contain sensitive data like password hashes and secrets) - Add DISABLE_BACKUP_DOWNLOAD env var (default: disabled) to control whether backup downloads are allowed - Add password confirmation modal with security warning in template - Add comprehensive tests: auth checks, env var blocking, POST-only enforcement, status/progress endpoint auth
- Replace shared modal + inline JS with per-backup modals that have filename pre-set in hidden fields (no JavaScript needed) - Add data-turbo="false" to download forms for native browser handling - Add data-bs-dismiss="modal" to submit button to auto-close modal - Add hidden username field for Chrome accessibility best practice - Fix test: GET on POST-only route returns 404 not 405
|
Thanks for the security review @jbtronics! All suggestions have been implemented:
Screenshot of the password confirmation dialog:
Tested on a live instance — download works with password verification, wrong passwords are rejected, and the download button is hidden when |

Summary
Adds backup management buttons to the Update Manager and improves Docker support, with security hardening for sensitive operations.
Backup Management
var/backups/is not a persistent volumevar/backups/DATABASE_URLpath instead of hardcodedvar/app.dbSecurity Hardening
DISABLE_BACKUP_DOWNLOADenv var (default:1= disabled) — backups contain sensitive data (password hashes, secrets), so download is opt-inIS_AUTHENTICATED_FULLYcheck on all critical endpoints to prevent remember-me token abuseNew
.envvariableChanges
UpdateManagerController.phpUserPasswordHasherInterface,DISABLE_BACKUP_DOWNLOADenv var,IS_AUTHENTICATED_FULLYon critical endpoints, POST download with CSRF + passwordBackupManager.phpindex.html.twigdata-turbo="false"for downloads.envDISABLE_BACKUP_DOWNLOAD=1defaultmessages.en.xlfTesting done
DISABLE_BACKUP_DOWNLOAD=1(default) hides download buttons entirelyDISABLE_BACKUP_DOWNLOAD=0shows download button with password modal