Skip to content

Commit cddd8d7

Browse files
authored
Revert "chore: Rate limit top level of public booking pages (calcom#25055)" (calcom#25086)
This reverts commit e239b67.
1 parent 1d6959c commit cddd8d7

4 files changed

Lines changed: 2 additions & 37 deletions

File tree

apps/web/lib/org/[orgSlug]/[user]/[type]/getServerSideProps.tsx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ import type { GetServerSidePropsContext } from "next";
22
import z from "zod";
33

44
import { getSlugOrRequestedSlug } from "@calcom/features/ee/organizations/lib/orgDomains";
5-
import { checkRateLimitAndThrowError } from "@calcom/lib/checkRateLimitAndThrowError";
6-
import getIP from "@calcom/lib/getIP";
7-
import { piiHasher } from "@calcom/lib/server/PiiHasher";
85
import slugify from "@calcom/lib/slugify";
96
import prisma from "@calcom/prisma";
107

@@ -19,12 +16,6 @@ const paramsSchema = z.object({
1916
});
2017

2118
export const getServerSideProps = async (ctx: GetServerSidePropsContext) => {
22-
const requestorIp = getIP(ctx.req as unknown as Request);
23-
await checkRateLimitAndThrowError({
24-
rateLimitingType: "core",
25-
identifier: `[orgSlug]/[user]/[type]-${piiHasher.hash(requestorIp)}`,
26-
});
27-
2819
const { user: teamOrUserSlugOrDynamicGroup, orgSlug, type } = paramsSchema.parse(ctx.params);
2920
const team = await prisma.team.findFirst({
3021
where: {

apps/web/lib/team/[slug]/[type]/getServerSideProps.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@ import { getOrganizationSEOSettings } from "@calcom/features/ee/organizations/li
99
import { FeaturesRepository } from "@calcom/features/flags/features.repository";
1010
import { getBrandingForEventType } from "@calcom/features/profile/lib/getBranding";
1111
import { shouldHideBrandingForTeamEvent } from "@calcom/features/profile/lib/hideBranding";
12-
import { checkRateLimitAndThrowError } from "@calcom/lib/checkRateLimitAndThrowError";
1312
import { getPlaceholderAvatar } from "@calcom/lib/defaultAvatarImage";
14-
import getIP from "@calcom/lib/getIP";
15-
import { piiHasher } from "@calcom/lib/server/PiiHasher";
1613
import slugify from "@calcom/lib/slugify";
1714
import { prisma } from "@calcom/prisma";
1815
import type { User } from "@calcom/prisma/client";
@@ -31,11 +28,6 @@ function hasApiV2RouteInEnv() {
3128
}
3229

3330
export const getServerSideProps = async (context: GetServerSidePropsContext) => {
34-
const requestorIp = getIP(context.req as unknown as Request);
35-
await checkRateLimitAndThrowError({
36-
rateLimitingType: "core",
37-
identifier: `team/[slug]/[type]-${piiHasher.hash(requestorIp)}`,
38-
});
3931
const { req, params, query } = context;
4032
const session = await getServerSession({ req });
4133
const { slug: teamSlug, type: meetingSlug } = paramsSchema.parse(params);

apps/web/server/lib/[user]/[type]/getServerSideProps.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ import type { getPublicEvent } from "@calcom/features/eventtypes/lib/getPublicEv
1111
import { EventRepository } from "@calcom/features/eventtypes/repositories/EventRepository";
1212
import { shouldHideBrandingForUserEvent } from "@calcom/features/profile/lib/hideBranding";
1313
import { UserRepository } from "@calcom/features/users/repositories/UserRepository";
14-
import { checkRateLimitAndThrowError } from "@calcom/lib/checkRateLimitAndThrowError";
15-
import getIP from "@calcom/lib/getIP";
16-
import { piiHasher } from "@calcom/lib/server/PiiHasher";
1714
import slugify from "@calcom/lib/slugify";
1815
import { prisma } from "@calcom/prisma";
1916
import { BookingStatus, RedirectType } from "@calcom/prisma/enums";
@@ -66,7 +63,6 @@ async function processReschedule({
6663
(booking?.eventTypeId === props.eventData?.id &&
6764
(booking.status !== BookingStatus.CANCELLED ||
6865
allowRescheduleForCancelledBooking ||
69-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
7066
!!(props.eventData as any)?.allowReschedulingCancelledBookings))
7167
) {
7268
props.booking = booking;
@@ -318,12 +314,6 @@ const paramsSchema = z.object({
318314
// Booker page fetches a tiny bit of data server side, to determine early
319315
// whether the page should show an away state or dynamic booking not allowed.
320316
export const getServerSideProps = async (context: GetServerSidePropsContext) => {
321-
const requestorIp = getIP(context.req as unknown as Request);
322-
await checkRateLimitAndThrowError({
323-
rateLimitingType: "core",
324-
identifier: `[user]/[type]-${piiHasher.hash(requestorIp)}`,
325-
});
326-
327317
const { user } = paramsSchema.parse(context.params);
328318
const isDynamicGroup = user.length > 1;
329319

apps/web/server/lib/[user]/getServerSideProps.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,11 @@ import { getUsernameList } from "@calcom/features/eventtypes/lib/defaultEvents";
88
import { getEventTypesPublic } from "@calcom/features/eventtypes/lib/getEventTypesPublic";
99
import { getBrandingForUser } from "@calcom/features/profile/lib/getBranding";
1010
import { UserRepository } from "@calcom/features/users/repositories/UserRepository";
11-
import { checkRateLimitAndThrowError } from "@calcom/lib/checkRateLimitAndThrowError";
1211
import { DEFAULT_DARK_BRAND_COLOR, DEFAULT_LIGHT_BRAND_COLOR } from "@calcom/lib/constants";
1312
import { getUserAvatarUrl } from "@calcom/lib/getAvatarUrl";
14-
import getIP from "@calcom/lib/getIP";
1513
import logger from "@calcom/lib/logger";
1614
import { markdownToSafeHTML } from "@calcom/lib/markdownToSafeHTML";
1715
import { safeStringify } from "@calcom/lib/safeStringify";
18-
import { piiHasher } from "@calcom/lib/server/PiiHasher";
1916
import { stripMarkdown } from "@calcom/lib/stripMarkdown";
2017
import { prisma } from "@calcom/prisma";
2118
import type { EventType, User } from "@calcom/prisma/client";
@@ -82,12 +79,6 @@ type UserPageProps = {
8279
} & EmbedProps;
8380

8481
export const getServerSideProps: GetServerSideProps<UserPageProps> = async (context) => {
85-
// handle IP based rate limiting
86-
const requestorIp = getIP(context.req as unknown as Request);
87-
await checkRateLimitAndThrowError({
88-
rateLimitingType: "core",
89-
identifier: `[user]-${piiHasher.hash(requestorIp)}`,
90-
});
9182
const { currentOrgDomain, isValidOrgDomain } = orgDomainConfig(context.req, context.params?.orgSlug);
9283
const usernameList = getUsernameList(context.query.user as string);
9384
const isARedirectFromNonOrgLink = context.query.orgRedirection === "true";
@@ -153,7 +144,8 @@ export const getServerSideProps: GetServerSideProps<UserPageProps> = async (cont
153144
theme: branding.theme,
154145
brandColor: branding.brandColor ?? DEFAULT_LIGHT_BRAND_COLOR,
155146
avatarUrl: user.avatarUrl,
156-
darkBrandColor: branding.darkBrandColor ?? DEFAULT_DARK_BRAND_COLOR,
147+
darkBrandColor:
148+
branding.darkBrandColor ?? DEFAULT_DARK_BRAND_COLOR,
157149
allowSEOIndexing: user.allowSEOIndexing ?? true,
158150
username: user.username,
159151
organization: user.profile.organization,

0 commit comments

Comments
 (0)