mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-17 21:15:32 +09:00
feat(api): add IP ban exemptions (#1448)
This commit is contained in:
1 parent
311a1addce
commit
fb5fe38d52
12 files changed
+88
-1
No files matched your search
@@ -30,6 +30,7 @@ import {
|
||||
hasHighCgnatBlastRadiusRisk,
|
||||
isSingleIpBanCandidate,
|
||||
} from '../../risk/IpBanCgnatGuard';
|
||||
import {isIpBanExempt} from '../../risk/IpBanExemptions';
|
||||
import type {ISuspiciousIpRepository} from '../../risk/SuspiciousIpRepository';
|
||||
import {tryParseSingleIp} from '../../utils/IpRangeUtils';
|
||||
import {canonicalizeStoredPhrase} from '../../utils/PhraseBlocklistNormalization';
|
||||
@@ -81,6 +82,17 @@ export class AdminBanManagementService {
|
||||
) {
|
||||
const {adminRepository, auditService} = this.deps;
|
||||
const {cache: cacheService} = this.deps.apiContext.services;
|
||||
if (isIpBanExempt(data.ip)) {
|
||||
await auditService.createAuditLog({
|
||||
adminUserId,
|
||||
targetType: 'ip',
|
||||
targetId: BigInt(0),
|
||||
action: 'ban_ip_skipped_exempt',
|
||||
auditLogReason,
|
||||
metadata: new Map([['ip', data.ip]]),
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (await this.shouldSkipIpBanForCgnat(data.ip)) {
|
||||
await auditService.createAuditLog({
|
||||
adminUserId,
|
||||
|
||||
Reference in new issue
Block a user