Repository navigation
[WEB-10170] fix: omit the token from API token PATCH - #10302
Conversation
The token value is meant to be visible only in the create response. Respond to PATCH with the read serializer, which excludes it.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
Linked to Plane Work Item(s) This comment was auto-generated by Plane |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
The token value is meant to be visible only in the create response. Respond to PATCH with the read serializer, which excludes it.
The token value is meant to be visible only in the create response. Respond to PATCH with the read serializer, which excludes it. (cherry picked from commit 2cffcce)
Description
PATCH /api/users/api-tokens/<id>/responded withAPITokenSerializer, which includes the secrettoken. The token is meant to be shown once, at creation;GETalready usesAPITokenReadSerializer, which leaves it out.patchnow returnsAPITokenReadSerializer(api_token).data.Behavior change: the PATCH response no longer contains
token, andis_activeis the expiry-derived value the GET endpoints return. No frontend calls this PATCH.Type of Change
Screenshots and Media (if applicable)
Test Scenarios
test_patch_response_excludes_tokeninplane/tests/contract/app/test_api_token.py; the existing create test still asserts POST returns the token. Module: 21 passed.References
Created with Claude Code
Summary by CodeRabbit