Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 8e02e09

Browse files
geroplona-agent
andauthored
[CLC-2041] Block signups for Classic PAYG sunset (#21114)
Block new user signups when Classic PAYG sunset is enabled: - Add isUserSignupBlockedBySunset() function in featureflags.ts - Checks if sunset is enabled for the installation - Exempts dedicated installations - Blocks all signups (new users don't have orgs/roles yet) - Add signup blocking in generic-auth-provider.ts callback - Check before createNewUser() is called - Redirect blocked signups to https://app.ona.com/login - Log blocked signup attempts This complements the existing login and workspace operation blocks from CLC-2032, closing the signup path that was previously unblocked. Co-authored-by: Ona <no-reply@ona.com>
1 parent 7421edc commit 8e02e09

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

‎components/server/src/auth/generic-auth-provider.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import { SignInJWT } from "./jwt";
3737
import { UserService } from "../user/user-service";
3838
import { reportLoginCompleted } from "../prometheus-metrics";
3939
import { TrustedValue } from "@gitpod/gitpod-protocol/lib/util/scrubbing";
40+
import { isUserSignupBlockedBySunset } from "../util/featureflags";
4041

4142
/**
4243
* This is a generic implementation of OAuth2-based AuthProvider.
@@ -431,6 +432,13 @@ export abstract class GenericAuthProvider implements AuthProvider {
431432
};
432433

433434
if (VerifyResult.WithIdentity.is(flowContext)) {
435+
// Check if signup is blocked by Classic PAYG sunset
436+
if (await isUserSignupBlockedBySunset("anonymous", this.config.isDedicatedInstallation)) {
437+
log.info(context, `(${strategyName}) Signup blocked by Classic PAYG sunset`, logPayload);
438+
response.redirect(302, "https://app.ona.com/login");
439+
return;
440+
}
441+
434442
log.info(context, `(${strategyName}) Creating new user and completing login.`, logPayload);
435443
// There is no current session, we need to create a new user because this
436444
// identity does not yet exist.

‎components/server/src/util/featureflags.ts‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,19 @@ export async function isUserLoginBlockedBySunset(user: User, isDedicatedInstalla
8585
// Installation-owned users (no organizationId) are blocked
8686
return true;
8787
}
88+
89+
export async function isUserSignupBlockedBySunset(userId: string, isDedicatedInstallation: boolean): Promise<boolean> {
90+
// Dedicated installations are never blocked
91+
if (isDedicatedInstallation) {
92+
return false;
93+
}
94+
95+
const config = await getClassicPaygSunsetConfig(userId);
96+
97+
if (!config.enabled) {
98+
return false;
99+
}
100+
101+
// New users don't have roles/permissions or organizations yet, so we block all signups
102+
return true;
103+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /