PATCH request on a token changes the key value #17279
Labels
severity: medium
Results in substantial degraded or broken functionality for specfic workflows
status: accepted
This issue has been accepted for implementation
type: bug
A confirmed report of unexpected behavior in the application
Deployment Type
Self-hosted
NetBox Version
v4.0.9
Python Version
3.10
Steps to Reproduce
Make an API call like this:
Expected Behavior
Only fields explicitly listed in the PATCH request should be updated.
Observed Behavior
Any PATCH to a token that omits the
key
field will repopulate the key field with a randomly generated default value.This is happening because
users.api.serializers.tokens.TokenSerializer.to_internal_value
is explicitly settingkey
if it is not set in the request body. I'm not sure why this is necessary, as theToken
model is doing essentially the same thing by overridingsave
.The text was updated successfully, but these errors were encountered: