@aikidosec/firewall
Version:
Zen by Aikido is an embedded Web Application Firewall that autonomously protects Node.js apps against common and critical attacks
53 lines (52 loc) • 2.33 kB
TypeScript
import { LimitedContext } from "../helpers/matchEndpoints";
import type { Endpoint, EndpointConfig } from "./Config";
import { IPList, UserAgentDetails } from "./api/fetchBlockedLists";
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;
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;
}