🚨 Additional Reproduction Setup Details: Click to Expand
>K3s install command for node one. Replace values in <>
```shell
curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION= sh -s - server --token=SECRET --datastore-endpoint= --tls-san --node-external-ip
```
>K3s install command for node two. Replace values in <>. Main difference here is the --token
```shell
curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION= sh -s - server --token= --datastore-endpoint= --tls-san --node-external-ip
```
Describe the bug
Editing the ttl of a token with kubectl and there is no validation between ttl and the expiresAt field
To Reproduce
Starting from the default Rancher homepage /dashboard/home
Click at top right of screen user icon >> Account & API Keys >> Create API Key
Fill out the API Key: Create form
Description >> TEST_TOKEN
Scope >> No Scope
Automatically expire >> Never
Using kubectl against the local cluster run these commands
kubectl get tokens
From the list notice the token you just created, now run
kubectl edit token $token_name
NOTE: When editing the token the expiresAt field is set to an empty string ""
Change the ttl from 0 >> to ttl: 600000
600000 milliseconds >> 10 minutes
Save/apply the changes to ttl
Edit the token again with kubectl edit token $token_name
Now observe the expiresAt field is set to
"2022-12-08T20:19:52Z"
Which is 10 minutes past the `creationTimestamp:
"2022-12-08T20:09:52Z"
Edit the token again with kubectl edit token $token_name
Change the ttl from 600000 to 1200000 (20 minutes)
Save these changes and check the token with kubectl describe token $token_name
Even though the ttl has changed from 600000 to 1200000 the expiresAt field has remained as: "2022-12-08T20:19:52Z"
Result
The expiresAt field only changes once, when going from a token with a ttl of 0 to any other ttl value
The token remains valid for the newly updated 1200000 even though in the UI it will show as expired
Even though the token displays as expired in the UI, you are still able to use it to make API calls to rancher via Postman until the actual stated ttl time is up
Expected Result
For there to be some validation against expiresAt field and ttl so the UI can display accurate information on when a token will actually expire
Rancher Server Setup
traefik
🚨 Additional Reproduction Setup Details: Click to Expand
>K3s install command for node one. Replace values in <> ```shell curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=Describe the bug
Editing the ttl of a token with kubectl and there is no validation between ttl and the expiresAt field
To Reproduce
/dashboard/home
user icon
>>Account & API Keys
>>Create API Key
API Key: Create
formTEST_TOKEN
No Scope
Never
kubectl get tokens
kubectl edit token $token_name
NOTE
: When editing the token theexpiresAt
field is set to an empty string""
ttl
from0
>> tottl: 600000
600000
milliseconds >> 10 minuteskubectl edit token $token_name
expiresAt
field is set to"2022-12-08T20:19:52Z"
"2022-12-08T20:09:52Z"
kubectl edit token $token_name
ttl
from600000
to1200000
(20 minutes)kubectl describe token $token_name
600000
to1200000
the expiresAt field has remained as:"2022-12-08T20:19:52Z"
Result
expiresAt
field only changes once, when going from a token with a ttl of0
to any other ttl value1200000
even though in the UI it will show as expiredExpected Result
For there to be some validation against
expiresAt
field andttl
so the UI can display accurate information on when a token will actually expireAdditional Info
Noticed while doing validations against: https://github.com/rancher/rancher/issues/39107