fix: revoke api tokens and mcp oauth grants on leave_instance (#12430)

* fix: revoke api tokens and mcp oauth grants on leave_instance

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test: pin token deletion on leave_instance

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ruben Fiszel
2026-11-13 19:04:49 +01:00
committed by GitHub
co-authored by Claude Opus 5.5
parent 495e4435db
commit 2c39bf044a
4 changed files with 61 additions and 13 deletions
+4
View File
@@ -1315,6 +1315,10 @@ async fn join_workspace<'c>(
async fn leave_instance(Extension(db): Extension<DB>, authed: ApiAuthed) -> Result<String> {
forbid_job_token_account_destruction(&authed)?;
let mut tx = db.begin().await?;
revoke_mcp_oauth_grants(&mut *tx, &authed.email, None).await?;
sqlx::query!("DELETE FROM token WHERE email = $1", &authed.email)
.execute(&mut *tx)
.await?;
sqlx::query!("DELETE FROM password WHERE email = $1", &authed.email)
.execute(&mut *tx)
.await?;