mirror of
https://github.com/outline/outline.git
synced 2026-11-21 21:44:30 +03:00
fix: Require GitHub account ownership when connecting an installation (#14323)
This commit is contained in:
1 parent
b0b307259a
commit
71af4d6901
6 files changed
+304
-15
No files matched your search
@@ -15,7 +15,7 @@ import { verifyOAuthStateNonce } from "@server/utils/oauth";
|
||||
import { RequestHelper } from "@server/utils/RequestHelper";
|
||||
import { GitHubOAuthNonceCookie, GitHubUtils } from "../../shared/GitHubUtils";
|
||||
import env from "../env";
|
||||
import { GitHub } from "../github";
|
||||
import { GitHub, InstallationAccess } from "../github";
|
||||
import GitHubWebhookTask from "../tasks/GitHubWebhookTask";
|
||||
import * as T from "./schema";
|
||||
|
||||
@@ -75,6 +75,11 @@ router.get(
|
||||
return ctx.redirect(GitHubUtils.errorUrl("unauthenticated"));
|
||||
}
|
||||
|
||||
const access = await GitHub.canManageInstallation(client, installation);
|
||||
if (access !== InstallationAccess.Allowed) {
|
||||
return ctx.redirect(GitHubUtils.errorUrl(access));
|
||||
}
|
||||
|
||||
const scopes = Object.entries(installation.permissions).map(
|
||||
([name, permission]) => `${name}:${String(permission)}`
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user