@netacea/f5 4.3.122 → 4.3.124

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/package.json DELETED
@@ -1,50 +0,0 @@
1
- {
2
- "name": "@netacea/f5",
3
- "version": "4.3.122",
4
- "description": "Netacea F5 CDN integration",
5
- "main": "dist/src/index.js",
6
- "types": "dist/src/index.d.ts",
7
- "scripts": {
8
- "build": "npx tsc --project tsconfig.build.json",
9
- "lint:fix": "npx eslint . --ext ts --fix",
10
- "lint": "npx eslint . --ext ts",
11
- "prepublishOnly": "npm run build",
12
- "test:integration:no-clean": "NODE_OPTIONS='--import tsx' npx nyc --no-clean -r=lcov -r=html -r=text mocha --timeout 60000 './tests/mocha/*.test.ts'",
13
- "test:integration": "NODE_OPTIONS='--import tsx' npx nyc -r=lcov -r=html -r=text mocha --timeout 60000 './tests/mocha/*.test.ts'",
14
- "test:unit": "NODE_OPTIONS='--import tsx' npx nyc tape './tests/tape/*.test.ts'",
15
- "test": "npm run test:unit && npm run test:integration:no-clean",
16
- "postpack": "npx netacea-bundler postpack",
17
- "prepack": "npx netacea-bundler prepack"
18
- },
19
- "author": "Netacea <npm@netacea.com> (https://netacea.com)",
20
- "publishConfig": {
21
- "access": "public"
22
- },
23
- "license": "ISC",
24
- "devDependencies": {
25
- "@netacea/bundler": "^1.0.22",
26
- "@netacea/netaceaintegrationtestrunner": "^1.8.49",
27
- "@netacea/test-runner-scenarios": "^1.0.22",
28
- "@netacea/test-runner-transforms": "^1.0.22",
29
- "@netacea/test-runner-types": "^1.0.22",
30
- "@types/chai": "^4.3.5",
31
- "@types/mocha": "^10.0.1",
32
- "@types/node": "^14.11.2",
33
- "@types/proxyquire": "^1.3.28",
34
- "@types/sinon": "^9.0.8",
35
- "@types/tape": "^4.13.0",
36
- "chai": "^4.3.7",
37
- "mocha": "^10.2.0",
38
- "nyc": "^15.1.0",
39
- "proxyquire": "^2.1.3",
40
- "sinon": "^9.1.0",
41
- "tape": "^5.0.1",
42
- "typescript": "^5.4.5"
43
- },
44
- "dependencies": {
45
- "@netacea/kinesisingest": "^1.5.122",
46
- "@netacea/netaceaintegrationbase": "^2.0.104",
47
- "f5-nodejs": "^1.0.0"
48
- },
49
- "gitHead": "c0854fe16b2b9da29614a1fe4428423325787bbb"
50
- }
package/dist/src/F5.d.ts DELETED
@@ -1,166 +0,0 @@
1
- import { type APICallResponse, type ComposeResultResponse, type FindBestMitigationResponse, type IngestArgs, type InjectResponse, type MakeRequestArgs, type MakeRequestResponse, type MitigateResponse, type NetaceaBaseArgs, NetaceaIngestType, type NetaceaMitigationResponse, NetaceaMitigationType, type NetaceaResponseBase, type NetaceaWorker, type ProcessMitigateRequestArgs, type WebLog } from '@netacea/netaceaintegrationbase';
2
- import NetaceaKinesis from '@netacea/kinesisingest';
3
- export interface F5ConstructorArgs extends NetaceaBaseArgs {
4
- maxSockets?: number;
5
- }
6
- export interface F5Response {
7
- body?: string;
8
- status: number;
9
- apiCallStatus: number;
10
- mitigation: string;
11
- mitigated: boolean;
12
- }
13
- export interface F5MitigateArgs {
14
- ip: string;
15
- userAgent: string;
16
- url: string;
17
- method: string;
18
- mitataCookie?: string;
19
- mitataCaptchaCookie?: string;
20
- body?: any;
21
- }
22
- export interface F5IngestArgs {
23
- ip: string;
24
- userAgent: string;
25
- status: string;
26
- method: string;
27
- path: string;
28
- protocol: string;
29
- referer: string;
30
- bytesSent: string;
31
- requestTime: string;
32
- mitataCookie?: string;
33
- sessionStatus?: string;
34
- }
35
- export type IngestRequestParams = [
36
- string | undefined,
37
- // ip
38
- string | undefined,
39
- // userAgent
40
- string | undefined,
41
- // status
42
- string | undefined,
43
- // method
44
- string | undefined,
45
- // path
46
- string | undefined,
47
- // protocol
48
- string | undefined,
49
- // referer
50
- string | undefined,
51
- // bytesSent
52
- string | undefined,
53
- // requestTime
54
- string | undefined,
55
- // mitataCookie
56
- string | undefined
57
- ];
58
- export type HandleRequestParams = [
59
- string,
60
- string,
61
- string,
62
- string,
63
- // url
64
- string | null,
65
- // cookies
66
- string | undefined
67
- ];
68
- export type NetaceaF5InjectHeaders = [
69
- string,
70
- string,
71
- string,
72
- string
73
- ] | [];
74
- export interface F5Request<T extends unknown[]> {
75
- params: () => T;
76
- }
77
- export interface F5Res {
78
- reply: (args: [
79
- string,
80
- number,
81
- string[],
82
- string,
83
- boolean,
84
- string,
85
- NetaceaF5InjectHeaders
86
- ] | string) => void;
87
- }
88
- export interface IlxServer {
89
- addMethod: <T extends any[]>(handler: string, func: (req: F5Request<T>, res: F5Res) => Promise<void> | void) => void;
90
- listen: () => void;
91
- }
92
- declare abstract class NetaceaBase<RequestArgs = unknown, Response = unknown> implements NetaceaWorker<RequestArgs, Response> {
93
- protected mitataCookieExpirySeconds: number;
94
- protected apiKey: string;
95
- protected secretKey?: string;
96
- protected mitigationServiceUrl: string;
97
- protected ingestServiceUrl: string;
98
- protected readonly timeout: number;
99
- protected readonly captchaSiteKey?: string;
100
- protected readonly captchaSecretKey?: string;
101
- protected readonly ingestType: NetaceaIngestType;
102
- protected readonly kinesis?: NetaceaKinesis;
103
- protected readonly mitigationType: NetaceaMitigationType;
104
- protected readonly encryptedCookies: string[];
105
- protected readonly netaceaCookieName: string;
106
- protected readonly netaceaCaptchaCookieName: string;
107
- protected abstract makeRequest(args: MakeRequestArgs): Promise<MakeRequestResponse>;
108
- protected abstract mitigate(args: RequestArgs): Promise<MitigateResponse<Response>>;
109
- protected abstract inject(args: RequestArgs): Promise<InjectResponse>;
110
- abstract ingest(...args: any[]): Promise<any>;
111
- abstract getCookieHeader(args: RequestArgs): string | null | undefined;
112
- constructor({ apiKey, secretKey, timeout, mitigationServiceUrl, ingestServiceUrl, mitigationType, captchaSiteKey, captchaSecretKey, ingestType, kinesis, mitataCookieExpirySeconds, netaceaCookieExpirySeconds, netaceaCookieName, netaceaCaptchaCookieName }: NetaceaBaseArgs);
113
- runMitigation(args: RequestArgs): Promise<NetaceaMitigationResponse<Response>>;
114
- /**
115
- * Returns the value of the cookie with the given name from a string or list of cookies.
116
- * If the cookie name is included in the encryptedCookies class property,
117
- * then the cookie value will be decrypted automatically.
118
- * The method may operate of either the HTTP Cookie or Set-Cookie headers.
119
- * @param cookieName the name of the cookie to find.
120
- * @param cookies the full list of cookies, either as a string or an array of strings.
121
- * @returns the value of the cookie, if found.
122
- */
123
- protected readCookie(cookieName: string, cookies: string | string[] | null | undefined): Promise<string | undefined>;
124
- protected callIngest(args: IngestArgs): Promise<void>;
125
- private makeIngestApiCall;
126
- private constructV1WebLog;
127
- protected constructWebLog(args: IngestArgs): WebLog;
128
- protected check(netaceaCookie: string | undefined, clientIP: string, userAgent: string, captchaCookie?: string): Promise<ComposeResultResponse>;
129
- protected createMitata(clientIP: string, userId: string | undefined, match: string, mitigate: string, captcha: string, maxAge?: number, expiry?: number | undefined): Promise<string>;
130
- private processCaptcha;
131
- private getMitataCaptchaFromHeaders;
132
- private makeCaptchaAPICall;
133
- private getApiCallResponseFromResponse;
134
- private buildCookieFromValues;
135
- private buildCookieHeader;
136
- private makeMitigateAPICall;
137
- private composeResult;
138
- protected findBestMitigation(match: string, mitigate: string, captcha: string, isCaptchaPost: boolean): FindBestMitigationResponse;
139
- protected APIError(response: APICallResponse): Error;
140
- protected isUrlCaptchaPost(url: string, method: string): boolean;
141
- protected processMitigateRequest(args: ProcessMitigateRequestArgs): Promise<ComposeResultResponse>;
142
- protected setIngestOnlyMitataCookie(userId: string | undefined): Promise<NetaceaResponseBase>;
143
- protected processIngest(args: RequestArgs): Promise<NetaceaResponseBase>;
144
- protected encryptCookieValue(cookieValue: string): Promise<string>;
145
- protected decryptCookieValue(encryptedCookieValue: string): Promise<string>;
146
- }
147
- export default class F5 extends NetaceaBase<F5MitigateArgs | F5IngestArgs, F5Response> {
148
- private readonly httpsAgent;
149
- private readonly mitataCookieName;
150
- private readonly mitataCaptchaCookieName;
151
- constructor(args: F5ConstructorArgs);
152
- private getInjectHeaders;
153
- registerMitigateHandler(ilx: IlxServer): void;
154
- private getValueOrDefault;
155
- private getArrayValueOrDefault;
156
- private getMitataCookies;
157
- private getCookie;
158
- registerIngestHandler(ilx: IlxServer): void;
159
- protected makeRequest(args: MakeRequestArgs): Promise<MakeRequestResponse>;
160
- protected mitigate(args: F5MitigateArgs): Promise<MitigateResponse<F5Response>>;
161
- protected inject(args: F5MitigateArgs): Promise<InjectResponse>;
162
- private getMitigationResponse;
163
- ingest({ ip, userAgent, status, method, path, protocol, referer, bytesSent, requestTime, mitataCookie, sessionStatus }: F5IngestArgs): Promise<any>;
164
- getCookieHeader(args: F5IngestArgs): string | undefined;
165
- }
166
- export {};