Skip to content

Add interactive, stdin, and clipboard input modes to strongbox set - #30

Merged
jpol34 merged 2 commits into
mainfrom
feat/set-interactive-input
Sep 16, 2026
Merged

jpol34 merged 2 commits into
mainfrom
feat/set-interactive-input

Conversation

@jpol34

@jpol34 jpol34 commented Sep 16, 2026

Copy link
Copy Markdown
Owner

Summary

  • strongbox set <name> with no value arg now prompts via masked Read-Host -AsSecureString (no echo, no retype-confirm)
  • strongbox set <name> - reads the value from stdin, for scripts
  • strongbox set <name> --from-clipboard reads the value off the OS clipboard and clears it after, gated the same way get/reveal already are (refuses outside a real interactive terminal without --real)
  • --owner/--rotation-days/--scope/--project are unaffected

Test plan

  • Invoke-Pester -Path Tests/Strongbox.Cli.Tests.ps1 — 12/12 new tests passing
  • Invoke-Pester -Path Tests/Strongbox.Tests.ps1 — 43 passed, 1 pre-existing skip, no regressions
  • Manual: echo value | strongbox set tools.StrongboxSelfTest - then get --real round-trips correctly
  • Manual: strongbox set personal.NotReal --from-clipboard refuses non-interactively without --real
  • Sandbox secret tools.StrongboxSelfTest restored to its documented placeholder value after manual testing

Closes #28.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RbfuHLCmCUaTFi6A1gKugh

jpol34 and others added 2 commits September 16, 2026 17:52
strongbox set <name> with no value now prompts via a masked Read-Host
(no echo, no retype-confirm); '-' reads the value from stdin for
scripts; --from-clipboard reads it off the OS clipboard, clears it
after, and is gated the same way get/reveal already are (refuses
outside a real interactive terminal without --real, since clipboard
content is ambient rather than something an automated caller should
silently grab).

Closes #28.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RbfuHLCmCUaTFi6A1gKugh
- Restore the usage error when set resolves to an empty value (was
  silently writing empty-valued secrets)
- Gate the bare interactive-prompt path the same way as
  --from-clipboard, so a non-interactive caller that omits a value
  fails fast instead of hanging on Read-Host against a non-terminal
  stdin
- Match set's flag names exactly instead of a '--*' wildcard, so a
  literal value that happens to start with '--' is stored as given
  instead of being misread as "no value provided"
- Deduplicate the non-interactive gate (get/reveal/set --from-clipboard/
  set's bare prompt) into one Assert-StrongboxNonInteractiveGate helper
- Extract Test-StrongboxPositionalValueGiven so the CLI tests exercise
  the real dispatch logic instead of duplicating its expression

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RbfuHLCmCUaTFi6A1gKugh
@jpol34
jpol34 merged commit b819b8d into main Sep 16, 2026
1 check passed
@jpol34
jpol34 deleted the feat/set-interactive-input branch September 16, 2026 22:58
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.

Interactive & scripted secret input for strongbox set

1 participant