Skip to content

Commit

Permalink
cli: remove default for ACL token type on update (#18689)
Browse files Browse the repository at this point in the history
With a default value set to `client`, the `nomad acl token update`
command can silently downgrade a management token to client on update if
the command does not specify `-type=management` on every update.
  • Loading branch information
lgfa29 committed Oct 10, 2023
1 parent 9c2ecbf commit ef68143
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .changelog/18689.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
cli: Fixed an unexpected behavior of the `nomad acl token update` command that could cause a management token to be downgraded to client on update
```
4 changes: 2 additions & 2 deletions command/acl_token_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Update Options:
Sets the human readable name for the ACL token.
-type="client"
Sets the type of token. Must be one of "client" (default), or "management".
Sets the type of token. Must be one of "client" or "management".
-global=false
Toggles the global mode of the token. Global tokens are replicated to all regions.
Expand Down Expand Up @@ -70,7 +70,7 @@ func (c *ACLTokenUpdateCommand) Run(args []string) int {
flags := c.Meta.FlagSet(c.Name(), FlagSetClient)
flags.Usage = func() { c.Ui.Output(c.Help()) }
flags.StringVar(&name, "name", "", "")
flags.StringVar(&tokenType, "type", "client", "")
flags.StringVar(&tokenType, "type", "", "")
flags.BoolVar(&global, "global", false, "")
flags.Var((funcVar)(func(s string) error {
policies = append(policies, s)
Expand Down
3 changes: 1 addition & 2 deletions website/content/docs/commands/acl/token/update.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ The `acl token update` command requires an existing token's accessor ID.

- `-name`: Sets the human readable name for the ACL token.

- `-type`: Sets the type of token. Must be one of "client" (default), or
"management".
- `-type`: Sets the type of token. Must be one of "client" or "management".

- `-global`: Toggles the global mode of the token. Global tokens are replicated
to all regions. Defaults false.
Expand Down

0 comments on commit ef68143

Please sign in to comment.