/cg restore
Restores files from a backup.
Syntax
/cg restore
[--dry-run] [--only ] [--prefix ] [--no-overwrite] [--backup-before]
Options
-
--dry-run
Prints the restore plan without writing anything -
--only
Restore only a single file (relative unix path) -
--prefix
Restore only files under a prefix (normalized to end with /) -
--no-overwrite
Do not overwrite existing files (skips them) -
--backup-before
Creates a safety snapshot of the current state for the same file set before applying restore
Rules
- --only and --prefix are mutually exclusive
- Unknown tokens are refused (strict parsing)
Safety and validation
- Uses the global lock shared with backup and scheduler
- Refuses unsafe paths (absolute paths, traversal segments like ..)
- Blocks restoring ConfigGuard runtime storage:
- plugins/mina/configguard/backups
- plugins/mina/configguard/reports
- Validates payload integrity:
- sha256 when present
- otherwise size check when present
- Enforces safety limits from config:
- restore.maxFilesPerRun
- restore.maxBytesPerFile
- restore.previewLines
Atomic writes
- Restore uses atomic writes per file to reduce partial write risk