Skip to content

Commit

Permalink
[server] move getToken api to separate group (#20391)
Browse files Browse the repository at this point in the history
  • Loading branch information
iQQBot authored Nov 27, 2024
1 parent 8566114 commit 490f507
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions components/server/src/auth/rate-limiter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type GitpodServerMethodType =
| keyof Omit<GitpodServer, "dispose" | "setClient">
| typeof accessCodeSyncStorage
| typeof accessHeadlessLogs;
type GroupKey = "default" | "startWorkspace" | "createWorkspace" | "phoneVerification" | "sendHeartBeat";
type GroupKey = "default" | "startWorkspace" | "createWorkspace" | "phoneVerification" | "sendHeartBeat" | "getToken";
type GroupsConfig = {
[key: string]: {
points: number;
Expand Down Expand Up @@ -57,7 +57,7 @@ const defaultFunctions: FunctionsConfig = {
deleteOrgAuthProvider: { group: "default", points: 1 },
getConfiguration: { group: "default", points: 1 },
getGitpodTokenScopes: { group: "default", points: 1 },
getToken: { group: "default", points: 1 },
getToken: { group: "getToken", points: 1 },
deleteAccount: { group: "default", points: 1 },
getClientRegion: { group: "default", points: 1 },
getWorkspaces: { group: "default", points: 1 },
Expand Down Expand Up @@ -207,6 +207,10 @@ function getConfig(config: RateLimiterConfig): RateLimiterConfig {
points: 200, // 200 calls per user, per connection, per minute
durationsSec: 60,
},
getToken: {
points: 200, // 200 calls per user, per connection, per minute
durationsSec: 60,
},
startWorkspace: {
points: 3, // 3 workspace starts per user per 10s
durationsSec: 10,
Expand Down

0 comments on commit 490f507

Please sign in to comment.