dcg

rsync

remote.rsync

Protects against destructive rsync operations like --delete and its variants.

  • 2blocking rules
  • 3safe patterns
  • 2High
~/.config/dcg/config.toml
[packs]
enabled = ["remote.rsync"]

Evaluated when a command contains rsync.

Blocking rules

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

  1. rsync-del-short

    High

    rsync --del is a short alias for --delete and is destructive.

    Explanation
    The --del flag is shorthand for --delete-during, which deletes destination files not present in source during the transfer. This is slightly more dangerous than --delete-after because deletions happen incrementally. Safer alternatives: - rsync --dry-run --del: Preview deletions first - rsync without deletion flags: Additive sync only - Use --delete-after for predictable batch deletion
  2. rsync-delete

    High

    rsync --delete removes destination files not present in source.

    Explanation
    The --delete flag removes files from the destination that don't exist in the source. If source and destination are swapped, or if the source is unexpectedly empty, important data on the destination can be permanently deleted. Safer alternatives: - rsync --dry-run --delete: Preview what would be deleted - rsync without --delete: Only adds/updates, never deletes - rsync --backup --delete: Keep backup copies of deleted files

Safe patterns

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

  • rsync-dry-run
  • rsync-short-dry-run
  • rsync-list-only