Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(security): rate-limit invitation route prefix

Alfredo Lopez7e5f256899d4
diff --git a/control-api/package-lock.json b/control-api/package-lock.json
index 135a06e4f..d6369407a 100644
--- a/control-api/package-lock.json
+++ b/control-api/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-api",
- "version": "0.1.450",
+ "version": "0.1.451",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-api",
- "version": "0.1.450",
+ "version": "0.1.451",
"dependencies": {
"@clerum/display-field": "file:../packages/display-field",
"@clerum/image-policy": "file:../packages/image-policy",
diff --git a/control-api/package.json b/control-api/package.json
index 4e55b4f60..a9613931e 100644
--- a/control-api/package.json
+++ b/control-api/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-api",
- "version": "0.1.450",
+ "version": "0.1.451",
"description": "Internal Clerum control plane REST API + UI for managing CRDs and secrets",
"main": "dist/main.js",
"engines": {
diff --git a/control-api/src/routes/external/invitations.ts b/control-api/src/routes/external/invitations.ts
index 2c9284821..a7c6efd07 100644
--- a/control-api/src/routes/external/invitations.ts
+++ b/control-api/src/routes/external/invitations.ts
@@ -40,14 +40,9 @@ export function createExternalInvitationsRouter(): Router {
standardHeaders: 'draft-7',
legacyHeaders: false,
})
- const externalDesktopAuthorizationRateLimit = rateLimit({
- windowMs: 60_000,
- limit: config.approvalRlExternalPerMin,
- standardHeaders: 'draft-7',
- legacyHeaders: false,
- })
-
- router.use('/external/invitations/desktop-authorization', externalDesktopAuthorizationRateLimit)
+ // Keep one edge limiter at the common prefix so every invitation endpoint,
+ // including Desktop authorization, is covered without double-counting.
+ router.use('/external/invitations', externalInvitationsEdgeRateLimit)
router.get(
'/external/invitations/token/:token',
rateLimitMiddleware({
@@ -82,7 +77,6 @@ export function createExternalInvitationsRouter(): Router {
router.post(
'/external/invitations/password-token',
- externalInvitationsEdgeRateLimit,
rateLimitMiddleware({
bucketType: 'external_invitation_password_token',
maxPerMinute: 10,
@@ -171,7 +165,6 @@ export function createExternalInvitationsRouter(): Router {
router.post(
'/external/invitations/password',
- externalInvitationsEdgeRateLimit,
requireValidExternalSessionToken,
rejectBodyUserTeamMismatch,
async (req, res, next) => {