You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
setup nuke: require stdout TTY so confirmation summary is visible
Redirecting stdout could hide the destructive summary while stdin stayed
interactive. Check stdout().is_terminal() before stdin, bail with a clear
message, and document in README, manual, and CLI help. Integration test
expects the stdout requirement when both streams are piped.
Made-with: Cursor
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -111,7 +111,7 @@ Use `decrypt --non-interactive` in CI with `A8C_SECRETS_IDENTITY` (or a key file
111
111
112
112
### Terminals, prompts, and private keys on stdout
113
113
-**`setup init`** and **`keys rotate`** require **stdout** connected to a terminal so new private keys are not accidentally written to a file or pipe. `keys rotate` also needs **stdin** for its menus and confirmations.
114
-
-**`setup nuke`** and **`rm`** (without `--non-interactive`) require**stdin** for confirmation prompts.
114
+
-**`setup nuke`**requires **stdout**and **stdin** connected to a terminal (you must see the destructive summary before confirming). **`rm`** (without `--non-interactive`) requires**stdin** for confirmation prompts.
115
115
-**`decrypt`** orphan handling uses **stdin** for the orphan prompt (unless `--non-interactive` is set or stdin is not an interactive terminal — see above).
116
116
-**`edit`** is for interactive use (`$EDITOR`, optional create prompt).
Copy file name to clipboardExpand all lines: src/commands/setup/nuke.rs
+8Lines changed: 8 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -8,11 +8,19 @@ use crate::keys;
8
8
9
9
/// Remove repo and local `a8c-secrets` data for the current repository.
10
10
///
11
+
/// Requires stdout and stdin to be terminals so the destructive summary and confirmation
12
+
/// prompt are visible and typed interactively.
13
+
///
11
14
/// # Errors
12
15
///
13
16
/// Returns an error if repo/config discovery fails, user input fails, or any
14
17
/// of the cleanup file operations fail.
15
18
pubfnrun() -> Result<()>{
19
+
if !std::io::stdout().is_terminal(){
20
+
anyhow::bail!(
21
+
"`a8c-secrets setup nuke` must not redirect stdout — it prints a destructive summary and confirmation prompt. Run it in a terminal so you can see what you are confirming."
22
+
);
23
+
}
16
24
if !std::io::stdin().is_terminal(){
17
25
anyhow::bail!(
18
26
"`a8c-secrets setup nuke` requires stdin connected to a terminal for confirmation."
0 commit comments