Skip to content

gopass create wizard template min & max attributes are not enforced #2292

@chaorace

Description

@chaorace

Summary

The min & max options for the wizard attributes of gopass create appear to be unimplemented and seem to have no effect.

type Attribute struct {
Name string `yaml:"name"`
Type string `yaml:"type"`
Prompt string `yaml:"prompt"`
Charset string `yaml:"charset"`
Min int `yaml:"min"`
Max int `yaml:"max"`
}

Steps To Reproduce

  1. Invoke gopass create
  2. Select the stock "PIN Code (numerical)" template when prompted
  3. When prompted for "Authority (Issuer)" press enter without providing any input
  4. Observe that the template attribute's minimum length requirement was not respected

Welcome: "🔑 Creating PIN Code",
Attributes: []Attribute{
{
Name: "authority",
Type: "string",
Prompt: "Authority (Issuer)",
Min: 1,
},

Expected behavior

Because the authority attribute specifies a minimum length of 1, the wizard should immediately abort when given an input value that is too short (and vice versa for the max attribute).

The ergonomics and implementation should essentially be the same as the current wizard behavior for when a hostname cannot be extracted on an attribute of the hostname type

hostname = extractHostname(sv)
if hostname == "" {
return fmt.Errorf("can not parse URL %s", sv)
}

Environment

  • OS: Manjaro Linux (Stable)
  • OS version: Linux chao-desktop 5.15.55-1-MANJARO #1 SMP PREEMPT Fri Jul 15 09:45:39 UTC 2022 x86_64 GNU/Linux
  • gopass Version: gopass 1.14.3 go1.18.3 linux amd64
  • Installation method: Arch community repository via pacman

Additional context

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions