feat: add support for sudo and password-requiring commands - #1
Open
bernatfp wants to merge 3 commits into
Open
Conversation
Add SecureInput system for handling password prompts in interactive commands (sudo, ssh -t, ansible -K, etc.). - Create SecureInput namespace with event-based password request system - Add PTY-based execution path in Bash tool for interactive commands - Auto-detect commands needing interaction via pattern matching - Detect password prompts and request secure input from user - Sanitize output to remove password prompts before sending to LLM - Add server routes for secure-input submit/cancel - Add TUI SecureInputPrompt component - Add web app SecureInputPrompt component - Integrate secure_input into sync contexts Security: Password goes directly to PTY, never stored or logged. 60s timeout, max 3 retry attempts. Refs: anomalyco#9808 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…putPrompt - Remove unsupported `password` prop from textarea - Implement manual password input handling with useKeyboard - Display asterisks (*) for each character entered - Handle Enter to submit, Escape to cancel, Backspace to delete - Add visual cursor indicator Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The SecureInputPrompt's Enter and Escape keys weren't working because sdk.client.secureInput didn't exist in the JS SDK - the handlers threw errors before reaching the submit/cancel logic. Root cause: The secure-input API routes were added to the backend but the SDK was never regenerated to include the client methods. This caused silent failures when calling sdk.client.secureInput.submit() and sdk.client.secureInput.cancel(). SDK changes (regenerated from OpenAPI spec): - Added SecureInputRequest type and secure-input event payloads - Added request/response shapes for /secure-input endpoints - Added SecureInput client with list, listForSession, submit, cancel - Exposed via OpencodeClient.secureInput TUI changes: - Simplified keyboard handling using direct useKeyboard capture - Removed hidden textarea approach (onInput was not a valid prop) - Added dialog guard to skip input when dialogs are open - Changed clear shortcut from Ctrl+Delete to Ctrl+U Why the original diagnosis missed this: The investigation focused on the TUI layer (keyboard event handling, textarea props, focus management) rather than verifying the SDK methods existed. The TypeScript errors for SecureInputRequest and secureInput were visible but dismissed as "pre-existing SDK type generation issues" rather than recognized as the root cause. A simple console.log in the submit/cancel handlers would have revealed the SDK calls were throwing. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add SecureInput system for handling password prompts in interactive commands (sudo, ssh -t, ansible -K, etc.).
Security: Password goes directly to PTY, never stored or logged. 60s timeout, max 3 retry attempts.
Refs: anomalyco#9808
What does this PR do?
How did you verify your code works?