fix: do not allow operator token from being deleted (#26418)#26420
fix: do not allow operator token from being deleted (#26418)#26420praveen-influx merged 1 commit into3.0from
Conversation
* fix: do not allow operator token from being deleted closes: influxdata/influxdb_pro#819 * refactor: address PR feedback * fix: add a word and clarifying colon * fix: failing test --------- Co-authored-by: Peter Barnett <peter.barnett03@gmail.com> commit hash in main: b404e84
hiltontj
left a comment
There was a problem hiding this comment.
I think it is worth having this released in a 3.0.3:
- it prevents someone from cutting themselves
- keeps core/enterprise at the same version
| if token_name == "_admin" { | ||
| println!( | ||
| "The operator token \"_admin\" is required and cannot be deleted. To regenerate an operator token, use: influxdb3 create token --admin --regenerate --token [TOKEN]" | ||
| ); |
There was a problem hiding this comment.
@praveen-influx - the spec does not say whether the 'name' of a token is immutable or mutable. I recall thinking that since the actual operations under the hood would be on the immutable 'id', then names would be mutable.
If names are immutable, this if token_name == "_admin" is ok. If they are not, or we plan to change them in the future, this could be a problem. If they are (or we want them to become) mutable, we should:
- not allow the operator token (named
_admin) to be renamed - not allow duplicate token names (do we already enforce this?)
There was a problem hiding this comment.
not allow duplicate token names (do we already enforce this?)
Yes this is enforced.
There was a problem hiding this comment.
If they are (or we want them to become) mutable, we should:
- not allow the operator token (named _admin) to be renamed
When we allow changing the token names (i.e update feature issue), operator token will not be mutable
- not allow duplicate token names (do we already enforce this?)
This is already enforced in the model (names are unique)
closes: https://github.com/influxdata/influxdb_pro/issues/819
refactor: address PR feedback
fix: add a word and clarifying colon
fix: failing test
Co-authored-by: Peter Barnett peter.barnett03@gmail.com
commit hash in main: b404e84