feat(api): add IP ban exemptions (#1448)

This commit is contained in:
Hampus authored and GitHub committed 2026-07-23 18:06:34 +02:00
1 parent 311a1addce
commit fb5fe38d52
12 files changed
+88 -1

No files matched your search

@@ -15,6 +15,7 @@ import {guildIdToRoleId} from '../../../BrandedTypes';
import {Logger} from '../../../Logger';
import type {GuildMember} from '../../../models/GuildMember';
import {hasHighCgnatBlastRadiusRisk, isSingleIpBanCandidate} from '../../../risk/IpBanCgnatGuard';
import {isIpBanExempt} from '../../../risk/IpBanExemptions';
import type {IUserRepository} from '../../../user/IUserRepository';
import type {IGuildRepositoryAggregate} from '../../repositories/IGuildRepositoryAggregate';
@@ -107,6 +108,9 @@ export class GuildMemberValidationService {
userIp: string | null | undefined,
bannedIp: string | null | undefined,
): Promise<boolean> {
if (isIpBanExempt(userIp)) {
return false;
}
if (!userIp || !bannedIp || !isSingleIpBanCandidate(bannedIp)) {
return true;
}