Skip to content

Protect the SQLite database and verify media before replacing a backup - #3733

Merged
pournasserian merged 5 commits into
feature/stabilize-preview-2from
3724-safe-sqlite-backups
Nov 28, 2026
Merged

pournasserian merged 5 commits into
feature/stabilize-preview-2from
3724-safe-sqlite-backups

Conversation

@pournasserian

@pournasserian pournasserian commented Nov 28, 2026 •

Copy link
Copy Markdown
Member

Closes #3724
Closes #3725

What

  • Refuse a backup destination that could replace SQLite, its journals, or fall inside the local media directory (FCMS3254). Check it before opening SQLite or creating files. The output must name a file, not an existing directory or a link to one. Ordinary sibling archives remain replaceable. A linked media root is supported; nested directory symlinks/junctions are refused, not traversed or silently skipped. A file link is allowed only if its target resolves and the archive cannot replace it. The preflight and copy phases enforce the same policy.
  • Before replacing the previous archive, verify each local original named by the private snapshot against the staged ZIP: exact entry name, length and SHA-256 (FCMS3255). Include snapshot-required named .tmp originals but not unrelated scratch files. A newer upload is allowed; cloud originals stay the storage operator’s responsibility. No changes to retention or SVG handling.
  • Link the 1.0 verification checklist from the release runbook. Azure OpenAI and Entra/OIDC are not marked verified; the public API is not frozen.

Why

An output mistake could replace the live database. Independently, replacing media during backup could produce a successful archive whose database names a file the archive does not contain. Either refusal leaves protected inputs and the prior archive intact. Verifying the staged bytes adds a read of the archived originals.

Dependencies: No new packages. Path resolution uses existing Windows/POSIX system APIs. As documented, ambiguous path spellings are refused; use a distinct backup directory and a trusted, stable mount layout. The command does not detect two bind mounts or shares exposing the same storage.

Checklist

  • Linked to both issues and the approved stabilization scope.
  • Added regression and operator documentation for both error codes. Tested concurrent replacement, wrong bytes/case, local originals with remote active storage, legitimate .tmp originals, unrelated scratch files, and preservation of the previous archive.
  • On the final Windows tree, BackupDestinationTests: 10 passed, 5 skipped (4 POSIX-only and 1 requiring Windows file-symlink privilege); data BackupCommandTests: 24 passed, 2 platform/provider cases skipped. Regression cases cover nested junctions and cycles, a link added after snapshot, and a linked root whose contents were backed up correctly. Feature CI on the final head passed on Windows and Ubuntu. The Ubuntu TRX confirms that the linked-file target, external directory link and POSIX link traversal regressions actually ran and passed.
  • Full solution Release build passed with warnings as errors; the four changed Markdown files passed lint.
  • No tool-generated co-author trailers or footers.

Checkpoint into feature/stabilize-preview-2; leave unmerged for maintainer review.

@pournasserian
pournasserian marked this pull request as draft November 28, 2026 00:29
@pournasserian
pournasserian marked this pull request as ready for review November 28, 2026 00:48
@pournasserian
pournasserian merged commit f4edd49 into feature/stabilize-preview-2 Nov 28, 2026
4 checks passed
@pournasserian
pournasserian deleted the 3724-safe-sqlite-backups branch November 28, 2026 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant