Skip to content

[plan] Add interactive secret input with password masking #14018

@github-actions

Description

@github-actions

Objective

Enhance the gh aw secret set command with interactive secret input using Huh forms, providing password masking and validation for improved security and user experience.

Context

Issue #14013 identified an opportunity to add interactive secret management. Currently, secrets are set via command-line arguments which can expose sensitive values in shell history.

Approach

  1. Create promptForSecret() function in pkg/cli/secret_set_command.go
  2. Use huh.NewInput() with EchoModePassword for masked input
  3. Add validation to prevent empty secrets
  4. Integrate with console.IsAccessibleMode() for accessibility

Implementation Details

func promptForSecret() (string, error) {
    var secretValue string
    form := huh.NewForm(
        huh.NewGroup(
            huh.NewInput().
                Title("Enter secret value").
                Description("This value will be encrypted and stored securely").
                EchoMode(huh.EchoModePassword).
                Value(&secretValue).
                Validate(func(s string) error {
                    if len(s) == 0 {
                        return fmt.Errorf("secret value cannot be empty")
                    }
                    return nil
                }),
        ),
    ).WithAccessible(console.IsAccessibleMode())
    
    return secretValue, form.Run()
}

Files to Modify

  • Update: pkg/cli/secret_set_command.go - Add interactive secret input
  • Update: pkg/cli/secret_set_command_test.go - Add tests for interactive mode

Acceptance Criteria

  • Interactive secret input with password masking
  • Empty secret validation with helpful error message
  • Accessibility mode support (plain text mode when needed)
  • TTY detection - skip interactive prompt when input is piped
  • Command-line argument takes precedence over interactive prompt
  • Shell history does not contain secret values
  • Tests cover interactive and non-interactive modes
    Related to Terminal Stylist Analysis: Console Output Patterns in gh-aw #14013

AI generated by Plan Command for #14013

  • expires on Feb 8, 2026, 1:01 AM UTC

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions