Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional token patch fields #53

Merged
merged 2 commits into from
Feb 23, 2022
Merged

Additional token patch fields #53

merged 2 commits into from
Feb 23, 2022

Conversation

paulcjh
Copy link
Member

@paulcjh paulcjh commented Feb 23, 2022

No description provided.

@paulcjh paulcjh requested a review from a team as a code owner February 23, 2022 13:23
Copy link
Contributor

@isNeil isNeil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@paulcjh paulcjh merged commit f822fbe into main Feb 23, 2022
@paulcjh paulcjh deleted the paul/token-patch branch February 23, 2022 14:10
# Token value (only sudo tokens can use this)
token: Optional[str]
# Datetime to expire the token
expire_at: Optional[datetime]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@plutopulp and I had a chat about this and concluded that letting this field be patched defeats the purpose of having it. If a token has an expiry date but gets leaked the attacker can just set the expiry date to far in the future using the leaked token.

GitHub provides a feature to create a new token with an identical feature set but with a new expiry and value. Going down that route feels nicer to me.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do all tokens have the same permissions for users?
A reasonable use case here would be if someone needs to extend a production token expiry date.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also it's possible that the expire_at field can only be set by dashboard token

@@ -40,6 +40,10 @@ class TokenPatch(Patchable):
name: Optional[str]
# Boolean specifying if token can be used
is_enabled: Optional[bool]
# Token value (only sudo tokens can use this)
token: Optional[str]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have a corresponding pipeline-top PR for this? What's the use case here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

APIv1 migration

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to be able to set user's tokens to what they were in APIv1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants