@aikidosec/firewall
Version:
Zen by Aikido is an embedded Application Firewall that autonomously protects Node.js apps against common and critical attacks, provides rate limiting, detects malicious traffic (including bots), and more.
58 lines (57 loc) • 2.55 kB
TypeScript
import { LimitedContext } from "../helpers/matchEndpoints";
import type { Endpoint, EndpointConfig, Domain } from "./Config";
import type { IPList, UserAgentDetails } from "./api/FetchListsAPI";
export declare class ServiceConfig {
private lastUpdatedAt;
private receivedAnyStats;
private blockedUserIds;
private bypassedIPAddresses;
private nonGraphQLEndpoints;
private graphqlFields;
private blockedIPAddresses;
private blockedUserAgentRegex;
private allowedIPAddresses;
private monitoredIPAddresses;
private monitoredUserAgentRegex;
private userAgentDetails;
private blockNewOutgoingRequests;
private domains;
constructor(endpoints: EndpointConfig[], lastUpdatedAt: number, blockedUserIds: string[], bypassedIPAddresses: string[], receivedAnyStats: boolean, blockedIPAddresses: IPList[], allowedIPAddresses: IPList[]);
private setEndpoints;
getEndpoints(context: LimitedContext): Endpoint[];
getGraphQLField(context: LimitedContext, name: string, operationType: string): Endpoint | undefined;
private setBypassedIPAddresses;
isBypassedIP(ip: string): boolean;
private setBlockedUserIds;
isUserBlocked(userId: string): boolean;
isIPAddressBlocked(ip: string): {
blocked: true;
reason: string;
} | {
blocked: false;
};
private setBlockedIPAddresses;
updateBlockedIPAddresses(blockedIPAddresses: IPList[]): void;
updateMonitoredIPAddresses(monitoredIPAddresses: IPList[]): void;
updateBlockedUserAgents(blockedUserAgents: string): void;
isUserAgentBlocked(ua: string): {
blocked: boolean;
};
updateUserAgentDetails(userAgentDetails: UserAgentDetails[]): void;
updateMonitoredUserAgents(monitoredUserAgent: string): void;
isMonitoredUserAgent(ua: string): boolean;
getMatchingUserAgentKeys(ua: string): string[];
getMatchingBlockedIPListKeys(ip: string): string[];
getMatchingMonitoredIPListKeys(ip: string): string[];
private setAllowedIPAddresses;
updateAllowedIPAddresses(ipAddresses: IPList[]): void;
isAllowedIPAddress(ip: string): {
allowed: boolean;
};
updateConfig(endpoints: EndpointConfig[], lastUpdatedAt: number, blockedUserIds: string[], bypassedIPAddresses: string[], hasReceivedAnyStats: boolean): void;
getLastUpdatedAt(): number;
hasReceivedAnyStats(): boolean;
setBlockNewOutgoingRequests(block: boolean): void;
updateDomains(domains: Domain[]): void;
shouldBlockOutgoingRequest(hostname: string): boolean;
}