diff --git a/modules/backup/index.py b/modules/backup/index.py index 41ff44d..c97a060 100644 --- a/modules/backup/index.py +++ b/modules/backup/index.py @@ -26,10 +26,8 @@ def _sanitize_for_log(value, max_length=200): log injection via forged line breaks or terminal control sequences. - Truncates overly long values to avoid log flooding. """ - # Ensure we are working with a string representation if not isinstance(value, str): value = str(value) - # Strip all ASCII control characters (U+0000–U+001F and U+007F), including CR/LF control_chars = ''.join(chr(i) for i in range(32)) + chr(127) translation_table = str.maketrans('', '', control_chars) cleaned = value.translate(translation_table) @@ -82,7 +80,6 @@ class BackupConfig(db.Model): use_external_storage = db.Column(db.Boolean, default=True) updated_at = db.Column(db.DateTime, default=datetime.utcnow) - # We only need Settings reference for auto_backup_enabled check class Settings(db.Model): __tablename__ = 'settings' __table_args__ = {'extend_existing': True} @@ -110,7 +107,7 @@ def create_backup(): if encrypt: cfg = module._get_config() if cfg.encrypt_method == 'none': - password = None # no encryption even if requested + password = None elif cfg.encrypt_method == 'custom' and cfg.custom_password: password = cfg.custom_password else: @@ -217,12 +214,10 @@ def on_enable(self): 'ADD COLUMN use_external_storage BOOLEAN DEFAULT 1')) conn.commit() except Exception as e: - logger.debug('backup_config migration: %s', e) # table may not exist yet + logger.debug('backup_config migration: %s', e) - # Run startup backup immediately (first launch of the day) self._perform_startup_backup() - # Register daily backup job with the scheduler self.core.scheduler.add_job( job_id='backup.daily', func=self._scheduled_backup, @@ -270,7 +265,6 @@ def get_settings_html(self, settings): enc_none = 'checked' if cfg.encrypt_method == 'none' else '' enc_app = 'checked' if cfg.encrypt_method == 'app_password' else '' enc_cust = 'checked' if cfg.encrypt_method == 'custom' else '' - # Default to app_password if not set to any known value if not enc_none and not enc_cust: enc_app = 'checked' cp = cfg.custom_password or '' @@ -293,7 +287,6 @@ def _render_settings(self, auto_ck, bp, enc_none, enc_app, enc_cust, 'Full backups include database (JSON) and all uploaded files ' 'in a ZIP archive.

') - # auto backup checkbox a('
') a('
') - # custom backup path a('
') a('') a(f'' 'Absolute path or relative to app root.
') - # external storage option if ext_ok: a('
') a('
') - # encryption LS = 'display:block;margin-bottom:8px;font-weight:normal;cursor:pointer;' a('
') a('