feat(secrets): add interactive masked prompt for secrets set#4861
feat(secrets): add interactive masked prompt for secrets set#4861sbs44 wants to merge 3 commits intosupabase:developfrom
Conversation
- Prompt for secret values when name provided without value - Display asterisks per character for input length verification - Handle Ctrl+C, backspace, and non-printable character filtering - Maintain backwards compatibility with NAME=VALUE inline syntax - Skip SUPABASE_ prefixed names before prompting
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 📝 WalkthroughWalkthroughAdds interactive masked prompting to Changes
Sequence Diagram(s)mermaid Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 5 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
324a073 to
d9c11cb
Compare
- Check read byte count before accessing buffer to fix G602 gosec warnings - Explicitly discard term.Restore error to fix errcheck warning
d9c11cb to
e6c8b8f
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@internal/utils/credentials/input.go`:
- Around line 24-53: The readMaskedInput function currently only accepts
printable ASCII bytes (32–126) and drops bytes ≥128, corrupting UTF‑8/binary
secrets; update the printable branch in readMaskedInput so that any non‑control
byte is treated as input: keep the existing special cases for Ctrl+C (ch==3),
Enter (ch==13||ch==10) and Backspace/Delete (ch==127||ch==8), and replace the
"ch >= 32 && ch < 127" condition with a broader check such as "ch >= 32 && ch !=
127" or "ch >= 32" (so bytes >=128 are accepted), appending the raw byte to buf
and echoing '*', ensuring secrets containing non‑ASCII bytes are preserved.
Bytes >= 128 were silently dropped, corrupting UTF-8 secrets.
Problem
supabase secrets set MY_SECRET=valueexposes secret values in cleartext in shell history. There is no way to set secrets interactively without them being recorded.Solution
Add an interactive masked prompt when a secret name is provided without a value:
KEY=VALUEformatSUPABASE_prefixed names are skipped before promptingBackwards compatibility is fully maintained —
KEY=VALUEargs and--env-filework as before. Mixed usage also works:supabase secrets set KEY1=val KEY2sets KEY1 inline and prompts for KEY2.Implementation
promptSecretcallback intoListSecrets— callers likeserve.gopassnilto preserve existing behaviorreadMaskedInputusesterm.MakeRawfor raw terminal mode with byte-by-byte readingRelated
secrets set#4860Summary by CodeRabbit
New Features
Documentation
Tests