diff --git a/apps/open-swe/src/security/github-auth.ts b/apps/open-swe/src/security/github-auth.ts index 6025eda1..db80f454 100644 --- a/apps/open-swe/src/security/github-auth.ts +++ b/apps/open-swe/src/security/github-auth.ts @@ -7,10 +7,9 @@ const logger = createLogger(LogLevel.INFO, "GithubAuth"); export type GithubUser = Endpoints["GET /user"]["response"]["data"]; /** - * Verifies a GitHub user access token and checks for membership in the 'langchain-ai' organization. - * + * Verifies a GitHub user access token. * @param accessToken The GitHub user access token. - * @returns A promise that resolves with the user object if valid and a member, otherwise undefined. + * @returns A promise that resolves with the user object if valid, otherwise undefined. */ export async function verifyGithubUser( accessToken: string, @@ -22,7 +21,6 @@ export async function verifyGithubUser( try { const octokit = new Octokit({ auth: accessToken }); - // 1. Fetch user information to validate the token const { data: user } = await octokit.users.getAuthenticated(); if (!user || !user.login) { @@ -32,23 +30,6 @@ export async function verifyGithubUser( return undefined; } - const username = user.login; - - // 2. List organizations for the user - const { data: orgs } = await octokit.orgs.listForUser({ - username, - }); - - // 3. Check for 'langchain-ai' organization membership - const isMember = orgs.some((org) => org.login === "langchain-ai"); - - if (!isMember) { - logger.info( - `User ${username} is not a member of the 'langchain-ai' organization.`, - ); - return undefined; - } - return user; } catch (error) { logger.error("An error occurred during GitHub user verification:", error);