Skip to content

Add --no-clobber for explicit --output files - #2341

Open
VISHNU0906 wants to merge 1 commit into
getsops:mainfrom
VISHNU0906:feat/no-clobber-output-2297-dco
Open

VISHNU0906 wants to merge 1 commit into
getsops:mainfrom
VISHNU0906:feat/no-clobber-output-2297-dco

Conversation

@VISHNU0906

Copy link
Copy Markdown

Summary

Adds an opt-in --no-clobber flag so sops fails instead of overwriting an existing --output destination (including through symlinks). Default overwrite behavior stays the same.

Why

Requested in #2297 for safer scripted decrypt/encrypt flows.

Test plan

  • Unit coverage for reject without --output, reject with --in-place, existing file, symlink target, and successful write into a new path.
  • go test ./... on the touched packages.

Fixes #2297

Supersedes #2340 (same change, recommitted with DCO sign-off).

Opt-in flag fails without changing an existing destination, including
symlinks, by opening the output path with O_EXCL. Rejected without
--output or with --in-place; default overwrite behavior is unchanged.

Fixes getsops#2297

Signed-off-by: KVR Vishnu <46535652+VISHNU0906@users.noreply.github.com>
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.

Add --no-clobber for explicit output files

1 participant