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

Fix token storage bug #535

Merged
merged 3 commits into from
Feb 19, 2024
Merged

Fix token storage bug #535

merged 3 commits into from
Feb 19, 2024

Conversation

hasan7n
Copy link
Contributor

@hasan7n hasan7n commented Feb 18, 2024

  • Drops the usage of os.open and uses the built-in open for storing the tokens. It creates an empty file first, changes its permissions, then appends the token.

This PR also Forces logout for authenticated users who try to login again (to prevent refresh token count build up; to not lose track of active refresh tokens without revoking them). This is not related to the storage bug, but it is better to be implemented.

@hasan7n hasan7n requested a review from a team as a code owner February 18, 2024 02:26
Copy link
Contributor

github-actions bot commented Feb 18, 2024

MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅

@hasan7n hasan7n requested a review from VukW February 18, 2024 12:25
VukW
VukW previously approved these changes Feb 19, 2024
Copy link
Contributor

@VukW VukW left a comment

Choose a reason for hiding this comment

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

LGTM, concise and pretty solution

Right now setting tokens looks not so atomic, but in reality any solution of writing data to the file is never totally atomic. So, instead of bothering about protection there it would be much better to ensure that we read token safely & can rewrite tokens successfully if anything is broken with them (if file is empty, not exists, token is broken, you name it)

@VukW VukW merged commit 02208ec into mlcommons:main Feb 19, 2024
6 of 7 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Feb 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants