Skip to content

Commit 0a14758

Browse files
committed
LImit oauth entry with FF
1 parent cfa7a1c commit 0a14758

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

components/server/src/oauth-server/db.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,5 @@ for (const clientId in inMemoryDatabase.clients) {
179179
inMemoryDatabase.scopes[scope.name] = scope;
180180
}
181181
}
182+
183+
export const toolboxClient = toolbox;

components/server/src/oauth-server/oauth-controller.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ import { inject, injectable } from "inversify";
1515
import { URL } from "url";
1616
import { Config } from "../config";
1717
import { clientRepository, createAuthorizationServer } from "./oauth-authorization-server";
18-
import { inMemoryDatabase } from "./db";
18+
import { inMemoryDatabase, toolboxClient } from "./db";
19+
import { getExperimentsClientForBackend } from "@gitpod/gitpod-protocol/lib/experiments/configcat-server";
1920

2021
@injectable()
2122
export class OAuthController {
@@ -147,6 +148,18 @@ export class OAuthController {
147148
return;
148149
}
149150

151+
if (clientID === toolboxClient.id) {
152+
const enableExperimentalJBTB = await getExperimentsClientForBackend().getValueAsync(
153+
"enable_experimental_jbtb",
154+
false,
155+
{ user },
156+
);
157+
if (!enableExperimentalJBTB) {
158+
res.sendStatus(400);
159+
return false;
160+
}
161+
}
162+
150163
const request = new OAuthRequest(req);
151164

152165
try {

0 commit comments

Comments
 (0)