dcg

Restic

backup.restic

Protects against destructive restic operations like forgetting snapshots, pruning data, removing keys, and cache cleanup.

  • 5blocking rules
  • 8safe patterns
  • 3Critical
  • 1High
  • 1Low
~/.config/dcg/config.toml
[packs]
enabled = ["backup.restic"]

Evaluated when a command contains restic.

Blocking rules

Each rule ID is backup.restic:<name>. Use it in allowlists and [policy.rules].

  1. restic-forget

    Critical

    restic forget removes snapshots and can permanently delete backup data.

    Explanation
    restic forget removes snapshots from repository: - Snapshot metadata removed from repository - Data not deleted until prune is run - Use --keep-* flags to retain recent snapshots - --dry-run shows what would be forgotten Preview first: restic forget --dry-run [options]
  2. restic-key-remove

    Critical

    restic key remove deletes encryption keys and can make backups unrecoverable.

    Explanation
    restic key remove deletes repository encryption keys: - Key is permanently deleted from repository - If all keys removed, repository becomes inaccessible - Cannot recover data without a valid key - Always keep at least one key available List keys first: restic key list
  3. restic-prune

    Critical

    restic prune removes unreferenced data and is irreversible.

    Explanation
    restic prune permanently deletes unreferenced data: - Removes data no longer referenced by snapshots - Usually run after 'restic forget' - Cannot be undone - data is permanently deleted - May take a long time for large repositories Consider: restic forget --prune to combine operations
  4. restic-unlock-remove-all

    High

    restic unlock --remove-all force-removes repository locks.

    Explanation
    restic unlock --remove-all force-removes all locks: - Removes locks from potentially active operations - May cause corruption if operations are in progress - Use only when locks are stale/orphaned Check first: ensure no other restic processes are running
  5. restic-cache-cleanup

    Low

    restic cache --cleanup removes cached data from disk.

    Explanation
    restic cache --cleanup removes local cache: - Deletes cached data from local disk - Does not affect repository data - Cache will be rebuilt on next operation - May slow down subsequent operations Lower risk: only affects local cache, not backups

Safe patterns

Checked first. A command that matches one is never blocked by this pack.

  • restic-snapshots
  • restic-ls
  • restic-stats
  • restic-check
  • restic-diff
  • restic-find
  • restic-backup
  • restic-restore