@netacea/netaceaintegrationbase 2.0.18 → 2.0.20
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/index.cjs +562 -0
- package/dist/index.d.ts +572 -7
- package/dist/index.mjs +543 -0
- package/package.json +21 -9
- package/CHANGELOG.md +0 -1330
- package/dist/NetaceaBase.enums.d.ts +0 -68
- package/dist/NetaceaBase.enums.js +0 -73
- package/dist/NetaceaBase.enums.js.map +0 -1
- package/dist/NetaceaBase.types.d.ts +0 -371
- package/dist/NetaceaBase.types.js +0 -2
- package/dist/NetaceaBase.types.js.map +0 -1
- package/dist/dictionary.d.ts +0 -27
- package/dist/dictionary.js +0 -85
- package/dist/dictionary.js.map +0 -1
- package/dist/index.js +0 -9
- package/dist/index.js.map +0 -1
- package/dist/lib/cookie/attributes.d.ts +0 -5
- package/dist/lib/cookie/attributes.js +0 -86
- package/dist/lib/cookie/attributes.js.map +0 -1
- package/dist/lib/cookie/netaceaSession.d.ts +0 -13
- package/dist/lib/cookie/netaceaSession.js +0 -23
- package/dist/lib/cookie/netaceaSession.js.map +0 -1
- package/dist/lib/index.d.ts +0 -8
- package/dist/lib/index.js +0 -9
- package/dist/lib/index.js.map +0 -1
- package/dist/mitataCookie.d.ts +0 -37
- package/dist/mitataCookie.js +0 -109
- package/dist/mitataCookie.js.map +0 -1
- package/dist/netaceaCookieV3.d.ts +0 -7
- package/dist/netaceaCookieV3.js +0 -113
- package/dist/netaceaCookieV3.js.map +0 -1
- package/dist/utils.d.ts +0 -4
- package/dist/utils.js +0 -19
- package/dist/utils.js.map +0 -1
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
export declare enum NetaceaIngestType {
|
|
2
|
-
/**
|
|
3
|
-
* ORIGIN Ingest mode; data to be ingested is set by headers, so it can be forwarded via a seperate mechanism
|
|
4
|
-
*/
|
|
5
|
-
ORIGIN = "ORIGIN",
|
|
6
|
-
/**
|
|
7
|
-
* HTTP Ingest mode, this is the standard implementation
|
|
8
|
-
*/
|
|
9
|
-
HTTP = "HTTP",
|
|
10
|
-
/**
|
|
11
|
-
* Ingest over Kinesis, Netacea will inform you if this is required
|
|
12
|
-
* and will provide you with kinesis credentials.
|
|
13
|
-
*/
|
|
14
|
-
KINESIS = "KINESIS",
|
|
15
|
-
/**
|
|
16
|
-
* Data to be Ingest via some mechanism native to the host/CDN, e.g. log shipping.
|
|
17
|
-
*/
|
|
18
|
-
NATIVE = "NATIVE"
|
|
19
|
-
}
|
|
20
|
-
export declare enum NetaceaLogVersion {
|
|
21
|
-
/**
|
|
22
|
-
* Current style log version
|
|
23
|
-
*/
|
|
24
|
-
V1 = "V1",
|
|
25
|
-
/**
|
|
26
|
-
* V2 Log format, should only be used if Netacea instructs
|
|
27
|
-
*/
|
|
28
|
-
V2 = "V2"
|
|
29
|
-
}
|
|
30
|
-
export declare enum NetaceaMitigationType {
|
|
31
|
-
/**
|
|
32
|
-
* Run Netacea with mitigation mode enabled.
|
|
33
|
-
* This will serve Captcha pages and Forbidden pages when instructed to do so
|
|
34
|
-
*/
|
|
35
|
-
MITIGATE = "MITIGATE",
|
|
36
|
-
/**
|
|
37
|
-
* Run Netacea with Inject mode enabled.
|
|
38
|
-
* The end-user will only receive a cookie.
|
|
39
|
-
* The origin server will receive 3-4 headers,
|
|
40
|
-
*
|
|
41
|
-
* 'x-netacea-match' indicating what was matched (nothing(0), ua(1), ip(2), etc...)
|
|
42
|
-
*
|
|
43
|
-
* 'x-netacea-mitigate' indicating what action would've be taken (nothing (0), block(1), allow(2), etc...)
|
|
44
|
-
*
|
|
45
|
-
* 'x-netacea-captcha' indicating what captcha action would've been taken
|
|
46
|
-
*
|
|
47
|
-
* 'x-netacea-event-id' event id value that should be injected to the captcha
|
|
48
|
-
* page if using `@netacea/captchafeedback` module on the origin server
|
|
49
|
-
*/
|
|
50
|
-
INJECT = "INJECT",
|
|
51
|
-
/**
|
|
52
|
-
* Run Netacea with Ingest only mode
|
|
53
|
-
* No cookies will be set for the end user.
|
|
54
|
-
* No mitigations will be applied.
|
|
55
|
-
*
|
|
56
|
-
* **It's recommended to start in this mode!**
|
|
57
|
-
*/
|
|
58
|
-
INGEST = "INGEST"
|
|
59
|
-
}
|
|
60
|
-
export declare enum NetaceaCookieV3IssueReason {
|
|
61
|
-
CAPTCHA_GET = "captcha_get",
|
|
62
|
-
CAPTCHA_POST = "captcha_post",
|
|
63
|
-
EXPIRED_SESSION = "expired_session",
|
|
64
|
-
FORCED_REVALIDATION = "forced_revalidation",
|
|
65
|
-
INVALID_SESSION = "invalid_session",
|
|
66
|
-
IP_CHANGE = "ip_change",
|
|
67
|
-
NO_SESSION = "no_session"
|
|
68
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
export var NetaceaIngestType;
|
|
2
|
-
(function (NetaceaIngestType) {
|
|
3
|
-
/**
|
|
4
|
-
* ORIGIN Ingest mode; data to be ingested is set by headers, so it can be forwarded via a seperate mechanism
|
|
5
|
-
*/
|
|
6
|
-
NetaceaIngestType["ORIGIN"] = "ORIGIN";
|
|
7
|
-
/**
|
|
8
|
-
* HTTP Ingest mode, this is the standard implementation
|
|
9
|
-
*/
|
|
10
|
-
NetaceaIngestType["HTTP"] = "HTTP";
|
|
11
|
-
/**
|
|
12
|
-
* Ingest over Kinesis, Netacea will inform you if this is required
|
|
13
|
-
* and will provide you with kinesis credentials.
|
|
14
|
-
*/
|
|
15
|
-
NetaceaIngestType["KINESIS"] = "KINESIS";
|
|
16
|
-
/**
|
|
17
|
-
* Data to be Ingest via some mechanism native to the host/CDN, e.g. log shipping.
|
|
18
|
-
*/
|
|
19
|
-
NetaceaIngestType["NATIVE"] = "NATIVE";
|
|
20
|
-
})(NetaceaIngestType || (NetaceaIngestType = {}));
|
|
21
|
-
export var NetaceaLogVersion;
|
|
22
|
-
(function (NetaceaLogVersion) {
|
|
23
|
-
/**
|
|
24
|
-
* Current style log version
|
|
25
|
-
*/
|
|
26
|
-
NetaceaLogVersion["V1"] = "V1";
|
|
27
|
-
/**
|
|
28
|
-
* V2 Log format, should only be used if Netacea instructs
|
|
29
|
-
*/
|
|
30
|
-
NetaceaLogVersion["V2"] = "V2";
|
|
31
|
-
})(NetaceaLogVersion || (NetaceaLogVersion = {}));
|
|
32
|
-
export var NetaceaMitigationType;
|
|
33
|
-
(function (NetaceaMitigationType) {
|
|
34
|
-
/**
|
|
35
|
-
* Run Netacea with mitigation mode enabled.
|
|
36
|
-
* This will serve Captcha pages and Forbidden pages when instructed to do so
|
|
37
|
-
*/
|
|
38
|
-
NetaceaMitigationType["MITIGATE"] = "MITIGATE";
|
|
39
|
-
/**
|
|
40
|
-
* Run Netacea with Inject mode enabled.
|
|
41
|
-
* The end-user will only receive a cookie.
|
|
42
|
-
* The origin server will receive 3-4 headers,
|
|
43
|
-
*
|
|
44
|
-
* 'x-netacea-match' indicating what was matched (nothing(0), ua(1), ip(2), etc...)
|
|
45
|
-
*
|
|
46
|
-
* 'x-netacea-mitigate' indicating what action would've be taken (nothing (0), block(1), allow(2), etc...)
|
|
47
|
-
*
|
|
48
|
-
* 'x-netacea-captcha' indicating what captcha action would've been taken
|
|
49
|
-
*
|
|
50
|
-
* 'x-netacea-event-id' event id value that should be injected to the captcha
|
|
51
|
-
* page if using `@netacea/captchafeedback` module on the origin server
|
|
52
|
-
*/
|
|
53
|
-
NetaceaMitigationType["INJECT"] = "INJECT";
|
|
54
|
-
/**
|
|
55
|
-
* Run Netacea with Ingest only mode
|
|
56
|
-
* No cookies will be set for the end user.
|
|
57
|
-
* No mitigations will be applied.
|
|
58
|
-
*
|
|
59
|
-
* **It's recommended to start in this mode!**
|
|
60
|
-
*/
|
|
61
|
-
NetaceaMitigationType["INGEST"] = "INGEST";
|
|
62
|
-
})(NetaceaMitigationType || (NetaceaMitigationType = {}));
|
|
63
|
-
export var NetaceaCookieV3IssueReason;
|
|
64
|
-
(function (NetaceaCookieV3IssueReason) {
|
|
65
|
-
NetaceaCookieV3IssueReason["CAPTCHA_GET"] = "captcha_get";
|
|
66
|
-
NetaceaCookieV3IssueReason["CAPTCHA_POST"] = "captcha_post";
|
|
67
|
-
NetaceaCookieV3IssueReason["EXPIRED_SESSION"] = "expired_session";
|
|
68
|
-
NetaceaCookieV3IssueReason["FORCED_REVALIDATION"] = "forced_revalidation";
|
|
69
|
-
NetaceaCookieV3IssueReason["INVALID_SESSION"] = "invalid_session";
|
|
70
|
-
NetaceaCookieV3IssueReason["IP_CHANGE"] = "ip_change";
|
|
71
|
-
NetaceaCookieV3IssueReason["NO_SESSION"] = "no_session";
|
|
72
|
-
})(NetaceaCookieV3IssueReason || (NetaceaCookieV3IssueReason = {}));
|
|
73
|
-
//# sourceMappingURL=NetaceaBase.enums.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NetaceaBase.enums.js","sourceRoot":"","sources":["../src/NetaceaBase.enums.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,iBAkBX;AAlBD,WAAY,iBAAiB;IAC3B;;OAEG;IACH,sCAAiB,CAAA;IACjB;;OAEG;IACH,kCAAa,CAAA;IACb;;;OAGG;IACH,wCAAmB,CAAA;IACnB;;OAEG;IACH,sCAAiB,CAAA;AACnB,CAAC,EAlBW,iBAAiB,KAAjB,iBAAiB,QAkB5B;AAED,MAAM,CAAN,IAAY,iBASX;AATD,WAAY,iBAAiB;IAC3B;;OAEG;IACH,8BAAS,CAAA;IACT;;OAEG;IACH,8BAAS,CAAA;AACX,CAAC,EATW,iBAAiB,KAAjB,iBAAiB,QAS5B;AAED,MAAM,CAAN,IAAY,qBA+BX;AA/BD,WAAY,qBAAqB;IAC/B;;;OAGG;IACH,8CAAqB,CAAA;IAErB;;;;;;;;;;;;;OAaG;IACH,0CAAiB,CAAA;IAEjB;;;;;;OAMG;IACH,0CAAiB,CAAA;AACnB,CAAC,EA/BW,qBAAqB,KAArB,qBAAqB,QA+BhC;AAED,MAAM,CAAN,IAAY,0BAQX;AARD,WAAY,0BAA0B;IACpC,yDAA2B,CAAA;IAC3B,2DAA6B,CAAA;IAC7B,iEAAmC,CAAA;IACnC,yEAA2C,CAAA;IAC3C,iEAAmC,CAAA;IACnC,qDAAuB,CAAA;IACvB,uDAAyB,CAAA;AAC3B,CAAC,EARW,0BAA0B,KAA1B,0BAA0B,QAQrC"}
|
|
@@ -1,371 +0,0 @@
|
|
|
1
|
-
import { KinesisIngestConfigArgs } from '@netacea/kinesisingest';
|
|
2
|
-
import { NetaceaCookieV3IssueReason, NetaceaIngestType, NetaceaLogVersion, NetaceaMitigationType } from './NetaceaBase.enums';
|
|
3
|
-
export interface MakeRequestArgs {
|
|
4
|
-
/**
|
|
5
|
-
* Hostname of the request. For example https://mitigations.netacea.net
|
|
6
|
-
*/
|
|
7
|
-
host: string;
|
|
8
|
-
/**
|
|
9
|
-
* Path for the request, i.e captcha requests will be `/AtaVerifyCaptcha`
|
|
10
|
-
*/
|
|
11
|
-
path: string;
|
|
12
|
-
/**
|
|
13
|
-
* Key value collection of the request headers
|
|
14
|
-
*/
|
|
15
|
-
headers: Record<string, string>;
|
|
16
|
-
/**
|
|
17
|
-
* HTTP Method
|
|
18
|
-
*/
|
|
19
|
-
method: 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
20
|
-
/**
|
|
21
|
-
* Request body value
|
|
22
|
-
*/
|
|
23
|
-
body?: any;
|
|
24
|
-
/**
|
|
25
|
-
* Request timeout value in ms
|
|
26
|
-
*/
|
|
27
|
-
timeout?: number;
|
|
28
|
-
}
|
|
29
|
-
export interface MakeRequestResponse {
|
|
30
|
-
/**
|
|
31
|
-
* Numerical status code of the response
|
|
32
|
-
*/
|
|
33
|
-
status: number;
|
|
34
|
-
/**
|
|
35
|
-
* Key value collection of the response headers
|
|
36
|
-
*/
|
|
37
|
-
headers: Record<string, string>;
|
|
38
|
-
/**
|
|
39
|
-
* Response body value
|
|
40
|
-
*/
|
|
41
|
-
body?: any;
|
|
42
|
-
}
|
|
43
|
-
export interface NetaceaBaseArgs {
|
|
44
|
-
/**
|
|
45
|
-
* Netacea APIKey
|
|
46
|
-
*/
|
|
47
|
-
apiKey: string;
|
|
48
|
-
/**
|
|
49
|
-
* Netacea Secret Key
|
|
50
|
-
*/
|
|
51
|
-
secretKey: string;
|
|
52
|
-
/**
|
|
53
|
-
* Google RECaptcha Site Key.
|
|
54
|
-
* This is used for providing your own captcha values without updating these in the Netacea console.
|
|
55
|
-
*/
|
|
56
|
-
captchaSiteKey?: string;
|
|
57
|
-
/**
|
|
58
|
-
* Google RECaptcha Secret Key.
|
|
59
|
-
* This is used for providing your own captcha values without updating these in the Netacea console.
|
|
60
|
-
*/
|
|
61
|
-
captchaSecretKey?: string;
|
|
62
|
-
/**
|
|
63
|
-
* Request timeout in ms
|
|
64
|
-
*/
|
|
65
|
-
timeout?: number;
|
|
66
|
-
/**
|
|
67
|
-
* URL of the Netacea ingest service.
|
|
68
|
-
* DEFAULT: https://ingest.netacea.net
|
|
69
|
-
*/
|
|
70
|
-
ingestServiceUrl?: string;
|
|
71
|
-
/**
|
|
72
|
-
* URL of the Netacea mitigation service.
|
|
73
|
-
* DEFAULT: https://mitigations.netacea.net
|
|
74
|
-
*/
|
|
75
|
-
mitigationServiceUrl?: string;
|
|
76
|
-
/**
|
|
77
|
-
* Type of mitigation applied, see the `NetaceaMitigationType` ENUM
|
|
78
|
-
* - INGEST - Ingest only mode, no mitigations applied
|
|
79
|
-
* - MITIGATION - Mitigation mode, active blocking/captcha rules will be applied.
|
|
80
|
-
* - INJECT - Inject mode, headers will be sent to your origin server
|
|
81
|
-
* indicating what actions Netacea would have taken.
|
|
82
|
-
* DEFAULT: NetaceaMitigationType.INGEST
|
|
83
|
-
*/
|
|
84
|
-
mitigationType?: NetaceaMitigationType;
|
|
85
|
-
/**
|
|
86
|
-
* Type of ingest, see the `NetaceaIngestType` ENUM
|
|
87
|
-
* - HTTP - Ingest via HTTP.
|
|
88
|
-
* - KINESIS - Ingest via KINESIS
|
|
89
|
-
* DEFAULT: NetaceaIngestType.HTTP
|
|
90
|
-
*/
|
|
91
|
-
ingestType?: NetaceaIngestType;
|
|
92
|
-
/**
|
|
93
|
-
* Kinesis ingest definition, see the `KinesisIngestConfigArgs` type.
|
|
94
|
-
* Only to be provided if ingestType is set to KINESIS.
|
|
95
|
-
* Netacea will provide you with the details for this stream.
|
|
96
|
-
*/
|
|
97
|
-
kinesis?: KinesisIngestConfigArgs;
|
|
98
|
-
/**
|
|
99
|
-
* Version of ingest, see the `NetaceaLogVersion` ENUM
|
|
100
|
-
* - V1 - Standard ingest.
|
|
101
|
-
* - V2 - New BETA ingest.
|
|
102
|
-
* Use NetaceaLogVersion.V1 unless instructed otherwise.
|
|
103
|
-
* DEFAULT: NetaceaLogVersion.V1
|
|
104
|
-
*/
|
|
105
|
-
logVersion?: NetaceaLogVersion;
|
|
106
|
-
/**
|
|
107
|
-
* Deprecated: alias for netaceaCookieExpirySeconds.
|
|
108
|
-
* If both are set, netaceaCookieExpirySeconds is prefered.
|
|
109
|
-
* Seconds for the netacea cookie to be revalidated after.
|
|
110
|
-
*/
|
|
111
|
-
mitataCookieExpirySeconds?: number;
|
|
112
|
-
/**
|
|
113
|
-
* Seconds for the netacea cookie to be revalidated after.
|
|
114
|
-
*/
|
|
115
|
-
netaceaCookieExpirySeconds?: number;
|
|
116
|
-
/**
|
|
117
|
-
* The name of the netacea cookie. Defaults to _mitata.
|
|
118
|
-
*/
|
|
119
|
-
netaceaCookieName?: string;
|
|
120
|
-
/**
|
|
121
|
-
* The name of the netacea captcha cookie. Defaults to _mitatacaptcha.
|
|
122
|
-
*/
|
|
123
|
-
netaceaCaptchaCookieName?: string;
|
|
124
|
-
}
|
|
125
|
-
export interface InjectHeaders {
|
|
126
|
-
'x-netacea-match': string;
|
|
127
|
-
'x-netacea-mitigate': string;
|
|
128
|
-
'x-netacea-captcha': string;
|
|
129
|
-
'x-netacea-event-id'?: string;
|
|
130
|
-
}
|
|
131
|
-
export interface ComposeResultResponse {
|
|
132
|
-
/**
|
|
133
|
-
* Body value of the response, should be in text format
|
|
134
|
-
*/
|
|
135
|
-
body?: string;
|
|
136
|
-
/**
|
|
137
|
-
* Response status code
|
|
138
|
-
*/
|
|
139
|
-
apiCallStatus: number;
|
|
140
|
-
/**
|
|
141
|
-
* setCookie values
|
|
142
|
-
*/
|
|
143
|
-
setCookie: string[];
|
|
144
|
-
/**
|
|
145
|
-
* Netacea session status string for ingest
|
|
146
|
-
*/
|
|
147
|
-
sessionStatus: string;
|
|
148
|
-
/**
|
|
149
|
-
* Netacea mitigation string
|
|
150
|
-
*/
|
|
151
|
-
mitigation: string;
|
|
152
|
-
/**
|
|
153
|
-
* Indicates if response should be mitigated or not
|
|
154
|
-
*/
|
|
155
|
-
mitigated: boolean;
|
|
156
|
-
/**
|
|
157
|
-
* Headers to ingest to origin server
|
|
158
|
-
*/
|
|
159
|
-
injectHeaders?: InjectHeaders;
|
|
160
|
-
}
|
|
161
|
-
export interface IngestArgs {
|
|
162
|
-
/**
|
|
163
|
-
* Client IP Address
|
|
164
|
-
*/
|
|
165
|
-
ip: string;
|
|
166
|
-
/**
|
|
167
|
-
* Client User-Agent header value
|
|
168
|
-
*/
|
|
169
|
-
userAgent: string;
|
|
170
|
-
/**
|
|
171
|
-
* Response status code
|
|
172
|
-
* Should be 403 if Netacea mitigated
|
|
173
|
-
*/
|
|
174
|
-
status: string;
|
|
175
|
-
/**
|
|
176
|
-
* Request method
|
|
177
|
-
*/
|
|
178
|
-
method: string;
|
|
179
|
-
/**
|
|
180
|
-
* Request path
|
|
181
|
-
*/
|
|
182
|
-
path: string;
|
|
183
|
-
/**
|
|
184
|
-
* Request protocol
|
|
185
|
-
*/
|
|
186
|
-
protocol: string;
|
|
187
|
-
/**
|
|
188
|
-
* Request referer header value
|
|
189
|
-
*/
|
|
190
|
-
referer: string;
|
|
191
|
-
/**
|
|
192
|
-
* Request content-length header, or body size
|
|
193
|
-
*/
|
|
194
|
-
bytesSent: string | number;
|
|
195
|
-
/**
|
|
196
|
-
* Time taken to serve request
|
|
197
|
-
*/
|
|
198
|
-
requestTime: string | number;
|
|
199
|
-
/**
|
|
200
|
-
* Netacea mitata cookie value.
|
|
201
|
-
* Should be request's cookie value if Netacea was not called.
|
|
202
|
-
*/
|
|
203
|
-
mitataCookie?: string;
|
|
204
|
-
/**
|
|
205
|
-
* Session status from `ComposeResultResponse`
|
|
206
|
-
*/
|
|
207
|
-
sessionStatus?: string;
|
|
208
|
-
/**
|
|
209
|
-
* Type of the integration, for example "Cloudflare" or "Cloudfront"
|
|
210
|
-
*/
|
|
211
|
-
integrationType?: string;
|
|
212
|
-
/**
|
|
213
|
-
* SEMVER string indicating the version of the integration
|
|
214
|
-
* Example: 1.2.3
|
|
215
|
-
*/
|
|
216
|
-
integrationVersion?: string;
|
|
217
|
-
/**
|
|
218
|
-
* IP values set by a CDN under "x-fowarded-for" header
|
|
219
|
-
*/
|
|
220
|
-
xForwardedFor?: string;
|
|
221
|
-
headerFingerprint?: string;
|
|
222
|
-
cookieFingerprint?: string;
|
|
223
|
-
}
|
|
224
|
-
export interface WebLog {
|
|
225
|
-
Request: string;
|
|
226
|
-
TimeLocal: string;
|
|
227
|
-
RealIp: string;
|
|
228
|
-
UserAgent: string;
|
|
229
|
-
Status: string;
|
|
230
|
-
RequestTime: string;
|
|
231
|
-
BytesSent: string;
|
|
232
|
-
Referer: string;
|
|
233
|
-
NetaceaUserIdCookie: string;
|
|
234
|
-
NetaceaMitigationApplied: string;
|
|
235
|
-
IntegrationType?: string;
|
|
236
|
-
IntegrationVersion?: string;
|
|
237
|
-
XForwardedFor?: string;
|
|
238
|
-
optional?: Record<string, unknown>;
|
|
239
|
-
}
|
|
240
|
-
export interface V2WebLog {
|
|
241
|
-
'@timestamp': string;
|
|
242
|
-
bc_type?: string;
|
|
243
|
-
bytes_sent: number;
|
|
244
|
-
client: string;
|
|
245
|
-
domain_name?: string;
|
|
246
|
-
domain_name_orig?: string;
|
|
247
|
-
hour: number;
|
|
248
|
-
integration_type?: string;
|
|
249
|
-
integration_version?: string;
|
|
250
|
-
method: string;
|
|
251
|
-
minute: number;
|
|
252
|
-
path: string;
|
|
253
|
-
protocol: string;
|
|
254
|
-
query?: string;
|
|
255
|
-
referrer?: string;
|
|
256
|
-
request: string;
|
|
257
|
-
request_time: number;
|
|
258
|
-
status: string;
|
|
259
|
-
user_agent: string;
|
|
260
|
-
user_id?: string;
|
|
261
|
-
x_forwarded_for?: string;
|
|
262
|
-
optional?: Record<string, unknown>;
|
|
263
|
-
}
|
|
264
|
-
export interface NetaceaResponseBase {
|
|
265
|
-
/**
|
|
266
|
-
* Cookies that should be set back to the user.
|
|
267
|
-
*/
|
|
268
|
-
setCookie?: string[];
|
|
269
|
-
/**
|
|
270
|
-
* Netacea session status string
|
|
271
|
-
*/
|
|
272
|
-
sessionStatus: string;
|
|
273
|
-
}
|
|
274
|
-
export interface MitigateResponse<T = any> extends NetaceaResponseBase {
|
|
275
|
-
/**
|
|
276
|
-
* Response value, using Response generic
|
|
277
|
-
*/
|
|
278
|
-
response?: T;
|
|
279
|
-
}
|
|
280
|
-
export interface InjectResponse<T = any> extends MitigateResponse<T> {
|
|
281
|
-
/**
|
|
282
|
-
* Headers to be sent to the origin server
|
|
283
|
-
* X-Netacea-Match
|
|
284
|
-
* X-Netacea-Mitigate
|
|
285
|
-
* X-Netacea-Captcha
|
|
286
|
-
* X-Netacea-Event-ID (Only sent when CAPTCHA is served)
|
|
287
|
-
*/
|
|
288
|
-
injectHeaders: InjectHeaders | undefined;
|
|
289
|
-
/**
|
|
290
|
-
* Response value, using Response generic
|
|
291
|
-
*/
|
|
292
|
-
response?: T | undefined;
|
|
293
|
-
}
|
|
294
|
-
export type NetaceaMitigationResponse<T> = MitigateResponse<T> | InjectResponse<T> | undefined;
|
|
295
|
-
export interface NetaceaWorker<RequestArgs, Response> {
|
|
296
|
-
runMitigation(args: RequestArgs): Promise<NetaceaMitigationResponse<Response>>;
|
|
297
|
-
ingest(...args: any[]): Promise<any>;
|
|
298
|
-
}
|
|
299
|
-
export interface CookiesAttributes {
|
|
300
|
-
cookieAttributes: string | undefined;
|
|
301
|
-
captchaCookieAttributes: string | undefined;
|
|
302
|
-
}
|
|
303
|
-
export interface SlicedCookieAttributes {
|
|
304
|
-
extractedAttribute: string | undefined;
|
|
305
|
-
cookieAttributes: string;
|
|
306
|
-
}
|
|
307
|
-
export interface NetaceaCookieV3OptionalFeatures {
|
|
308
|
-
checkAllPostRequests: number | undefined;
|
|
309
|
-
}
|
|
310
|
-
export interface NetaceaCookieV3 extends NetaceaCookieV3OptionalFeatures {
|
|
311
|
-
clientIP: string;
|
|
312
|
-
userId: string;
|
|
313
|
-
cookieId: string;
|
|
314
|
-
gracePeriod: number;
|
|
315
|
-
match: number;
|
|
316
|
-
mitigate: number;
|
|
317
|
-
captcha: number;
|
|
318
|
-
issueTimestamp: number;
|
|
319
|
-
issueReason: string;
|
|
320
|
-
}
|
|
321
|
-
export interface MitataCookie {
|
|
322
|
-
signature: string;
|
|
323
|
-
expiry: string;
|
|
324
|
-
userId: string;
|
|
325
|
-
ipHash: string;
|
|
326
|
-
mitigationType: string;
|
|
327
|
-
match: number;
|
|
328
|
-
mitigate: number;
|
|
329
|
-
captcha: number;
|
|
330
|
-
}
|
|
331
|
-
export interface CheckCookieResponse {
|
|
332
|
-
mitata: MitataCookie | NetaceaCookieV3 | undefined;
|
|
333
|
-
requiresReissue: boolean;
|
|
334
|
-
isExpired: boolean;
|
|
335
|
-
shouldExpire: boolean;
|
|
336
|
-
isSameIP: boolean;
|
|
337
|
-
isPrimaryHashValid: boolean;
|
|
338
|
-
match: number;
|
|
339
|
-
mitigate: number;
|
|
340
|
-
captcha: number;
|
|
341
|
-
issueReason: NetaceaCookieV3IssueReason;
|
|
342
|
-
}
|
|
343
|
-
export interface FindBestMitigationResponse {
|
|
344
|
-
sessionStatus: string;
|
|
345
|
-
mitigation: string;
|
|
346
|
-
parts: NetaceaParts;
|
|
347
|
-
}
|
|
348
|
-
export interface NetaceaParts {
|
|
349
|
-
match: number;
|
|
350
|
-
mitigate: number;
|
|
351
|
-
captcha: number;
|
|
352
|
-
}
|
|
353
|
-
export interface APICallResponse {
|
|
354
|
-
status: number;
|
|
355
|
-
body?: any;
|
|
356
|
-
}
|
|
357
|
-
export interface MakeMitigateAPICallResponse extends NetaceaParts, APICallResponse {
|
|
358
|
-
setCookie: string[];
|
|
359
|
-
eventId?: string;
|
|
360
|
-
mitataMaxAge: number;
|
|
361
|
-
}
|
|
362
|
-
export type MakeCaptchaApiCallResponse = MakeMitigateAPICallResponse;
|
|
363
|
-
export interface ProcessMitigateRequestArgs {
|
|
364
|
-
url: string;
|
|
365
|
-
method: string;
|
|
366
|
-
mitata: string | undefined;
|
|
367
|
-
mitataCaptcha: string | undefined;
|
|
368
|
-
clientIp: string;
|
|
369
|
-
userAgent: string;
|
|
370
|
-
getBodyFn: () => Promise<any>;
|
|
371
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NetaceaBase.types.js","sourceRoot":"","sources":["../src/NetaceaBase.types.ts"],"names":[],"mappings":""}
|
package/dist/dictionary.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export declare const COOKIEDELIMITER: string;
|
|
2
|
-
export declare const mitigationTypes: {
|
|
3
|
-
none: string;
|
|
4
|
-
block: string;
|
|
5
|
-
captcha: string;
|
|
6
|
-
allow: string;
|
|
7
|
-
captchaPass: string;
|
|
8
|
-
};
|
|
9
|
-
export declare const netaceaHeaders: {
|
|
10
|
-
match: string;
|
|
11
|
-
mitigate: string;
|
|
12
|
-
captcha: string;
|
|
13
|
-
mitata: string;
|
|
14
|
-
mitataExpiry: string;
|
|
15
|
-
mitataCaptcha: string;
|
|
16
|
-
mitataCaptchaExpiry: string;
|
|
17
|
-
eventId: string;
|
|
18
|
-
};
|
|
19
|
-
export declare const matchMap: Record<number, string | undefined>;
|
|
20
|
-
export declare const mitigateMap: Record<number, string | undefined>;
|
|
21
|
-
export declare const captchaMap: Record<number, string | undefined>;
|
|
22
|
-
export declare const captchaStatusCodes: Record<string, number | undefined>;
|
|
23
|
-
export declare const bestMitigationMap: Record<number, string>;
|
|
24
|
-
export declare const bestMitigationCaptchaMap: Record<number, string | undefined>;
|
|
25
|
-
export declare const netaceaCookieV3KeyMap: Record<string, string>;
|
|
26
|
-
export declare const netaceaCookieV3OptionalKeyMap: Record<string, string>;
|
|
27
|
-
export declare const netaceaSettingsMap: Record<string, string>;
|
package/dist/dictionary.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
export const COOKIEDELIMITER = '_/@#/';
|
|
2
|
-
export const mitigationTypes = {
|
|
3
|
-
none: '',
|
|
4
|
-
block: 'block',
|
|
5
|
-
captcha: 'captcha',
|
|
6
|
-
allow: 'allow',
|
|
7
|
-
captchaPass: 'captchapass'
|
|
8
|
-
};
|
|
9
|
-
export const netaceaHeaders = {
|
|
10
|
-
match: 'x-netacea-match',
|
|
11
|
-
mitigate: 'x-netacea-mitigate',
|
|
12
|
-
captcha: 'x-netacea-captcha',
|
|
13
|
-
mitata: 'x-netacea-mitata-value',
|
|
14
|
-
mitataExpiry: 'x-netacea-mitata-expiry',
|
|
15
|
-
mitataCaptcha: 'x-netacea-mitatacaptcha-value',
|
|
16
|
-
mitataCaptchaExpiry: 'x-netacea-mitatacaptcha-expiry',
|
|
17
|
-
eventId: 'x-netacea-event-id'
|
|
18
|
-
};
|
|
19
|
-
export const matchMap = {
|
|
20
|
-
0: '',
|
|
21
|
-
1: 'ua_',
|
|
22
|
-
2: 'ip_',
|
|
23
|
-
3: 'visitor_',
|
|
24
|
-
4: 'datacenter_',
|
|
25
|
-
5: 'sev_',
|
|
26
|
-
6: 'organisation_',
|
|
27
|
-
7: 'asn_',
|
|
28
|
-
8: 'country_',
|
|
29
|
-
9: 'combination_'
|
|
30
|
-
};
|
|
31
|
-
export const mitigateMap = {
|
|
32
|
-
0: '',
|
|
33
|
-
1: 'blocked',
|
|
34
|
-
2: 'allow',
|
|
35
|
-
3: 'hardblocked',
|
|
36
|
-
4: 'block'
|
|
37
|
-
};
|
|
38
|
-
export const captchaMap = {
|
|
39
|
-
0: '',
|
|
40
|
-
1: 'captcha_serve',
|
|
41
|
-
2: 'captcha_pass',
|
|
42
|
-
3: 'captcha_fail',
|
|
43
|
-
4: 'captcha_cookiepass',
|
|
44
|
-
5: 'captcha_cookiefail'
|
|
45
|
-
};
|
|
46
|
-
export const captchaStatusCodes = {
|
|
47
|
-
'': 0,
|
|
48
|
-
'captchaServe': 1,
|
|
49
|
-
'captchaPass': 2,
|
|
50
|
-
'captchaFail': 3,
|
|
51
|
-
'captchaCookiePass': 4,
|
|
52
|
-
'captchaCookieFail': 5
|
|
53
|
-
};
|
|
54
|
-
export const bestMitigationMap = {
|
|
55
|
-
0: mitigationTypes.none,
|
|
56
|
-
1: mitigationTypes.block,
|
|
57
|
-
2: mitigationTypes.none,
|
|
58
|
-
3: mitigationTypes.block,
|
|
59
|
-
4: mitigationTypes.block
|
|
60
|
-
};
|
|
61
|
-
export const bestMitigationCaptchaMap = {
|
|
62
|
-
1: mitigationTypes.captcha,
|
|
63
|
-
2: mitigationTypes.captchaPass,
|
|
64
|
-
3: mitigationTypes.captcha,
|
|
65
|
-
4: mitigationTypes.allow,
|
|
66
|
-
5: mitigationTypes.captcha
|
|
67
|
-
};
|
|
68
|
-
export const netaceaCookieV3KeyMap = {
|
|
69
|
-
clientIP: 'cip',
|
|
70
|
-
userId: 'uid',
|
|
71
|
-
gracePeriod: 'grp',
|
|
72
|
-
cookieId: 'cid',
|
|
73
|
-
match: 'mat',
|
|
74
|
-
mitigate: 'mit',
|
|
75
|
-
captcha: 'cap',
|
|
76
|
-
issueTimestamp: 'ist',
|
|
77
|
-
issueReason: 'isr'
|
|
78
|
-
};
|
|
79
|
-
export const netaceaCookieV3OptionalKeyMap = {
|
|
80
|
-
checkAllPostRequests: 'fCAPR'
|
|
81
|
-
};
|
|
82
|
-
export const netaceaSettingsMap = {
|
|
83
|
-
checkAllPostRequests: 'checkAllPostRequests'
|
|
84
|
-
};
|
|
85
|
-
//# sourceMappingURL=dictionary.js.map
|
package/dist/dictionary.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dictionary.js","sourceRoot":"","sources":["../src/dictionary.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAW,OAAO,CAAA;AAC9C,MAAM,CAAC,MAAM,eAAe,GAMxB;IACF,IAAI,EAAE,EAAE;IACR,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,aAAa;CAC3B,CAAA;AACD,MAAM,CAAC,MAAM,cAAc,GASvB;IACF,KAAK,EAAE,iBAAiB;IACxB,QAAQ,EAAE,oBAAoB;IAC9B,OAAO,EAAE,mBAAmB;IAC5B,MAAM,EAAE,wBAAwB;IAChC,YAAY,EAAE,yBAAyB;IACvC,aAAa,EAAE,+BAA+B;IAC9C,mBAAmB,EAAE,gCAAgC;IACrD,OAAO,EAAE,oBAAoB;CAC9B,CAAA;AAED,MAAM,CAAC,MAAM,QAAQ,GAAuC;IAC1D,CAAC,EAAE,EAAE;IACL,CAAC,EAAE,KAAK;IACR,CAAC,EAAE,KAAK;IACR,CAAC,EAAE,UAAU;IACb,CAAC,EAAE,aAAa;IAChB,CAAC,EAAE,MAAM;IACT,CAAC,EAAE,eAAe;IAClB,CAAC,EAAE,MAAM;IACT,CAAC,EAAE,UAAU;IACb,CAAC,EAAE,cAAc;CAClB,CAAA;AAED,MAAM,CAAC,MAAM,WAAW,GAAuC;IAC7D,CAAC,EAAE,EAAE;IACL,CAAC,EAAE,SAAS;IACZ,CAAC,EAAE,OAAO;IACV,CAAC,EAAE,aAAa;IAChB,CAAC,EAAE,OAAO;CACX,CAAA;AAED,MAAM,CAAC,MAAM,UAAU,GAAuC;IAC5D,CAAC,EAAE,EAAE;IACL,CAAC,EAAE,eAAe;IAClB,CAAC,EAAE,cAAc;IACjB,CAAC,EAAE,cAAc;IACjB,CAAC,EAAE,oBAAoB;IACvB,CAAC,EAAE,oBAAoB;CACxB,CAAA;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAuC;IACpE,EAAE,EAAE,CAAC;IACL,cAAc,EAAE,CAAC;IACjB,aAAa,EAAE,CAAC;IAChB,aAAa,EAAE,CAAC;IAChB,mBAAmB,EAAE,CAAC;IACtB,mBAAmB,EAAE,CAAC;CACvB,CAAA;AAED,MAAM,CAAC,MAAM,iBAAiB,GAA2B;IACvD,CAAC,EAAE,eAAe,CAAC,IAAI;IACvB,CAAC,EAAE,eAAe,CAAC,KAAK;IACxB,CAAC,EAAE,eAAe,CAAC,IAAI;IACvB,CAAC,EAAE,eAAe,CAAC,KAAK;IACxB,CAAC,EAAE,eAAe,CAAC,KAAK;CACzB,CAAA;AAED,MAAM,CAAC,MAAM,wBAAwB,GAAuC;IAC1E,CAAC,EAAE,eAAe,CAAC,OAAO;IAC1B,CAAC,EAAE,eAAe,CAAC,WAAW;IAC9B,CAAC,EAAE,eAAe,CAAC,OAAO;IAC1B,CAAC,EAAE,eAAe,CAAC,KAAK;IACxB,CAAC,EAAE,eAAe,CAAC,OAAO;CAC3B,CAAA;AAED,MAAM,CAAC,MAAM,qBAAqB,GAA2B;IAC3D,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE,KAAK;IACb,WAAW,EAAE,KAAK;IAClB,QAAQ,EAAE,KAAK;IACf,KAAK,EAAE,KAAK;IACZ,QAAQ,EAAE,KAAK;IACf,OAAO,EAAE,KAAK;IACd,cAAc,EAAE,KAAK;IACrB,WAAW,EAAE,KAAK;CACnB,CAAA;AAED,MAAM,CAAC,MAAM,6BAA6B,GAA2B;IACnE,oBAAoB,EAAE,OAAO;CAC9B,CAAA;AAED,MAAM,CAAC,MAAM,kBAAkB,GAA2B;IACxD,oBAAoB,EAAE,sBAAsB;CAC7C,CAAA"}
|
package/dist/index.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export * from './utils';
|
|
2
|
-
export * from './NetaceaBase.enums';
|
|
3
|
-
export * from './NetaceaBase.types';
|
|
4
|
-
export { matchMitataCookie, checkMitataCookie, createMitataCookie, generateId, hexSha256, ingestIgnoredIpValue, warmupCookie } from './mitataCookie';
|
|
5
|
-
export { matchNetaceaCookieV3, cookieIsNetaceaV3Format, createNetaceaCookieV3, checkNetaceaCookieV3, defaultInvalidResponse, objectIsNetaceaCookieV3 } from './netaceaCookieV3';
|
|
6
|
-
import * as dictionary_1 from './dictionary';
|
|
7
|
-
export { dictionary_1 as dictionary };
|
|
8
|
-
export { lib } from './lib/index';
|
|
9
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,OAAO,EAGL,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,UAAU,EACV,SAAS,EACT,oBAAoB,EACpB,YAAY,EACb,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,uBAAuB,EACxB,MAAM,mBAAmB,CAAA;8BAEE,cAAc;yBAA9B,UAAU;AAEtB,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { CookiesAttributes, SlicedCookieAttributes } from '../../NetaceaBase.types';
|
|
2
|
-
export declare function configureCookiesDomain(cookieAttr: string | undefined, captchaCookieAttr: string | undefined): CookiesAttributes;
|
|
3
|
-
export declare function extractAndRemoveCookieAttr(attributes: string, attribute: string): SlicedCookieAttributes;
|
|
4
|
-
export declare function extractCookieAttr(attributes: string, attribute: string): string | undefined;
|
|
5
|
-
export declare function removeDuplicateAttrs(attributes: string, keepLast?: boolean): string;
|