Skip to content

Conversation

@dopey
Copy link
Contributor

@dopey dopey commented Feb 28, 2025

  • min-encryption-password-length
  • provisioner

Enforce min-password-length, if set, in the 'step ssh certificate' command.

@dopey dopey requested a review from maraino February 28, 2025 03:48
@github-actions github-actions bot added the needs triage Waiting for discussion / prioritization by team label Feb 28, 2025
@dopey dopey force-pushed the max/provisioner-password branch from d8493f8 to 45286f9 Compare February 28, 2025 03:49
dopey added 3 commits March 3, 2025 11:25
- min-encryption-password-length
- provisioner

Enforce min-encryption-password-length, if set, in the 'step ssh
certificate' command.
@dopey dopey force-pushed the max/provisioner-password branch from 5de1ab3 to 9b1015f Compare March 3, 2025 19:26
Comment on lines 31 to 32
Issuer string `json:"issuer"`
MinPasswordLength int `json:"min-password-length"`
Copy link
Collaborator

@maraino maraino Mar 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably want omitempty and use provisioner instead of issuer

Provisioner string `json:"provisioner,omitempty"`

RedirectURL should also have an omitempty

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the response, so it can be ok here.

Comment on lines 92 to 94
Redirect string `json:"redirect-url"`
Issuer string `json:"issuer,omitempty"`
MinPasswordLength int `json:"min-password-length,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Omit empty on redirect-url and Provisioner instead of issuer.

- FirstStringOf returns value of first defined flag in input list

// Filter by issuer (provisioner name)
if issuer := ctx.String("issuer"); issuer != "" {
if issuer := flags.FirstStringOf(ctx, "issuer", "provisioner"); issuer != "" {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here and above, I would preffer "provisioner", "issuer"

maraino
maraino previously approved these changes Mar 4, 2025
Copy link
Collaborator

@maraino maraino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, ideally the api should set provisioner too, but ...

Comment on lines 297 to 340
/*
{
name: "negative",
minLength: -5,
promptRun: promptRunner([]string{"foobar"}, nil),
want: "foobar",
wantErr: false,
},
{
name: "zero",
minLength: 0,
promptRun: promptRunner([]string{"foobar"}, nil),
want: "foobar",
wantErr: false,
},
{
name: "greater-than-min-length",
minLength: 5,
promptRun: promptRunner([]string{"foobar"}, nil),
want: "foobar",
wantErr: false,
},
{
name: "equal-min-length",
minLength: 6,
promptRun: promptRunner([]string{"foobar"}, nil),
want: "foobar",
wantErr: false,
},
{
name: "less-than-min-length",
minLength: 8,
promptRun: promptRunner([]string{"pass", "foobar", "password"}, nil),
want: "password",
wantErr: false,
},
{
name: "ignore-post-whitespace-characters",
minLength: 7,
promptRun: promptRunner([]string{"pass ", "foobar ", "password "}, nil),
want: "password",
wantErr: false,
},
*/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you uncomment or remove these tests?

Comment on lines 31 to 32
Provisioner string `json:"provisioner,omitempty"`
MinPasswordLength int `json:"min-password-length,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, but on responses omitempty is not necessary

@dopey dopey requested a review from maraino March 4, 2025 06:57
Copy link
Collaborator

@maraino maraino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@dopey dopey merged commit c957358 into master Mar 4, 2025
13 of 15 checks passed
@dopey dopey deleted the max/provisioner-password branch March 4, 2025 16:58
@hslatman hslatman added this to the v0.28.4 milestone Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs triage Waiting for discussion / prioritization by team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants