Skip to content

Commit cc275ce

Browse files
committed
fix: defer frontend allowlist validation until runtime
1 parent 224ed8c commit cc275ce

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

  • frontend/web/src/app/api/auth/[...nextauth]

frontend/web/src/app/api/auth/[...nextauth]/route.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ const getAllowedUsers = (): Set<string> => {
1515
return users;
1616
};
1717

18-
const allowedUsers = getAllowedUsers();
19-
2018
type GoogleJWT = JWT & {
2119
accessToken?: string;
2220
refreshToken?: string;
@@ -143,6 +141,14 @@ export const authOptions: NextAuthOptions = {
143141
callbacks: {
144142
async signIn({ user }): Promise<boolean> {
145143
const userEmail = user.email;
144+
let allowedUsers: Set<string>;
145+
146+
try {
147+
allowedUsers = getAllowedUsers();
148+
} catch (error) {
149+
console.error("NextAuth allowlist configuration error", error);
150+
return false;
151+
}
146152

147153
// Check if user is in allowlist
148154
if (userEmail && allowedUsers.has(userEmail)) {

0 commit comments

Comments
 (0)