hide token secret in personal access token read endpoints#4826
Open
saddamr3e wants to merge 2 commits into
Open
hide token secret in personal access token read endpoints#4826saddamr3e wants to merge 2 commits into
saddamr3e wants to merge 2 commits into
Conversation
Signed-off-by: saddamr3e <saddamr3e@gmail.com>
|
makes sense, tokens should only be visible on creation. one thing — the variable is named |
Signed-off-by: saddamr3e <saddamr3e@gmail.com>
Contributor
Author
|
Good catch, renamed it to personalAccessTokens. Pushed. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4826 +/- ##
==========================================
- Coverage 28.08% 28.07% -0.01%
==========================================
Files 232 232
Lines 23153 23159 +6
==========================================
Hits 6502 6502
- Misses 16211 16217 +6
Partials 440 440
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The personal access token read endpoints return the full
models.PersonalAccessToken, and itsTokenfield is taggedjson:"token", so the secret bearer value is serialized in the response.GetPersonalAccessToken(GET /api/v1/personal-access-tokens/{id}) andGetPersonalAccessTokens(GET /api/v1/personal-access-tokens) both marshal the stored token value.readon all API objects, so any low-privilege user can list these endpoints and read the secret token of every user, then reuse those tokens (job/cluster scopes) to act as the owner.Cleared the
Tokenfield in both read service methods. The token stays write-once, returned only by the create response.Related Issue
None filed; reporting the fix directly.
Motivation and Context
A token is a credential. Read paths reachable by guest-level users should expose token metadata (name, scopes, state, owner) but never the secret value itself.
Screenshots (if appropriate)
Types of changes
Checklist