Skip to content

fix(coderd): ensure that user API keys are deleted when a user is #7270

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

Merged
merged 1 commit into from
Apr 24, 2023

Conversation

johnstcn
Copy link
Member

Fixes an issue where API tokens belonging to a deleted user were not invalidated:

  • Adds a trigger to delete rows from the api_key stable when the column deleted is set to true in the users table.
  • Adds a trigger to the api_keys table to ensure that new rows may not be added where user_id corresponds to a deleted user.
  • Adds a migration to delete all API keys from deleted users.
  • Adds tests + dbfake implementation for the above.

Fixes an issue where API tokens belonging to a deleted user were
not invalidated:
- Adds a trigger to delete rows from the api_key stable when the
  column deleted is set to true in the users table.
- Adds a trigger to the api_keys table to ensure that new rows
  may not be added where user_id corresponds to a deleted user.
- Adds a migration to delete all API keys from deleted users.
- Adds tests + dbfake implementation for the above.
@johnstcn johnstcn self-assigned this Apr 24, 2023
@johnstcn johnstcn merged commit 8fc8559 into main Apr 24, 2023
@johnstcn johnstcn deleted the cj/invalidate_user_api_token branch April 24, 2023 20:48
@github-actions github-actions bot locked and limited conversation to collaborators Apr 24, 2023
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