mirror of
https://github.com/outline/outline.git
synced 2026-11-28 00:09:58 +03:00
* fix: Apply MCP preference to dynamically registered OAuth clients Dynamically registered clients exist only to serve MCP, but the preference was only consulted at registration time. They are now unreadable once the preference is off, and their outstanding grants are revoked at the point it changes. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix: Keep default retry options on revocation task Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * refactor: Rename MCPDisabledProcessor to TeamUpdatedProcessor Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
51 lines
1.2 KiB
TypeScript
51 lines
1.2 KiB
TypeScript
import Logger from "@server/logging/Logger";
|
|
import {
|
|
OAuthAuthentication,
|
|
OAuthAuthorizationCode,
|
|
OAuthClient,
|
|
} from "@server/models";
|
|
import { sequelize } from "@server/storage/database";
|
|
import { BaseTask } from "./base/BaseTask";
|
|
|
|
type Props = {
|
|
teamId: string;
|
|
};
|
|
|
|
/**
|
|
* Task to revoke the outstanding authorization codes and access tokens held by
|
|
* dynamically registered OAuth clients in a team.
|
|
*/
|
|
export default class RevokeDynamicOAuthClientsTask extends BaseTask<Props> {
|
|
public async perform({ teamId }: Props) {
|
|
const clients = await OAuthClient.findAll({
|
|
attributes: ["id"],
|
|
where: {
|
|
teamId,
|
|
createdById: null,
|
|
},
|
|
});
|
|
|
|
if (!clients.length) {
|
|
return;
|
|
}
|
|
|
|
const oauthClientIds = clients.map((client) => client.id);
|
|
|
|
await sequelize.transaction(async (transaction) => {
|
|
await OAuthAuthentication.destroy({
|
|
where: { oauthClientId: oauthClientIds },
|
|
transaction,
|
|
});
|
|
await OAuthAuthorizationCode.destroy({
|
|
where: { oauthClientId: oauthClientIds },
|
|
transaction,
|
|
});
|
|
});
|
|
|
|
Logger.info(
|
|
"task",
|
|
`Revoked access for ${clients.length} dynamic OAuth clients in team ${teamId}`
|
|
);
|
|
}
|
|
}
|