Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

🔒️ Move rate limit middleware to the front

Luke Vella782ed12f3e64
diff --git a/apps/web/src/app/api/licensing/v1/[...route]/route.ts b/apps/web/src/app/api/licensing/v1/[...route]/route.ts
index da802ae30..27de96e2b 100644
--- a/apps/web/src/app/api/licensing/v1/[...route]/route.ts
+++ b/apps/web/src/app/api/licensing/v1/[...route]/route.ts
@@ -31,7 +31,6 @@ app.use("*", async (c, next) => {
if (env.LICENSE_API_AUTH_TOKEN) {
app.post(
"/licenses",
- zValidator("json", createLicenseInputSchema),
rateLimiter({
windowMs: 60 * 60 * 1000,
limit: 10,
@@ -41,6 +40,7 @@ if (env.LICENSE_API_AUTH_TOKEN) {
})
: undefined,
}),
+ zValidator("json", createLicenseInputSchema),
bearerAuth({ token: env.LICENSE_API_AUTH_TOKEN }),
async (c) => {
const { type, seats, expiresAt, licenseeEmail, licenseeName, version } =
@@ -72,7 +72,6 @@ if (env.LICENSE_API_AUTH_TOKEN) {
app.post(
"/licenses/actions/validate-key",
- zValidator("json", validateLicenseKeyInputSchema),
rateLimiter({
keyGenerator: async (c) => {
const { key, fingerprint } = await c.req.json();
@@ -86,6 +85,7 @@ app.post(
})
: undefined,
}),
+ zValidator("json", validateLicenseKeyInputSchema),
async (c) => {
const { key, fingerprint } = c.req.valid("json");