`acl token update` wipes some token properties
- Dominant language
- Go
- Stars
- 30.1k
- Forks
- 4.6k
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 39
Description
#### Overview of the Issue
This could be documented and I'm just not seeing it, but when you `update` a consul ACL token - ie to set a description - it wipes out the other properties of the token such as the attached policies.
This behavior was tested against and appears in at least consul 1.9.3 and 1.10.0.
#### Reproduction Steps
Steps to reproduce this issue, eg:
1. Create an ACL token, give it a policy
1. Update the token's description, ie with Diplomat or cURL
1. The token has a new description, but the policy attached in step 1 is gone.
Before `update`:
```
$ curl -H 'X-Consul-Token: ...' http://127.20.20.45:8500/v1/acl/token/759d688f | jq
{
"AccessorID": "759d688f",
"SecretID": "5a1fe0b2",
"Description": "goodbye cruel world",
"Policies": [
{
"ID": "189efd36",
"Name": "agent-policy"
}
],
"Local": false,
"CreateTime": "2021-07-09T02:32:15.926078318Z",
"Hash": "6PhxfpT/+fM...kusBQDg=",
"CreateIndex": 430850,
"ModifyIndex": 433240
}
```
Update the token description:
```
$ curl -X PUT -H 'X-Consul-Token: ...' -d '{"description":"your description goes here"}' http://127.20.20.45:8500/v1/acl/token/759d688f | jq
[output truncated]
```
Verify updated description, but policy is missing:
```
$ curl -H 'X-Consul-Token: ...' http://127.20.20.45:8500/v1/acl/token/759d688f | jq
{
"AccessorID": "759d688f",
"SecretID": "5a1fe0b2",
"Description": "your description goes here",
"Local": false,
"CreateTime": "2021-07-09T02:32:15.926078318Z",
"Hash": "zF/y/vmUVm2q...hZ+VwE8Nwllc=",
"CreateIndex": 430850,
"ModifyIndex": 433248
}
```
From what I can tell, `clone` may allow you to update the description, but now you've got a new token, and an old orphaned token - when all you needed was to update the human-readable description?
### Operating system and Environment details
CentOS Linux release 7.9.2009 (Core), x86_64
Contributor guide
Research direction
Start with the ACL token update endpoint shown in the curl reproduction, comparing the token response before and after changing only its description. Confirm that the update preserves attached policies and other existing properties, and add or run coverage for the documented reproduction if the repository contains matching tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api, authorization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100