@netacea/akamai 1.3.9
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/CHANGELOG.md +413 -0
- package/README.md +59 -0
- package/dist/package.json +67 -0
- package/dist/src/Akamai.d.ts +54 -0
- package/dist/src/Akamai.js +408 -0
- package/dist/src/Akamai.js.map +1 -0
- package/dist/src/Base64.d.ts +5 -0
- package/dist/src/Base64.js +54 -0
- package/dist/src/Base64.js.map +1 -0
- package/dist/src/crypto_polyfill.d.ts +9 -0
- package/dist/src/crypto_polyfill.js +42 -0
- package/dist/src/crypto_polyfill.js.map +1 -0
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.js +14 -0
- package/dist/src/index.js.map +1 -0
- package/package.json +67 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
## [1.3.9](https://github.com/Netacea/JavascriptATAIntegration/compare/@netacea/akamai@1.3.8...@netacea/akamai@1.3.9) (2022-07-15)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @netacea/akamai
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [1.3.8](https://github.com/Netacea/JavascriptATAIntegration/compare/@netacea/akamai@1.3.7...@netacea/akamai@1.3.8) (2022-07-14)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @netacea/akamai
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [1.3.7](https://github.com/Netacea/JavascriptATAIntegration/compare/@netacea/akamai@1.3.6...@netacea/akamai@1.3.7) (2022-07-12)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @netacea/akamai
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## [1.3.6](https://github.com/Netacea/JavascriptATAIntegration/compare/@netacea/akamai@1.3.5...@netacea/akamai@1.3.6) (2022-07-11)
|
|
31
|
+
|
|
32
|
+
**Note:** Version bump only for package @netacea/akamai
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## [1.3.5](https://github.com/Netacea/JavascriptATAIntegration/compare/@netacea/akamai@1.3.4...@netacea/akamai@1.3.5) (2022-07-11)
|
|
39
|
+
|
|
40
|
+
**Note:** Version bump only for package @netacea/akamai
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## [1.3.4](https://github.com/Netacea/JavascriptATAIntegration/compare/@netacea/akamai@1.3.3...@netacea/akamai@1.3.4) (2022-07-11)
|
|
47
|
+
|
|
48
|
+
**Note:** Version bump only for package @netacea/akamai
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## [1.3.3](https://github.com/Netacea/JavascriptATAIntegration/compare/@netacea/akamai@1.3.2...@netacea/akamai@1.3.3) (2022-07-07)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
### Bug Fixes
|
|
58
|
+
|
|
59
|
+
* **Akamai:** INT-186: Additional environment variable check ([3cc59b8](https://github.com/Netacea/JavascriptATAIntegration/commit/3cc59b836ca779ded7569b1a9ef2da2786283ce5))
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
## [1.3.2](https://github.com/Netacea/JavascriptATAIntegration/compare/@netacea/akamai@1.3.1...@netacea/akamai@1.3.2) (2022-07-07)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
### Bug Fixes
|
|
69
|
+
|
|
70
|
+
* **Akamai:** INT-186: Changes to logs and getting value for endpoints to test against ([1037739](https://github.com/Netacea/JavascriptATAIntegration/commit/10377397edfc40f1daac8a4b4e8922b7536a0a47))
|
|
71
|
+
* **Akamai:** INT-186: getAkamaiEnvironment changes ([1a22fb1](https://github.com/Netacea/JavascriptATAIntegration/commit/1a22fb14178320b1d8b1ff4127462c485860dbc8))
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
## [1.3.1](https://github.com/Netacea/JavascriptATAIntegration/compare/@netacea/akamai@1.3.0...@netacea/akamai@1.3.1) (2022-07-07)
|
|
78
|
+
|
|
79
|
+
**Note:** Version bump only for package @netacea/akamai
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
# [1.3.0](https://github.com/Netacea/JavascriptATAIntegration/compare/@netacea/akamai@1.2.16...@netacea/akamai@1.3.0) (2022-07-05)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
### Bug Fixes
|
|
89
|
+
|
|
90
|
+
* **Akamai:** INT-183: check getVariable call args ([a4e62dd](https://github.com/Netacea/JavascriptATAIntegration/commit/a4e62dd8a25d672b09dc549e84458050bbd404d5))
|
|
91
|
+
* **Akamai:** INT-183: missing proto-mitata error handling ([e696a7f](https://github.com/Netacea/JavascriptATAIntegration/commit/e696a7f76742492d7976ca440fe68deda1ccd748))
|
|
92
|
+
* **Akamai:** INT-183: set proto-mitata to variable ([467e3a2](https://github.com/Netacea/JavascriptATAIntegration/commit/467e3a2c22ed104b9dd573c014ef5b702561f2a5))
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
### Features
|
|
96
|
+
|
|
97
|
+
* **Akamai:** INT-183: rm commented out code ([19ae0c1](https://github.com/Netacea/JavascriptATAIntegration/commit/19ae0c1e6b73506f403d520a87b9d484cacebfe3))
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
## [1.2.16](https://github.com/Netacea/JavascriptATAIntegration/compare/@netacea/akamai@1.2.15...@netacea/akamai@1.2.16) (2022-06-27)
|
|
104
|
+
|
|
105
|
+
**Note:** Version bump only for package @netacea/akamai
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
## [1.2.15](https://github.com/Netacea/JavascriptATAIntegration/compare/@netacea/akamai@1.2.14...@netacea/akamai@1.2.15) (2022-06-27)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
### Bug Fixes
|
|
115
|
+
|
|
116
|
+
* **Akamai:** INT-171: move proto-mitata cookie to header ([a836425](https://github.com/Netacea/JavascriptATAIntegration/commit/a8364253ca280773ff3b97c1cef3658457f41fea))
|
|
117
|
+
* **Akamai:** INT-171: use readCookie() to get protomitata ([ba1b699](https://github.com/Netacea/JavascriptATAIntegration/commit/ba1b699ac10269fd1e0123a6f5a717ae9dfe329e))
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
## [1.2.14](https://github.com/Netacea/JavascriptATAIntegration/compare/@netacea/akamai@1.2.13...@netacea/akamai@1.2.14) (2022-06-24)
|
|
124
|
+
|
|
125
|
+
**Note:** Version bump only for package @netacea/akamai
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
## [1.2.13](https://github.com/Netacea/JavascriptATAIntegration/compare/@netacea/akamai@1.2.12...@netacea/akamai@1.2.13) (2022-06-20)
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
### Bug Fixes
|
|
135
|
+
|
|
136
|
+
* **Akamai:** ING-167: null coalesce ([d34f955](https://github.com/Netacea/JavascriptATAIntegration/commit/d34f955bf10e9be308b46ef5432617ae686d71d7))
|
|
137
|
+
* **Akamai:** ING-167: rm empty string in set-cookie header ([75df3c7](https://github.com/Netacea/JavascriptATAIntegration/commit/75df3c74ecbc6b1a46318cc653f221f9ca13324e))
|
|
138
|
+
* **Akamai:** ING-167: test captcha scenarios ([b242827](https://github.com/Netacea/JavascriptATAIntegration/commit/b242827a9c72c43be4107c7e25e4855b1c69f003))
|
|
139
|
+
* **Akamai:** INT-167: always add extra headers in ingest-origin mode ([87349de](https://github.com/Netacea/JavascriptATAIntegration/commit/87349de28b68f2124fb474ed914f0e186a4eae43))
|
|
140
|
+
* **Akamai:** INT-167: fix sending x-netacea-userid to ingest origin ([5a18adb](https://github.com/Netacea/JavascriptATAIntegration/commit/5a18adb1a3d9c80b35317e455c25cf73764c4b34))
|
|
141
|
+
* **Akamai:** INT-167: mitigation-disabled ingest-origin test scenarios ([adf0bf7](https://github.com/Netacea/JavascriptATAIntegration/commit/adf0bf7b79d2671f40659de7004a01ff3f9f11b8))
|
|
142
|
+
* **Akamai:** INT-167: split large file ([eb7a2d9](https://github.com/Netacea/JavascriptATAIntegration/commit/eb7a2d91de2bbd70643a04f296f21ca1a19685a7))
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
## [1.2.12](https://github.com/Netacea/JavascriptATAIntegration/compare/@netacea/akamai@1.2.11...@netacea/akamai@1.2.12) (2022-06-16)
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
### Bug Fixes
|
|
152
|
+
|
|
153
|
+
* **IntegrationTestRunner:** INT-162: add expectedOriginRequest to IntegrationTestScenario type ([c091a50](https://github.com/Netacea/JavascriptATAIntegration/commit/c091a50755b7bfd3f411f5fdc85ba44ab4baa624))
|
|
154
|
+
* **IntegrationTestRunner:** INT-162: add file for mit-disabled ingest-origin tests ([ce49ac9](https://github.com/Netacea/JavascriptATAIntegration/commit/ce49ac9d4eb6655c4822e1e832a9f4cf3a07e370))
|
|
155
|
+
* **IntegrationTestRunner:** INT-162: add file for mit-enabled ingest-origin tests ([3ef9046](https://github.com/Netacea/JavascriptATAIntegration/commit/3ef9046d9fbcc18e5d8277aa8db5d177734569f3))
|
|
156
|
+
* **IntegrationTestRunner:** INT-162: allow matching headers via regex ([61a8220](https://github.com/Netacea/JavascriptATAIntegration/commit/61a82203e15dc2dfaa85d0193f3b83df41708b21))
|
|
157
|
+
* **IntegrationTestRunner:** INT-162: assert that origin is called ([02952ea](https://github.com/Netacea/JavascriptATAIntegration/commit/02952ea77b331ce8e496b8e04f1ae94f9729ae84))
|
|
158
|
+
* **IntegrationTestRunner:** INT-162: rename test files to make worker modes clearer ([5295ffd](https://github.com/Netacea/JavascriptATAIntegration/commit/5295ffd4c48f8ce518bc1fd50a49d9fae2e531fb))
|
|
159
|
+
* **IntegrationTestRunner:** INT-162: restrict http method type to get or post ([7a4f855](https://github.com/Netacea/JavascriptATAIntegration/commit/7a4f8557019e8ce52d137567f4eb4be876541036))
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
## [1.2.11](https://github.com/Netacea/JavascriptATAIntegration/compare/@netacea/akamai@1.2.10...@netacea/akamai@1.2.11) (2022-06-09)
|
|
166
|
+
|
|
167
|
+
**Note:** Version bump only for package @netacea/akamai
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
## [1.2.10](https://github.com/Netacea/JavascriptATAIntegration/compare/@netacea/akamai@1.2.9...@netacea/akamai@1.2.10) (2022-06-07)
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
### Bug Fixes
|
|
177
|
+
|
|
178
|
+
* **Akamai:** INT-84: investigate bug when sending large user-agent header ([7a3e000](https://github.com/Netacea/JavascriptATAIntegration/commit/7a3e000c879e7806f410b16417a54e9800e60fce))
|
|
179
|
+
* **Akamai:** INT-84: rm changes to akamai regression test ([c98d5ce](https://github.com/Netacea/JavascriptATAIntegration/commit/c98d5ce78c829d8b7e0fb73ba354fc84fa200d02))
|
|
180
|
+
* **Akamai:** INT-84: script to use status text description ([000a035](https://github.com/Netacea/JavascriptATAIntegration/commit/000a035fe37d160bc1efee5e153bd7ed44a3e5b1))
|
|
181
|
+
* **Akamai:** INT-84: test for large headers bypassing captcha ([bbe6b75](https://github.com/Netacea/JavascriptATAIntegration/commit/bbe6b7579681e2d27a6c90b3214b1fe3c05b6351))
|
|
182
|
+
* **Akamai:** INT-84: use blocked user ID in bug script ([4deaf22](https://github.com/Netacea/JavascriptATAIntegration/commit/4deaf22715dd63b95062275529df544f2be415f5))
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
## [1.2.9](https://github.com/Netacea/JavascriptATAIntegration/compare/@netacea/akamai@1.2.8...@netacea/akamai@1.2.9) (2022-06-01)
|
|
189
|
+
|
|
190
|
+
**Note:** Version bump only for package @netacea/akamai
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
## [1.2.8](https://github.com/Netacea/JavascriptATAIntegration/compare/@netacea/akamai@1.2.7...@netacea/akamai@1.2.8) (2022-06-01)
|
|
197
|
+
|
|
198
|
+
**Note:** Version bump only for package @netacea/akamai
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
## [1.2.7](https://github.com/Netacea/JavascriptATAIntegration/compare/@netacea/akamai@1.2.6...@netacea/akamai@1.2.7) (2022-05-30)
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
### Bug Fixes
|
|
208
|
+
|
|
209
|
+
* **Akamai:** ING-156: fix package lock ([0af957c](https://github.com/Netacea/JavascriptATAIntegration/commit/0af957cedf1087b83e74bf563456ba589a86d453))
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
## [1.2.6](https://github.com/Netacea/JavascriptATAIntegration/compare/@netacea/akamai@1.2.5...@netacea/akamai@1.2.6) (2022-05-30)
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
### Reverts
|
|
219
|
+
|
|
220
|
+
* Revert "Create token changes to test new github action scoping" ([7061c60](https://github.com/Netacea/JavascriptATAIntegration/commit/7061c607246d2bf28b46f9886db931406503d75f))
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
## [1.2.5](https://github.com/Netacea/JavascriptATAIntegration/compare/@netacea/akamai@1.2.4...@netacea/akamai@1.2.5) (2022-05-26)
|
|
227
|
+
|
|
228
|
+
**Note:** Version bump only for package @netacea/akamai
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
## [1.2.4](https://github.com/Netacea/JavascriptATAIntegration/compare/@netacea/akamai@1.2.3...@netacea/akamai@1.2.4) (2022-05-24)
|
|
235
|
+
|
|
236
|
+
**Note:** Version bump only for package @netacea/akamai
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
## [1.2.3](https://github.com/Netacea/JavascriptATAIntegration/compare/@netacea/akamai@1.2.2...@netacea/akamai@1.2.3) (2022-05-20)
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
### Bug Fixes
|
|
246
|
+
|
|
247
|
+
* **repo:** ING-197: update readme to document use of main instead of master ([b99f303](https://github.com/Netacea/JavascriptATAIntegration/commit/b99f303db1980de7284f054b479c52df33f790d7))
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
## [1.2.2](https://github.com/Netacea/JavascriptATAIntegration/compare/@netacea/akamai@1.2.1...@netacea/akamai@1.2.2) (2022-05-19)
|
|
254
|
+
|
|
255
|
+
**Note:** Version bump only for package @netacea/akamai
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
## [1.2.1](https://github.com/Netacea/JavascriptATAIntegration/compare/@netacea/akamai@1.2.0...@netacea/akamai@1.2.1) (2022-05-18)
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
### Bug Fixes
|
|
265
|
+
|
|
266
|
+
* **Akamai:** ING-158: fix package version check in unit tests ([cea2bc6](https://github.com/Netacea/JavascriptATAIntegration/commit/cea2bc60268b9c49466108e29fc86cf0d004980b))
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
# [1.2.0](https://github.com/Netacea/JavascriptATAIntegration/compare/@netacea/akamai@1.1.0...@netacea/akamai@1.2.0) (2022-04-29)
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
### Features
|
|
276
|
+
|
|
277
|
+
* **Akamai:** ING-155: remove all .npmrc files ([07774ad](https://github.com/Netacea/JavascriptATAIntegration/commit/07774ad034a9a3076adae131cf784e1e22fea73e))
|
|
278
|
+
* **Akamai:** ING-166: update property variables to include 'NETACEA' ([cf2061f](https://github.com/Netacea/JavascriptATAIntegration/commit/cf2061ff8a3392704f6dd2d5f9ab7096b26c46f0))
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
# 1.1.0 (2022-03-23)
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
### Features
|
|
288
|
+
|
|
289
|
+
* **akamai:** Added _mitata cookie to the response on inject ([de01274](https://github.com/Netacea/JavascriptATAIntegration/commit/de01274e7c182d98b2a37a0dc7f1f8dca1bcf085))
|
|
290
|
+
* **akamai:** Added set cookie header on inject ([787c543](https://github.com/Netacea/JavascriptATAIntegration/commit/787c5431460b2e1d3b3e61ee45f6dcc37619ec6a))
|
|
291
|
+
* **akamai:** AM-67: changed getheader from set-cookie changed condition on handler ([3646713](https://github.com/Netacea/JavascriptATAIntegration/commit/36467132aa415357c7c5e8e3b38b777c348ef848))
|
|
292
|
+
* **akamai:** AM-67: fix linting ([94fd956](https://github.com/Netacea/JavascriptATAIntegration/commit/94fd956bf1285725b9c306bda5970fdf91cdc4e0))
|
|
293
|
+
* **akamai:** AM-67: fix mitata cookie on blocked requests ([461c23f](https://github.com/Netacea/JavascriptATAIntegration/commit/461c23f534c9cebabad30771407319c64f1b3189))
|
|
294
|
+
* **akamai:** AM-67: removed global mitResult from index.ts ([9c912d7](https://github.com/Netacea/JavascriptATAIntegration/commit/9c912d7c517e89a7cb5e00e9d85b801be76f630c))
|
|
295
|
+
* **akamai:** AM-67: resolved merge conficts ([9e3a9b5](https://github.com/Netacea/JavascriptATAIntegration/commit/9e3a9b5f448c305b958a830c2fc79d2db2cddb15))
|
|
296
|
+
* **akamai:** II-46: "Fixing" linting and tests ([dcfa01e](https://github.com/Netacea/JavascriptATAIntegration/commit/dcfa01ec7e2e03f038ac08d0fd7352f318fbd3b1))
|
|
297
|
+
* **akamai:** II-46: Alt Kinesis Ingest ([60a4dbe](https://github.com/Netacea/JavascriptATAIntegration/commit/60a4dbee28500fdbf0f99aad435167121fb9b1ed))
|
|
298
|
+
* **akamai:** II-46: API Gateway ingest ([17a082e](https://github.com/Netacea/JavascriptATAIntegration/commit/17a082ee6bf2aea39f0f1d10815928a48605ab89))
|
|
299
|
+
* **akamai:** II-46: Batched Ingest now being sent ([0a93987](https://github.com/Netacea/JavascriptATAIntegration/commit/0a93987a6dba3b5bbcf02a17f6fb2c0eb357cbca))
|
|
300
|
+
* **akamai:** II-46: Crypto polyfill correction ([836bb47](https://github.com/Netacea/JavascriptATAIntegration/commit/836bb474a2978da95f48d8d4c926e02808ef5368))
|
|
301
|
+
* **akamai:** II-46: Fix httpRequest usage and refactorings ([461cb5c](https://github.com/Netacea/JavascriptATAIntegration/commit/461cb5c560393f36a0d9ccc648afbe853ae4af1a))
|
|
302
|
+
* **akamai:** II-46: Fixes to ingest + mitigate ([d75c798](https://github.com/Netacea/JavascriptATAIntegration/commit/d75c798f8219190ec9e8db9c7acefa57f12b51f5))
|
|
303
|
+
* **akamai:** II-46: Ingest passback working ([70213ca](https://github.com/Netacea/JavascriptATAIntegration/commit/70213ca2adbfdcd846adb77cd1b07c32e30ae9ad))
|
|
304
|
+
* **akamai:** II-46: merge in II-47 ([5410da3](https://github.com/Netacea/JavascriptATAIntegration/commit/5410da37c382b46a2210addbe1c0871c6da9b22d))
|
|
305
|
+
* **akamai:** II-46: More WIP Signatures ([bf5f9af](https://github.com/Netacea/JavascriptATAIntegration/commit/bf5f9afc30d732434b0edfedce8c6abb1f738bf7))
|
|
306
|
+
* **akamai:** II-46: Move business logic out of example ([36704a0](https://github.com/Netacea/JavascriptATAIntegration/commit/36704a0e7c02bedc907dd5f96f70243b3d0cdc48))
|
|
307
|
+
* **akamai:** II-46: Potential signing solution ([5192103](https://github.com/Netacea/JavascriptATAIntegration/commit/519210329581ca1d289772e5619a92117dd319d2))
|
|
308
|
+
* **akamai:** II-46: Redo on linting ([e572a5b](https://github.com/Netacea/JavascriptATAIntegration/commit/e572a5b75d7535ff873b5250de74ad3c703fa6d7))
|
|
309
|
+
* **akamai:** II-46: Reintroducing batching ([3ac9e5c](https://github.com/Netacea/JavascriptATAIntegration/commit/3ac9e5c6fbe9bf2230585662d441c12b611d97c7))
|
|
310
|
+
* **akamai:** II-46: Remove Debug Error ([be76d87](https://github.com/Netacea/JavascriptATAIntegration/commit/be76d87bee991331c5e1caf45717d7da2d4f4f5f))
|
|
311
|
+
* **akamai:** II-46: Removing debug header ([ce07882](https://github.com/Netacea/JavascriptATAIntegration/commit/ce07882b9e0dd91c064cb446ea1c3265672e1500))
|
|
312
|
+
* **akamai:** II-46: Replace setTimeout functionality in KinesisIngest ([8c19a7c](https://github.com/Netacea/JavascriptATAIntegration/commit/8c19a7c5bc1788ccd7805937533bcd6e0ddeb57f))
|
|
313
|
+
* **akamai:** II-46: responseProvider Switch ([48f9fda](https://github.com/Netacea/JavascriptATAIntegration/commit/48f9fdaea106191c83ab5852ea6b7ea3df80fce9))
|
|
314
|
+
* **akamai:** II-46: small linting fix ([22a003c](https://github.com/Netacea/JavascriptATAIntegration/commit/22a003c55bbfe19aa50774342cfcfb779d022601))
|
|
315
|
+
* **akamai:** II-46: Unwinding changes & batching ([a52c094](https://github.com/Netacea/JavascriptATAIntegration/commit/a52c094212c5b70c685f189e23c294961240f0fa))
|
|
316
|
+
* **akamai:** II-46: Unwinding linting changes ([5f36e56](https://github.com/Netacea/JavascriptATAIntegration/commit/5f36e563f680efecbb7aacd7cdab50e7db7d9a0f))
|
|
317
|
+
* **akamai:** II-46: Winding back bundling ([5bad0f4](https://github.com/Netacea/JavascriptATAIntegration/commit/5bad0f45c95b36bb591fa20edebd8bae2d4b9173))
|
|
318
|
+
* **akamai:** II-46: WIP Commit ([bf0aa76](https://github.com/Netacea/JavascriptATAIntegration/commit/bf0aa76572e94bf1f241ddaaa443f02af480ca7e))
|
|
319
|
+
* **akamai:** II-46: Wrap signing in test ([8d5b2bc](https://github.com/Netacea/JavascriptATAIntegration/commit/8d5b2bc1b9b43757fb7f0648b6e71d4bcde40a64))
|
|
320
|
+
* **akamai:** II-47: Fix linting ([9940324](https://github.com/Netacea/JavascriptATAIntegration/commit/9940324cd6a712204983027d6510e19db06f7d51))
|
|
321
|
+
* **akamai:** II-47: Fix mitata cookie reading ([6146ea9](https://github.com/Netacea/JavascriptATAIntegration/commit/6146ea9652d327586fbc4a7092d8be933185fe70))
|
|
322
|
+
* **akamai:** II-47: Fix mitata cookie split bug ([2cafec8](https://github.com/Netacea/JavascriptATAIntegration/commit/2cafec894ea1b845be45da87df56b97f61a6d1d2))
|
|
323
|
+
* **akamai:** II-47: Fixed tests ([0ee917d](https://github.com/Netacea/JavascriptATAIntegration/commit/0ee917d808957327e91f334cd54925b97dcad39c))
|
|
324
|
+
* **akamai:** II-47: fixed tests and docs ([ec17601](https://github.com/Netacea/JavascriptATAIntegration/commit/ec1760135d0a97f9b574f5ce35e03276bea7634b))
|
|
325
|
+
* **akamai:** II-47: Fixing linting ([548d2e9](https://github.com/Netacea/JavascriptATAIntegration/commit/548d2e9829229ff73b8cc73b0802053b2fd5a85c))
|
|
326
|
+
* **akamai:** II-47: Mitigate requests ([8305fdb](https://github.com/Netacea/JavascriptATAIntegration/commit/8305fdb318fae27d3be2bddb1c92dd9d1e796fe8))
|
|
327
|
+
* **akamai:** II-47: Switch to responseProvider handler ([a3a6bf8](https://github.com/Netacea/JavascriptATAIntegration/commit/a3a6bf84f1bf7283d41bdd5faf08b26f0ad795f6))
|
|
328
|
+
* **akamai:** II-47: Worker no longer 403 ([4946d60](https://github.com/Netacea/JavascriptATAIntegration/commit/4946d60b2da0490d074323c4c743e9bce517ebc1))
|
|
329
|
+
* **akamai:** II-9: Add load testing utility ([9c81eb5](https://github.com/Netacea/JavascriptATAIntegration/commit/9c81eb57ae937e486f3e4316fbdbaaac44d11e76))
|
|
330
|
+
* **akamai:** II-9: Change b64 encoding method to save memory ([ab3c5d1](https://github.com/Netacea/JavascriptATAIntegration/commit/ab3c5d12999a9aa4968cb56444d7924c5c98e93d))
|
|
331
|
+
* **akamai:** II-9: Change batch limit and some code formatting ([eca037d](https://github.com/Netacea/JavascriptATAIntegration/commit/eca037d784f5e7b5f59e85f5900fd4ac7609a5c3))
|
|
332
|
+
* **akamai:** II-9: Clean formatting ([4e02728](https://github.com/Netacea/JavascriptATAIntegration/commit/4e0272868e10719f045bdb01e2c23fc279775a54))
|
|
333
|
+
* **akamai:** II-9: Disablign ingest tests ([86c09c7](https://github.com/Netacea/JavascriptATAIntegration/commit/86c09c735b2c5214e1da57fcdaba269a7931a10e))
|
|
334
|
+
* **akamai:** II-9: Don't need fake class ([abe1b3f](https://github.com/Netacea/JavascriptATAIntegration/commit/abe1b3fe2cc41b65458a37be3ebadcb92f809491))
|
|
335
|
+
* **akamai:** II-9: Enabling other tests ([93f204c](https://github.com/Netacea/JavascriptATAIntegration/commit/93f204c421607999503c53b20979a049f9adc92d))
|
|
336
|
+
* **akamai:** II-9: Fix & move crypto polyfill + remove unnecessary files ([2d2a196](https://github.com/Netacea/JavascriptATAIntegration/commit/2d2a19685007a33879026ceb63b1dc44ee46602e))
|
|
337
|
+
* **akamai:** II-9: Fix async ingest put error ([5aac596](https://github.com/Netacea/JavascriptATAIntegration/commit/5aac59648f9b133744b702cc60a0ecd0ca07a6aa))
|
|
338
|
+
* **akamai:** II-9: Fix kinesis batch memory issues ([cae3d00](https://github.com/Netacea/JavascriptATAIntegration/commit/cae3d0084cb7cba6757cced84139268e3cdd0c27))
|
|
339
|
+
* **akamai:** II-9: Fix linting errors ([a558a2d](https://github.com/Netacea/JavascriptATAIntegration/commit/a558a2d55e247202fe67f00228c8dc6fc2709a30))
|
|
340
|
+
* **akamai:** II-9: Fix unit tests and code formatting ([4e60cba](https://github.com/Netacea/JavascriptATAIntegration/commit/4e60cba39a5d325a6271cf7932b21f805c42a84b))
|
|
341
|
+
* **akamai:** II-9: Forward request headers to origin ([b52fe55](https://github.com/Netacea/JavascriptATAIntegration/commit/b52fe555ff3ca992dceebad185e6ba891aef411f))
|
|
342
|
+
* **akamai:** II-9: Forward request method to origin ([be1ab4d](https://github.com/Netacea/JavascriptATAIntegration/commit/be1ab4d95a79b4baf9be1d7e8fb3eba06c3e8b4b))
|
|
343
|
+
* **akamai:** II-9: Linting ([ab361bd](https://github.com/Netacea/JavascriptATAIntegration/commit/ab361bdce8bdc1b2583edd0b92362e479c02a73c))
|
|
344
|
+
* **akamai:** II-9: Minor Fixes ([e365eaa](https://github.com/Netacea/JavascriptATAIntegration/commit/e365eaac4386ea5b3722c667e4cc4519d6ea10b7))
|
|
345
|
+
* **akamai:** II-9: Move run logic to translateResult ([88ba853](https://github.com/Netacea/JavascriptATAIntegration/commit/88ba853da9568e791476b0160c06c9c0a4158bef))
|
|
346
|
+
* **akamai:** II-9: Refactor translateResult ([6452962](https://github.com/Netacea/JavascriptATAIntegration/commit/645296215b174c13d8b4fcab4699654abde20621))
|
|
347
|
+
* **akamai:** II-9: Remove unnecessary tight timout limit ([b697172](https://github.com/Netacea/JavascriptATAIntegration/commit/b697172c04f32fa959d817624fc97d5da4215b21))
|
|
348
|
+
* **akamai:** II-9: Remove unneeded interfaces ([cff0304](https://github.com/Netacea/JavascriptATAIntegration/commit/cff0304c8ea217dacff55c8c3586c6e24730a7b6))
|
|
349
|
+
* **akamai:** II-9: Resolve some todos ([1dae8c4](https://github.com/Netacea/JavascriptATAIntegration/commit/1dae8c4c197e1f108032c7d3dc7ca0efe79ae8d5))
|
|
350
|
+
* **akamai:** II-9: Stale comment corrections ([57faccb](https://github.com/Netacea/JavascriptATAIntegration/commit/57faccb5f34c8fd251434d3df163379bcf17534d))
|
|
351
|
+
* **akamai:** II-9: Switched to more lightweight library for hashing req body ([2ffab4e](https://github.com/Netacea/JavascriptATAIntegration/commit/2ffab4e354c3df3842a1a232eb21f0ae89c931aa))
|
|
352
|
+
* **akamai:** II-9: Tests running - need to fix ([9aa0acf](https://github.com/Netacea/JavascriptATAIntegration/commit/9aa0acfb67c8a04ec76684cfe99702ad8c3d1f8f))
|
|
353
|
+
* **akamai:** II-9: Tests Running but failing ([03d75b1](https://github.com/Netacea/JavascriptATAIntegration/commit/03d75b14a37abe25b5f1ae131c89dbb7a552d75e))
|
|
354
|
+
* **akamai:** II-9: Tests Running with Failures ([b64415c](https://github.com/Netacea/JavascriptATAIntegration/commit/b64415c8ab113054787e6f8ef379a67e75236fae))
|
|
355
|
+
* **akamai:** II-9: Undone commit 69f60a4 mistakenly made. Aplogies! ([df4bbdf](https://github.com/Netacea/JavascriptATAIntegration/commit/df4bbdf5d6f2352f53e605cdcae025c188152ca1))
|
|
356
|
+
* **akamai:** II-9: Update Akamai Header ([539660f](https://github.com/Netacea/JavascriptATAIntegration/commit/539660fad481b2fac515f2418879e2ee662ba570))
|
|
357
|
+
* **akamai:** II-9: WIP on Crypto ([321f8a5](https://github.com/Netacea/JavascriptATAIntegration/commit/321f8a54d1f6a4b3ea3ba1840f46770110ab9530))
|
|
358
|
+
* **akamai:** II-9: WIP Past Crypto ([bf05943](https://github.com/Netacea/JavascriptATAIntegration/commit/bf059430cf522f0579c406ce92345d0a07f1dade))
|
|
359
|
+
* **akamai:** P2-2: Slightly improved load test ([887ab36](https://github.com/Netacea/JavascriptATAIntegration/commit/887ab36be86bf03c41b15409c918bdf98714993c))
|
|
360
|
+
* **akamai:** P2-3: Added unittest ([27369b2](https://github.com/Netacea/JavascriptATAIntegration/commit/27369b225ce8135f667ec10096eec1c6070c4a39))
|
|
361
|
+
* **akamai:** P2-3: Extended timeout to 1000ms ([2f021ad](https://github.com/Netacea/JavascriptATAIntegration/commit/2f021add98983be2bfc8bb91d11555601fa042fe))
|
|
362
|
+
* **akamai:** P2-3: Fixed error caused by empty user agent ([44cb465](https://github.com/Netacea/JavascriptATAIntegration/commit/44cb4657e72ab6cbad18984c47935fef01cacb4f))
|
|
363
|
+
* **akamai:** P2-3: lint ([437d610](https://github.com/Netacea/JavascriptATAIntegration/commit/437d610185742923abf4042e87c2e4d61c236df3))
|
|
364
|
+
* **akamai:** P2-3: Made sure _mitata cookie used in Ingest API calls ([fcd15ec](https://github.com/Netacea/JavascriptATAIntegration/commit/fcd15ec793ee21e6852728d5219cdd89246fc9a8))
|
|
365
|
+
* **akamai:** P2-3: Removed await for ingest api call ([f538971](https://github.com/Netacea/JavascriptATAIntegration/commit/f538971866342d2e9b0e278e5762888ef7d16ad0))
|
|
366
|
+
* **akamai:** P2-3: Removed temporary file ([405bda9](https://github.com/Netacea/JavascriptATAIntegration/commit/405bda90ef56ba80cc9a517ab99d0dafb962b6f1))
|
|
367
|
+
* **akamai:** P2-3: Reverted package.json ([bb0dce8](https://github.com/Netacea/JavascriptATAIntegration/commit/bb0dce87f7cbbacb55b8f09cf27b46ae1fc06bf4))
|
|
368
|
+
* **akamai:** PB-66: added mit-only mode ([457672e](https://github.com/Netacea/JavascriptATAIntegration/commit/457672e78fe5c000276798fa07e83f75627a4c25))
|
|
369
|
+
* **akamai:** PB-66: fix ingestEnabled arg ([f9cd214](https://github.com/Netacea/JavascriptATAIntegration/commit/f9cd2144188fca10034cf7b2dbf28b50e6711440))
|
|
370
|
+
* **akamai:** PB-66: lint ([a20ef44](https://github.com/Netacea/JavascriptATAIntegration/commit/a20ef4466479b643be06961dc5d26f85d062c42c))
|
|
371
|
+
* **akamai:** PB-66: lint ([6f3c902](https://github.com/Netacea/JavascriptATAIntegration/commit/6f3c902e04bec0d24148a4ed43247386f6020403))
|
|
372
|
+
* **akamai:** PB-66: lint ([9cf2fed](https://github.com/Netacea/JavascriptATAIntegration/commit/9cf2fedc85795e0a0d52a53163063eb6e1d5d962))
|
|
373
|
+
* **akamai:** PB2-67: cleaned up akamai.ts ([f8a7bab](https://github.com/Netacea/JavascriptATAIntegration/commit/f8a7babcfd5e7aac835216a627f7269123859104))
|
|
374
|
+
* **akamai:** PB2-67: fix linting ([ce38f7e](https://github.com/Netacea/JavascriptATAIntegration/commit/ce38f7e224a7eab40192f71e690f7ba95bea811e))
|
|
375
|
+
* **akamai:** PB2-67: fixed integration test /lint ([c8adb29](https://github.com/Netacea/JavascriptATAIntegration/commit/c8adb2924c387f2eef3a00796135d32c7f188e63))
|
|
376
|
+
* **akamai:** PB2-67:refactored response handler ([58005fc](https://github.com/Netacea/JavascriptATAIntegration/commit/58005fc7c433d57c2a4bf3b805b4903408064d60))
|
|
377
|
+
* **akamai:** PB2-93: changed getIp func to set from varibale and updated tests ([d89bf3c](https://github.com/Netacea/JavascriptATAIntegration/commit/d89bf3cf3523980998afd2a9044bdb158958d526))
|
|
378
|
+
* **akamai:** PR-64: Decoupled dev env variables from package.json ([a82020d](https://github.com/Netacea/JavascriptATAIntegration/commit/a82020dd2bcecacde4e6e091ee3f59a0b9bd9078))
|
|
379
|
+
* **akamai:** PR-64: Decoupled dev env variables from package.json ([69f60a4](https://github.com/Netacea/JavascriptATAIntegration/commit/69f60a4fcac2efda7ea6598e31cce14d7e036cc3))
|
|
380
|
+
* **akamai:** PR-64: Fixed package.json scripts ([5e55726](https://github.com/Netacea/JavascriptATAIntegration/commit/5e557266b514b1fdde50cd7e31de617c8bb3b2e5))
|
|
381
|
+
* **akamai:** PR-64: Lint fix ([2560a97](https://github.com/Netacea/JavascriptATAIntegration/commit/2560a97334704ce0b7b16f333c953230f0290413))
|
|
382
|
+
* **akamai:** Removed logger ([330eced](https://github.com/Netacea/JavascriptATAIntegration/commit/330ecedb857c69a69d73ea195781c92d43df60fa))
|
|
383
|
+
* **akamai:** Roll back to crypto js ([579ac4d](https://github.com/Netacea/JavascriptATAIntegration/commit/579ac4d6c490b3df3a96edcbfd4ae730ff177e99))
|
|
384
|
+
* **Akamai:** AM-67: add test debug launch config ([50f905d](https://github.com/Netacea/JavascriptATAIntegration/commit/50f905d6357b811412a63f339c99844595e6a388))
|
|
385
|
+
* **Akamai:** AM-67: start new test runner that will assert on client response ([916ecef](https://github.com/Netacea/JavascriptATAIntegration/commit/916ecef3a8889229f66525d456fd7bb82a76272b))
|
|
386
|
+
* **Akamai:** ING-100: fix captcha ([dab7fc3](https://github.com/Netacea/JavascriptATAIntegration/commit/dab7fc36a237353dd3a009b87758d12bc2a7940b))
|
|
387
|
+
* **Akamai:** ING-100: fix ingest ([e281757](https://github.com/Netacea/JavascriptATAIntegration/commit/e281757c1bb380bd8c1f1bb14ed69538571412aa))
|
|
388
|
+
* **Akamai:** ING-100: linting ([f7bd9c8](https://github.com/Netacea/JavascriptATAIntegration/commit/f7bd9c8381d7f137a68a93bfb465f9c8744f484b))
|
|
389
|
+
* **Akamai:** ING-100: pr comments ([f983b70](https://github.com/Netacea/JavascriptATAIntegration/commit/f983b7065e84b5bdbdf63c973829906b43aece13))
|
|
390
|
+
* **Akamai:** ING-100: pr comments ([a11b16a](https://github.com/Netacea/JavascriptATAIntegration/commit/a11b16a5c7a347cdcdf196075cb4128f2469a7eb))
|
|
391
|
+
* **Akamai:** ING-100: pr comments ([a81c760](https://github.com/Netacea/JavascriptATAIntegration/commit/a81c760eeda5bb7c209c37b2ebc81c4c6272b5a9))
|
|
392
|
+
* **Akamai:** ING-100: PR comments ([b8155b3](https://github.com/Netacea/JavascriptATAIntegration/commit/b8155b38f1f96442cca7e8c0e1a7415d22e122d9))
|
|
393
|
+
* **Akamai:** ING-100: removed netacea headers ([f2676f8](https://github.com/Netacea/JavascriptATAIntegration/commit/f2676f8fcd0da7e5f7b3dd414ba43bdad6a35429))
|
|
394
|
+
* **Akamai:** P2-5: added upstream headers ([57a3bc0](https://github.com/Netacea/JavascriptATAIntegration/commit/57a3bc079ccfbadb331b1e770c32546eaff0f7a2))
|
|
395
|
+
* **Akamai:** P2-5: linting ([68807df](https://github.com/Netacea/JavascriptATAIntegration/commit/68807df7fd994b5bc184d605f6c8739cc67ccb7c))
|
|
396
|
+
* **Akamai:** P2-5: spelling ([f3dae4f](https://github.com/Netacea/JavascriptATAIntegration/commit/f3dae4fd2f3f121890b31122e9c25c4b2ad3819f))
|
|
397
|
+
* **Akamai:** PB2-93: fix lint ([409a8f2](https://github.com/Netacea/JavascriptATAIntegration/commit/409a8f2d7c1c6bd9ba3d5cbe030c8555cada0610))
|
|
398
|
+
* **Akamai:** PB2-93: Fix unit test ([4fe08b4](https://github.com/Netacea/JavascriptATAIntegration/commit/4fe08b4aca00688cf902660eeeccdbd56f815892))
|
|
399
|
+
* **Akamai:** PB2-93: Fixed linting and typing ([a5f33fc](https://github.com/Netacea/JavascriptATAIntegration/commit/a5f33fc8e2ddfd9b20250f291141d6152bfb173d))
|
|
400
|
+
* **integrations:** II-34: Added base config and file structure ([11724a4](https://github.com/Netacea/JavascriptATAIntegration/commit/11724a49e3728a3d9a0c90e0714dc98c0285ce49))
|
|
401
|
+
* **integrations:** II-9: Added base example ([09f2e31](https://github.com/Netacea/JavascriptATAIntegration/commit/09f2e31dd1c1244832da4906fc17080c53c9e039))
|
|
402
|
+
* **integrations:** II-9: Fix IP issue ([0141eb1](https://github.com/Netacea/JavascriptATAIntegration/commit/0141eb14cdd656f5468bc14ea93a7c8722fb2ca6))
|
|
403
|
+
* **integrations:** II-9: Get unit tests running (not passing) ([6a7204c](https://github.com/Netacea/JavascriptATAIntegration/commit/6a7204ce4d1a3780910e41be5c0250e926b4ed45))
|
|
404
|
+
* **integrations:** II-9: Modified onClientRequest Behaviour ([3ef3431](https://github.com/Netacea/JavascriptATAIntegration/commit/3ef3431b3ced02120de5a3d1b8228f9946d9b8be))
|
|
405
|
+
* **integrations:** II-9: Move business logic out of example ([62b0dc5](https://github.com/Netacea/JavascriptATAIntegration/commit/62b0dc5b1d12bad5ee16ba16638cd1b7949dee2f))
|
|
406
|
+
* **integrations:** II-9: Naive implementation of abstract functions ([b608752](https://github.com/Netacea/JavascriptATAIntegration/commit/b60875278787971348e459413f7bb864663e1c26))
|
|
407
|
+
* **integrations:** II-9: Translate Inject and Mit result ([77694a2](https://github.com/Netacea/JavascriptATAIntegration/commit/77694a22516db4be0e16c2aef984fe17ab82caa7))
|
|
408
|
+
* **integrations:** II-9: Working bundle and deploy ([2d58e95](https://github.com/Netacea/JavascriptATAIntegration/commit/2d58e957117fc6ca5eb7f79839105b712386fb97))
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
### Reverts
|
|
412
|
+
|
|
413
|
+
* Revert "feat(akamai):PB2-67 :change cryptopolyfills to node forge" ([f3b9524](https://github.com/Netacea/JavascriptATAIntegration/commit/f3b9524740ffcbfd05f4c2e3507836d94a897add))
|
package/README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Netacea Akamai
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
[](http://www.typescriptlang.org/)
|
|
6
|
+
|
|
7
|
+
`@netacea/akamai` is a package designed to add [Netacea](https://netacea.com) functionality to [Akamai](https://www.akamai.com/).
|
|
8
|
+
In this short readme you will find guidance on implementation and validity checking.
|
|
9
|
+
|
|
10
|
+
# Installation
|
|
11
|
+
|
|
12
|
+
### 🌻 Starting fresh
|
|
13
|
+
|
|
14
|
+
Quickest way to get started, is pulling the Netacea Akamai template repository from github and following the steps in there to get up and running.
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
git clone git@github.com:Netacea/akamai-edgeworker-template-typescript.git
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Follow the `README.md` in the [akamai-edgeworker-template-typescript](https://github.com/Netacea/akamai-edgeworker-template-typescript) repository to get this deployed.
|
|
21
|
+
|
|
22
|
+
### ✍ Existing Edgeworker
|
|
23
|
+
|
|
24
|
+
Run the following command to install the netacea worker
|
|
25
|
+
|
|
26
|
+
``` bash
|
|
27
|
+
npm i @netacea/akamai --save
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Require (javascript) or import (typescript) the worker
|
|
31
|
+
|
|
32
|
+
``` javascript
|
|
33
|
+
import NetaceaAkamai, { AkamaiConstructorArgs } from '@netacea/akamai'
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Then declare a variable for the worker.
|
|
37
|
+
|
|
38
|
+
``` javascript
|
|
39
|
+
const worker = new NetaceaAkamai({})
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Then register the two functions to be fired on the events onClientRequest and onClientResponse
|
|
43
|
+
|
|
44
|
+
``` javascript
|
|
45
|
+
export async function onClientRequest (request: EW.IngressClientRequest): Promise<void> {
|
|
46
|
+
await worker.requestHandler(request)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export async function onClientResponse (
|
|
50
|
+
request: EW.IngressClientRequest,
|
|
51
|
+
response: EW.EgressClientResponse
|
|
52
|
+
): Promise<void> {
|
|
53
|
+
await worker.responseHandler(request, response)
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Akamai does not provide some crytography functions that are required by the integration. In order for the sample integration to work we have included these in the [rollup config](https://github.com/Netacea/akamai-edgeworker-template-typescript) of the edgeworker template.
|
|
58
|
+
|
|
59
|
+
A number of property variables are required, including API key and Secret key. Instructions on how to set these can be found in the [akamai-edgeworker-template-typescript](https://github.com/Netacea/akamai-edgeworker-template-typescript)
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@netacea/akamai",
|
|
3
|
+
"version": "1.3.9",
|
|
4
|
+
"description": "Netacea Akamai CDN Integration",
|
|
5
|
+
"main": "dist/src/index.js",
|
|
6
|
+
"types": "dist/src/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"test": "npm run test:unit && npm run test:integration",
|
|
9
|
+
"test:integration": "npx nyc -r=html -r=text tape -r ts-node/register -r tsconfig-paths/register './tests/*.test.ts'",
|
|
10
|
+
"test:unit": "npx nyc -r=html -r=text tape -r ts-node/register -r tsconfig-paths/register './unit_tests/*.test.ts'",
|
|
11
|
+
"test:regression": "npx nyc -r=html -r=text tape -r ts-node/register -r tsconfig-paths/register './regression_tests/*.test.ts'",
|
|
12
|
+
"lint": "npx eslint . --ext ts",
|
|
13
|
+
"lint:fix": "npx eslint . --ext ts --fix",
|
|
14
|
+
"prepublishOnly": "npx tsc --project tsconfig.build.json"
|
|
15
|
+
},
|
|
16
|
+
"author": "Kyle Doidge <kyle.doidge@netacea.com> (https://netacea.com)",
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public"
|
|
19
|
+
},
|
|
20
|
+
"license": "ISC",
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@netacea/netaceaintegrationbase": "^1.10.3",
|
|
23
|
+
"@netacea/netaceaintegrationtestrunner": "^1.5.5",
|
|
24
|
+
"buffer": "^6.0.3",
|
|
25
|
+
"crypto-js": "^4.1.1",
|
|
26
|
+
"http-request": "^0.7.0"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@rollup/plugin-commonjs": "^21.0.0",
|
|
30
|
+
"@rollup/plugin-node-resolve": "^13.0.5",
|
|
31
|
+
"@rollup/plugin-typescript": "^8.2.5",
|
|
32
|
+
"@types/akamai-edgeworkers": "^1.0.3",
|
|
33
|
+
"@types/aws4": "^1.11.0",
|
|
34
|
+
"@types/crypto-js": "^4.0.2",
|
|
35
|
+
"@types/node": "^14.17.29",
|
|
36
|
+
"@types/node-fetch": "^2.5.7",
|
|
37
|
+
"@types/proxyquire": "^1.3.28",
|
|
38
|
+
"@types/sinon": "^9.0.8",
|
|
39
|
+
"@types/tape": "^4.13.0",
|
|
40
|
+
"@typescript-eslint/eslint-plugin": "^2.25.0",
|
|
41
|
+
"@typescript-eslint/parser": "^2.25.0",
|
|
42
|
+
"aws4": "^1.11.0",
|
|
43
|
+
"axios": "^0.27.2",
|
|
44
|
+
"eslint": "^6.8.0",
|
|
45
|
+
"eslint-config-standard-with-typescript": "^15.0.1",
|
|
46
|
+
"eslint-plugin-import": "^2.20.2",
|
|
47
|
+
"eslint-plugin-node": "^11.1.0",
|
|
48
|
+
"eslint-plugin-promise": "^4.2.1",
|
|
49
|
+
"eslint-plugin-standard": "^4.0.1",
|
|
50
|
+
"eslint-plugin-typescript": "^0.14.0",
|
|
51
|
+
"fetch": "^1.1.0",
|
|
52
|
+
"form-data": "^4.0.0",
|
|
53
|
+
"http-status-codes": "^2.2.0",
|
|
54
|
+
"json2csv": "^5.0.7",
|
|
55
|
+
"node-fetch": "^2.6.1",
|
|
56
|
+
"nyc": "^15.1.0",
|
|
57
|
+
"proxyquire": "^2.1.3",
|
|
58
|
+
"rollup": "^2.32.1",
|
|
59
|
+
"sinon": "^9.1.0",
|
|
60
|
+
"tape": "^5.0.1",
|
|
61
|
+
"ts-node": "^9.0.0",
|
|
62
|
+
"tsconfig-paths": "^3.9.0",
|
|
63
|
+
"tslib": "^2.0.3",
|
|
64
|
+
"typescript": "^4.0.3"
|
|
65
|
+
},
|
|
66
|
+
"gitHead": "ebcc9dba0491df6bb7ae91dc2a093988ef9c6247"
|
|
67
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/// <reference types="@types/akamai-edgeworkers" />
|
|
2
|
+
import NetaceaBase, { InjectResponse, MakeRequestArgs, MakeRequestResponse, MitigateResponse, NetaceaBaseArgs, NetaceaMitigationType, NetaceaIngestType } from '@netacea/netaceaintegrationbase';
|
|
3
|
+
export interface ResponseProperties {
|
|
4
|
+
headers: Record<string, string>;
|
|
5
|
+
body?: string | undefined;
|
|
6
|
+
status?: number;
|
|
7
|
+
statusText?: string;
|
|
8
|
+
mitigation?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface AkamaiConstructorArgs extends Omit<NetaceaBaseArgs, 'apiKey'> {
|
|
11
|
+
apiKey?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare type AkamaiMitigateResponse = MitigateResponse<ResponseProperties>;
|
|
14
|
+
export interface UpstreamMitHeaders {
|
|
15
|
+
'X-Netacea-UserId': string;
|
|
16
|
+
'X-Netacea-BC-Type': string;
|
|
17
|
+
'X-Netacea-Integration-Type': string;
|
|
18
|
+
'X-Netacea-Integration-Version': string;
|
|
19
|
+
}
|
|
20
|
+
export default class Akamai extends NetaceaBase<EW.IngressClientRequest, ResponseProperties> {
|
|
21
|
+
mitigationType: NetaceaMitigationType;
|
|
22
|
+
ingestType: NetaceaIngestType;
|
|
23
|
+
getOperationTypesFromVariables: boolean;
|
|
24
|
+
constructor(args: AkamaiConstructorArgs);
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
* @param request The request object provided by akamai
|
|
28
|
+
* @returns An object containing the body, headers and status to be returned to client
|
|
29
|
+
*/
|
|
30
|
+
requestHandler(request: EW.IngressClientRequest): Promise<void>;
|
|
31
|
+
private populateKeys;
|
|
32
|
+
private handleMitResult;
|
|
33
|
+
inject(request: EW.IngressClientRequest): Promise<InjectResponse>;
|
|
34
|
+
protected mitigate(request: EW.IngressClientRequest): Promise<AkamaiMitigateResponse>;
|
|
35
|
+
ingest(request: EW.IngressClientRequest, response: EW.EgressClientResponse): Promise<void>;
|
|
36
|
+
logError(msg: string): void;
|
|
37
|
+
protected makeRequest({ host, method, path, headers, body }: MakeRequestArgs): Promise<MakeRequestResponse>;
|
|
38
|
+
getCookieHeader(args: EW.IngressClientRequest): string | null | undefined;
|
|
39
|
+
private getProtoMitataFromContext;
|
|
40
|
+
private buildProtoMitataFromNetaceaHeaders;
|
|
41
|
+
responseHandler(request: EW.IngressClientRequest, response: EW.EgressClientResponse): Promise<void>;
|
|
42
|
+
private addHeadersToRequest;
|
|
43
|
+
private getHeaderValueOrDefault;
|
|
44
|
+
private getIP;
|
|
45
|
+
private getMitigationResponse;
|
|
46
|
+
private getMitHeaders;
|
|
47
|
+
private createAkamaiMitata;
|
|
48
|
+
private buildAkamaiCookieFromValues;
|
|
49
|
+
protected createMitata(clientIP: string, userId: string | undefined, match: number, mitigate: number, captcha: number, maxAge?: number, expiry?: number | undefined): string;
|
|
50
|
+
protected readCookie(cookieName: string, cookies: string | string[] | null | undefined): string | undefined;
|
|
51
|
+
protected verifyCaptcha(request: EW.IngressClientRequest): void;
|
|
52
|
+
protected filterCookies(response: EW.EgressClientResponse): void;
|
|
53
|
+
protected removeNetaceaHeaders(response: EW.EgressClientResponse): void;
|
|
54
|
+
}
|
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const netaceaintegrationbase_1 = __importStar(require("@netacea/netaceaintegrationbase"));
|
|
27
|
+
const pack = __importStar(require("../package.json"));
|
|
28
|
+
const http_request_1 = require("http-request");
|
|
29
|
+
const log_1 = require("log");
|
|
30
|
+
const DEFAULT_MITIGATION_TYPE = netaceaintegrationbase_1.NetaceaMitigationType.MITIGATE;
|
|
31
|
+
const DEFAULT_INGEST_TYPE = netaceaintegrationbase_1.NetaceaIngestType.HTTP;
|
|
32
|
+
const protoMitataVariableName = 'PMUSER_NETACEA_PROTO_MITATA';
|
|
33
|
+
function configureMitataExpiry(mitigationType, expirySeconds) {
|
|
34
|
+
if (expirySeconds === undefined) {
|
|
35
|
+
return mitigationType === netaceaintegrationbase_1.NetaceaMitigationType.INGEST ? 3600 : 60;
|
|
36
|
+
}
|
|
37
|
+
return expirySeconds;
|
|
38
|
+
}
|
|
39
|
+
class Akamai extends netaceaintegrationbase_1.default {
|
|
40
|
+
constructor(args) {
|
|
41
|
+
super({ apiKey: '', secretKey: '', ...args });
|
|
42
|
+
this.mitigationType = args.mitigationType ?? DEFAULT_MITIGATION_TYPE;
|
|
43
|
+
this.ingestType = args.ingestType ?? DEFAULT_INGEST_TYPE;
|
|
44
|
+
this.getOperationTypesFromVariables = true;
|
|
45
|
+
// Warm up expensive code during init phase
|
|
46
|
+
(0, netaceaintegrationbase_1.checkMitataCookie)(netaceaintegrationbase_1.warmupCookie.cookie, netaceaintegrationbase_1.warmupCookie.clientIP, netaceaintegrationbase_1.warmupCookie.secretKey);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
*
|
|
50
|
+
* @param request The request object provided by akamai
|
|
51
|
+
* @returns An object containing the body, headers and status to be returned to client
|
|
52
|
+
*/
|
|
53
|
+
async requestHandler(request) {
|
|
54
|
+
this.populateKeys(request);
|
|
55
|
+
/* eslint-disable @typescript-eslint/consistent-type-assertions, max-len */
|
|
56
|
+
if (this.getOperationTypesFromVariables) {
|
|
57
|
+
this.ingestType = netaceaintegrationbase_1.NetaceaIngestType[String(request.getVariable('PMUSER_NETACEA_INGEST_TYPE'))] ?? this.ingestType;
|
|
58
|
+
const fetchedMitigationType = netaceaintegrationbase_1.NetaceaMitigationType[String(request.getVariable('PMUSER_NETACEA_MITIGATION_TYPE'))];
|
|
59
|
+
if (fetchedMitigationType !== undefined) {
|
|
60
|
+
this.mitigationType = fetchedMitigationType;
|
|
61
|
+
this.mitataCookieExpirySeconds = configureMitataExpiry(this.mitigationType, undefined);
|
|
62
|
+
}
|
|
63
|
+
this.getOperationTypesFromVariables = false;
|
|
64
|
+
}
|
|
65
|
+
/* eslint-enable @typescript-eslint/consistent-type-assertions, max-len */
|
|
66
|
+
if (this.isUrlCaptchaPost(request.path, request.method)) {
|
|
67
|
+
this.verifyCaptcha(request);
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
await this.handleMitResult(request);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
populateKeys(request) {
|
|
74
|
+
if (this.apiKey === '') {
|
|
75
|
+
this.apiKey = request.getVariable('PMUSER_NETACEA_API_KEY') ?? '';
|
|
76
|
+
}
|
|
77
|
+
if (this.secretKey === '') {
|
|
78
|
+
this.secretKey = request.getVariable('PMUSER_NETACEA_SECRET_KEY') ?? '';
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
async handleMitResult(request) {
|
|
82
|
+
const mitResult = await this.runMitigation(request);
|
|
83
|
+
if (mitResult === undefined) {
|
|
84
|
+
throw new Error('Mitigation Service response "mitResult" was undefined.');
|
|
85
|
+
}
|
|
86
|
+
const mitigationAction = mitResult.response?.mitigation;
|
|
87
|
+
if (mitigationAction === 'block' || mitigationAction === 'captcha') {
|
|
88
|
+
const status = mitResult.response?.status ?? 403;
|
|
89
|
+
const headers = {};
|
|
90
|
+
const protoMitataJson = this.readCookie('_proto-mitata', mitResult.setCookie);
|
|
91
|
+
if (protoMitataJson !== undefined) {
|
|
92
|
+
request.setVariable(protoMitataVariableName, protoMitataJson);
|
|
93
|
+
}
|
|
94
|
+
const body = mitResult.response?.body ?? '';
|
|
95
|
+
// respondWith needs to be the last thing called by the worker as it will end the request.
|
|
96
|
+
request.respondWith(status, headers, body);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
this.addHeadersToRequest(mitResult, request);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
async inject(request) {
|
|
103
|
+
const result = await this.getMitigationResponse(request);
|
|
104
|
+
const responseHeaders = {};
|
|
105
|
+
responseHeaders['set-cookie'] = result.setCookie.join('; ');
|
|
106
|
+
return {
|
|
107
|
+
injectHeaders: result.injectHeaders,
|
|
108
|
+
sessionStatus: result.sessionStatus,
|
|
109
|
+
setCookie: result.setCookie,
|
|
110
|
+
response: {
|
|
111
|
+
headers: responseHeaders
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
async mitigate(request) {
|
|
116
|
+
const result = await this.getMitigationResponse(request);
|
|
117
|
+
const responseHeaders = {};
|
|
118
|
+
let body;
|
|
119
|
+
let status;
|
|
120
|
+
if (result.mitigated) {
|
|
121
|
+
body = result;
|
|
122
|
+
status = 403;
|
|
123
|
+
if (result.mitigation === 'captcha') {
|
|
124
|
+
responseHeaders['content-type'] = 'text/html; charset=UTF-8'; // We return captcha html
|
|
125
|
+
body = result.body;
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
// Blocked
|
|
129
|
+
body = 'Forbidden';
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return {
|
|
133
|
+
response: {
|
|
134
|
+
body,
|
|
135
|
+
status,
|
|
136
|
+
statusText: status?.toString(),
|
|
137
|
+
headers: responseHeaders,
|
|
138
|
+
mitigation: result.mitigation
|
|
139
|
+
},
|
|
140
|
+
sessionStatus: result.sessionStatus,
|
|
141
|
+
setCookie: result.setCookie
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
// eslint-disable-next-line
|
|
145
|
+
async ingest(request, response) {
|
|
146
|
+
const setCookie = response.getHeader('set-cookie') ?? [];
|
|
147
|
+
const cookieString = setCookie.length !== 0
|
|
148
|
+
? setCookie?.join('; ')
|
|
149
|
+
: this.getHeaderValueOrDefault(request, 'cookie');
|
|
150
|
+
let mitata = this.readCookie('_mitata', cookieString) ?? '';
|
|
151
|
+
if (mitata === undefined || mitata === '') {
|
|
152
|
+
const cookieString = this.getHeaderValueOrDefault(request, 'cookie');
|
|
153
|
+
mitata = this.readCookie('_mitata', cookieString) ?? '';
|
|
154
|
+
}
|
|
155
|
+
const { match, mitigate, captcha } = (0, netaceaintegrationbase_1.matchMitataCookie)(mitata) ?? {
|
|
156
|
+
match: 0,
|
|
157
|
+
mitigate: 0,
|
|
158
|
+
captcha: 0
|
|
159
|
+
};
|
|
160
|
+
const { sessionStatus } = this.findBestMitigation(match, mitigate, captcha, this.isUrlCaptchaPost(request.url, request.method));
|
|
161
|
+
try {
|
|
162
|
+
// eslint-disable-next-line
|
|
163
|
+
this.callIngest({
|
|
164
|
+
bytesSent: this.getHeaderValueOrDefault(response, 'content-length', '0'),
|
|
165
|
+
ip: this.getIP(request),
|
|
166
|
+
method: request.method,
|
|
167
|
+
path: request.url,
|
|
168
|
+
protocol: this.getHeaderValueOrDefault(request, 'protocol', 'HTTP/1.1'),
|
|
169
|
+
referer: this.getHeaderValueOrDefault(request, 'referer', ''),
|
|
170
|
+
requestTime: '0',
|
|
171
|
+
sessionStatus,
|
|
172
|
+
status: String(response.status),
|
|
173
|
+
userAgent: this.getHeaderValueOrDefault(request, 'user-agent', '-'),
|
|
174
|
+
mitataCookie: mitata,
|
|
175
|
+
integrationType: pack.name.replace('@netacea/', ''),
|
|
176
|
+
integrationVersion: pack.version
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
catch (e) {
|
|
180
|
+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
181
|
+
this.logError(`Error in callIngest(): ${e}`);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
logError(msg) {
|
|
185
|
+
if (log_1.logger !== undefined) {
|
|
186
|
+
log_1.logger.log(msg);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
async makeRequest({ host, method, path, headers, body }) {
|
|
190
|
+
if (host.includes('mitigations')) {
|
|
191
|
+
// This is in tandem with conditional origin rule in Akamai property config
|
|
192
|
+
// In dev env, this is rule "Mitigation Origin"
|
|
193
|
+
headers['X-Netacea-ProxyPass'] = 'mitigation';
|
|
194
|
+
}
|
|
195
|
+
else if (host.includes('ingest')) {
|
|
196
|
+
// This is in tandem with conditional origin rule in Akamai property config
|
|
197
|
+
// In dev env, this is rule "Ingest Origin"
|
|
198
|
+
headers['X-Netacea-ProxyPass'] = 'ingest';
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
throw Error('Host not recognised. Currently only mitigation and ingest endpoints are supported.');
|
|
202
|
+
}
|
|
203
|
+
// As a restriction of akamai, we must loopback to worker url. We pass a X-Netacea-ProxyPass
|
|
204
|
+
// header to describe the destination origin
|
|
205
|
+
const response = await (0, http_request_1.httpRequest)(path, {
|
|
206
|
+
body, headers, method, timeout: 1000
|
|
207
|
+
});
|
|
208
|
+
const responseHeadersEntries = Object.entries(response.getHeaders());
|
|
209
|
+
const responseHeaders = {};
|
|
210
|
+
for (const [key, value] of responseHeadersEntries) {
|
|
211
|
+
responseHeaders[key] = value[0]; // For some reason akamai header values are string[]
|
|
212
|
+
}
|
|
213
|
+
return {
|
|
214
|
+
status: response.status,
|
|
215
|
+
body: await response.text(),
|
|
216
|
+
headers: responseHeaders
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
getCookieHeader(args) {
|
|
220
|
+
return args.getHeader('cookie')?.[0];
|
|
221
|
+
}
|
|
222
|
+
getProtoMitataFromContext(request) {
|
|
223
|
+
const protoMitataString = request.getVariable(protoMitataVariableName);
|
|
224
|
+
// variable may be an empty string when unset
|
|
225
|
+
if (protoMitataString === undefined || protoMitataString === '') {
|
|
226
|
+
return undefined;
|
|
227
|
+
}
|
|
228
|
+
try {
|
|
229
|
+
return JSON.parse(protoMitataString);
|
|
230
|
+
}
|
|
231
|
+
catch {
|
|
232
|
+
return undefined;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
buildProtoMitataFromNetaceaHeaders(request, response) {
|
|
236
|
+
return {
|
|
237
|
+
clientIP: request.getHeader('x-netacea-client-ip'),
|
|
238
|
+
userId: request.getHeader('x-netacea-userid'),
|
|
239
|
+
match: response.getHeader('x-netacea-match'),
|
|
240
|
+
mitigate: response.getHeader('x-netacea-mitigate'),
|
|
241
|
+
captcha: response.getHeader('x-netacea-captcha'),
|
|
242
|
+
mitataMaxAge: response.getHeader('x-netacea-mitata-expiry')
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
async responseHandler(request, response) {
|
|
246
|
+
const isCaptchaPost = this.isUrlCaptchaPost(request.path, request.method);
|
|
247
|
+
if (isCaptchaPost) {
|
|
248
|
+
this.filterCookies(response);
|
|
249
|
+
}
|
|
250
|
+
const protoMitata = isCaptchaPost
|
|
251
|
+
? this.buildProtoMitataFromNetaceaHeaders(request, response)
|
|
252
|
+
: this.getProtoMitataFromContext(request);
|
|
253
|
+
if (protoMitata !== undefined) {
|
|
254
|
+
const cookie = this.createAkamaiMitata(protoMitata.clientIP, protoMitata.userId, protoMitata.match, protoMitata.mitigate, protoMitata.captcha, protoMitata.mitataMaxAge);
|
|
255
|
+
const responseCookies = response.getHeader('set-cookie') ?? [];
|
|
256
|
+
response.setHeader('set-cookie', [
|
|
257
|
+
...responseCookies.filter(c => !c.startsWith('_proto-mitata=')),
|
|
258
|
+
cookie
|
|
259
|
+
]);
|
|
260
|
+
}
|
|
261
|
+
this.removeNetaceaHeaders(response);
|
|
262
|
+
if (this.ingestType === netaceaintegrationbase_1.NetaceaIngestType.HTTP) {
|
|
263
|
+
await this.ingest(request, response);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
addHeadersToRequest(mitResult, request) {
|
|
267
|
+
let injectHeaders = {};
|
|
268
|
+
if (mitResult?.setCookie !== undefined) {
|
|
269
|
+
// Avoid using set-cookie header. All mitigation data should be passed by proto-mitata
|
|
270
|
+
const protoMitata = this.readCookie('_proto-mitata', mitResult.setCookie);
|
|
271
|
+
if (protoMitata !== undefined) {
|
|
272
|
+
request.setVariable(protoMitataVariableName, protoMitata);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
if (this.mitigationType === netaceaintegrationbase_1.NetaceaMitigationType.INJECT) {
|
|
276
|
+
const result = mitResult;
|
|
277
|
+
injectHeaders = result.injectHeaders ?? {};
|
|
278
|
+
}
|
|
279
|
+
let mitHeaders = {};
|
|
280
|
+
if (this.ingestType === netaceaintegrationbase_1.NetaceaIngestType.ORIGIN) {
|
|
281
|
+
mitHeaders = this.getMitHeaders(request, mitResult);
|
|
282
|
+
}
|
|
283
|
+
for (const [key, value] of Object.entries({ ...injectHeaders, ...mitHeaders })) {
|
|
284
|
+
request.addHeader(key, value);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
getHeaderValueOrDefault(readable, key, defaultVal = '') {
|
|
288
|
+
const header = (readable.getHeader(key)?.[0] ?? '').trim();
|
|
289
|
+
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
290
|
+
return header || defaultVal;
|
|
291
|
+
}
|
|
292
|
+
getIP(request) {
|
|
293
|
+
return request.getVariable('PMUSER_CLIENT_IP') ?? '';
|
|
294
|
+
}
|
|
295
|
+
async getMitigationResponse(request) {
|
|
296
|
+
const cookies = this.getHeaderValueOrDefault(request, 'cookie');
|
|
297
|
+
const mitataCookie = this.readCookie('_mitata', cookies) ?? '';
|
|
298
|
+
const mitataCaptcha = this.readCookie('_mitatacaptcha', cookies);
|
|
299
|
+
const clientIp = this.getIP(request);
|
|
300
|
+
const userAgent = this.getHeaderValueOrDefault(request, 'user-agent');
|
|
301
|
+
return await this.processMitigateRequest({
|
|
302
|
+
clientIp,
|
|
303
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
304
|
+
getBodyFn: async () => '',
|
|
305
|
+
method: request.method,
|
|
306
|
+
mitata: mitataCookie,
|
|
307
|
+
mitataCaptcha,
|
|
308
|
+
url: request.url,
|
|
309
|
+
userAgent
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
getMitHeaders(request, mitSvcResponse) {
|
|
313
|
+
// Is there an existing mitata cookie?
|
|
314
|
+
const cookieString = this.getHeaderValueOrDefault(request, 'cookie');
|
|
315
|
+
const mitata = (0, netaceaintegrationbase_1.matchMitataCookie)(this.readCookie('_mitata', cookieString) ?? '');
|
|
316
|
+
// Or are we setting a new mitata cookie (not yet hashed, so will be a _protoMitata)
|
|
317
|
+
const protoMitata = this.getProtoMitataFromContext(request);
|
|
318
|
+
const { match, mitigate, captcha, userId } = protoMitata ?? mitata ?? {
|
|
319
|
+
match: 0,
|
|
320
|
+
mitigate: 0,
|
|
321
|
+
captcha: 0,
|
|
322
|
+
userId: ''
|
|
323
|
+
};
|
|
324
|
+
const { sessionStatus } = this.findBestMitigation(match, mitigate, captcha, this.isUrlCaptchaPost(request.url, request.method));
|
|
325
|
+
return {
|
|
326
|
+
'X-Netacea-UserId': userId,
|
|
327
|
+
'X-Netacea-BC-Type': sessionStatus,
|
|
328
|
+
'X-Netacea-Integration-Type': pack.name.replace('@netacea/', ''),
|
|
329
|
+
'X-Netacea-Integration-Version': pack.version
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
createAkamaiMitata(clientIP, userId, match, mitigate, captcha, maxAge = 86400, expiry = undefined) {
|
|
333
|
+
// serve, fail, cookiefail
|
|
334
|
+
const isCaptchaServe = [1, 3, 5].includes(captcha);
|
|
335
|
+
const expiryDelta = isCaptchaServe ? -this.mitataCookieExpirySeconds : this.mitataCookieExpirySeconds;
|
|
336
|
+
const mitataExpiry = expiry ?? Math.floor(Date.now() / 1000) + expiryDelta;
|
|
337
|
+
if (this.secretKey === undefined) {
|
|
338
|
+
throw new Error('Cannot build cookie without secret key.');
|
|
339
|
+
}
|
|
340
|
+
const mitataCode = [match, mitigate, captcha].join('');
|
|
341
|
+
const mitataValue = (0, netaceaintegrationbase_1.createMitataCookie)(clientIP, userId, mitataExpiry, this.secretKey, mitataCode);
|
|
342
|
+
return this.buildAkamaiCookieFromValues('_mitata', mitataValue, maxAge, '/');
|
|
343
|
+
}
|
|
344
|
+
buildAkamaiCookieFromValues(cookieName, value, maxAge, path = '/') {
|
|
345
|
+
return `${cookieName}=${value}; Max-Age=${maxAge}; Path=${path}`;
|
|
346
|
+
}
|
|
347
|
+
// Override createMitata so we can handle the expensive hash in onClientResponse
|
|
348
|
+
createMitata(clientIP, userId, match, mitigate, captcha, maxAge = 86400, expiry = undefined) {
|
|
349
|
+
const AkamaiCookieObj = {
|
|
350
|
+
clientIP,
|
|
351
|
+
userId: userId ?? (0, netaceaintegrationbase_1.generateId)(),
|
|
352
|
+
match,
|
|
353
|
+
mitigate,
|
|
354
|
+
captcha,
|
|
355
|
+
mitataMaxAge: maxAge
|
|
356
|
+
};
|
|
357
|
+
return `_proto-mitata=${JSON.stringify(AkamaiCookieObj)}`;
|
|
358
|
+
}
|
|
359
|
+
// Override readCookie to avoid expensive dynamic regex.
|
|
360
|
+
readCookie(cookieName, cookies) {
|
|
361
|
+
if (cookies === null || cookies === undefined) {
|
|
362
|
+
return undefined;
|
|
363
|
+
}
|
|
364
|
+
if (typeof cookies === 'string') {
|
|
365
|
+
cookies = cookies.split(';');
|
|
366
|
+
}
|
|
367
|
+
const prefix = `${cookieName}=`;
|
|
368
|
+
for (const cookie of cookies) {
|
|
369
|
+
const trimmedCookie = cookie.trim();
|
|
370
|
+
if (trimmedCookie.startsWith(prefix)) {
|
|
371
|
+
return trimmedCookie.slice(prefix.length);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
return undefined;
|
|
375
|
+
}
|
|
376
|
+
verifyCaptcha(request) {
|
|
377
|
+
const IP = request.getVariable('PMUSER_CLIENT_IP') ?? '';
|
|
378
|
+
request.setHeader('x-netacea-api-key', this.apiKey);
|
|
379
|
+
request.setHeader('x-netacea-client-ip', IP);
|
|
380
|
+
const cookies = this.getHeaderValueOrDefault(request, 'cookie');
|
|
381
|
+
const mitataCookie = this.readCookie('_mitata', cookies) ?? '';
|
|
382
|
+
let userId = '';
|
|
383
|
+
const cookieInfo = (0, netaceaintegrationbase_1.checkMitataCookie)(mitataCookie, IP, this.secretKey ?? '');
|
|
384
|
+
if (cookieInfo.isPrimaryHashValid) {
|
|
385
|
+
userId = cookieInfo.mitata?.userId ?? '';
|
|
386
|
+
}
|
|
387
|
+
request.setHeader('x-netacea-userid', userId);
|
|
388
|
+
request.route({ origin: 'mitigations' });
|
|
389
|
+
}
|
|
390
|
+
filterCookies(response) {
|
|
391
|
+
const resCookies = response.getHeader('set-cookie');
|
|
392
|
+
const mitataCaptchaCookie = resCookies?.filter(cookie => cookie.startsWith('_mitatacaptcha'));
|
|
393
|
+
if (mitataCaptchaCookie !== undefined) {
|
|
394
|
+
response.setHeader('set-cookie', mitataCaptchaCookie);
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
removeNetaceaHeaders(response) {
|
|
398
|
+
response.removeHeader('x-netacea-match');
|
|
399
|
+
response.removeHeader('x-netacea-mitigate');
|
|
400
|
+
response.removeHeader('x-netacea-captcha');
|
|
401
|
+
response.removeHeader('x-netacea-mitata-expiry');
|
|
402
|
+
response.removeHeader('x-netacea-mitata-value');
|
|
403
|
+
response.removeHeader('x-netacea-mitatacaptcha-expiry');
|
|
404
|
+
response.removeHeader('x-netacea-mitatacaptcha-value');
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
exports.default = Akamai;
|
|
408
|
+
//# sourceMappingURL=Akamai.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Akamai.js","sourceRoot":"","sources":["../../src/Akamai.ts"],"names":[],"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xyz0123456789+/=';
|
|
6
|
+
}
|
|
7
|
+
encode(input) {
|
|
8
|
+
let output = '';
|
|
9
|
+
let chr1, chr2, chr3, enc1, enc2, enc3, enc4;
|
|
10
|
+
let i = 0;
|
|
11
|
+
input = this.utf8Encode(input);
|
|
12
|
+
while (i < input.length) {
|
|
13
|
+
chr1 = input.charCodeAt(i++);
|
|
14
|
+
chr2 = input.charCodeAt(i++);
|
|
15
|
+
chr3 = input.charCodeAt(i++);
|
|
16
|
+
enc1 = chr1 >> 2;
|
|
17
|
+
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
|
|
18
|
+
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
|
|
19
|
+
enc4 = chr3 & 63;
|
|
20
|
+
if (isNaN(chr2)) {
|
|
21
|
+
enc3 = enc4 = 64;
|
|
22
|
+
}
|
|
23
|
+
else if (isNaN(chr3)) {
|
|
24
|
+
enc4 = 64;
|
|
25
|
+
}
|
|
26
|
+
output = output +
|
|
27
|
+
this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
|
|
28
|
+
this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
|
|
29
|
+
}
|
|
30
|
+
return output;
|
|
31
|
+
}
|
|
32
|
+
utf8Encode(input) {
|
|
33
|
+
input = input.replace(/\r\n/g, '\n');
|
|
34
|
+
let utftext = '';
|
|
35
|
+
for (let n = 0; n < input.length; n++) {
|
|
36
|
+
const c = input.charCodeAt(n);
|
|
37
|
+
if (c < 128) {
|
|
38
|
+
utftext += String.fromCharCode(c);
|
|
39
|
+
}
|
|
40
|
+
else if ((c > 127) && (c < 2048)) {
|
|
41
|
+
utftext += String.fromCharCode((c >> 6) | 192);
|
|
42
|
+
utftext += String.fromCharCode((c & 63) | 128);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
utftext += String.fromCharCode((c >> 12) | 224);
|
|
46
|
+
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
|
|
47
|
+
utftext += String.fromCharCode((c & 63) | 128);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return utftext;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.default = Base64;
|
|
54
|
+
//# sourceMappingURL=Base64.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Base64.js","sourceRoot":"","sources":["../../src/Base64.ts"],"names":[],"mappings":";;AAAA,MAAqB,MAAM;IAA3B;QACmB,YAAO,GAAG,mEAAmE,CAAA;IAoDhG,CAAC;IAlDC,MAAM,CAAE,KAAa;QACnB,IAAI,MAAM,GAAG,EAAE,CAAA;QACf,IAAI,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAA;QAC5C,IAAI,CAAC,GAAG,CAAC,CAAA;QAET,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;QAE9B,OAAO,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE;YACvB,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAA;YAC5B,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAA;YAC5B,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAA;YAE5B,IAAI,GAAG,IAAI,IAAI,CAAC,CAAA;YAChB,IAAI,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,CAAA;YACtC,IAAI,GAAG,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,CAAA;YACvC,IAAI,GAAG,IAAI,GAAG,EAAE,CAAA;YAEhB,IAAI,KAAK,CAAC,IAAI,CAAC,EAAE;gBACf,IAAI,GAAG,IAAI,GAAG,EAAE,CAAA;aACjB;i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,CAAC,GAAG,EAAE,CAAC,GAAG,GAAG,CAAC,CAAA;gBACrD,OAAO,IAAI,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,GAAG,CAAC,CAAA;aAC/C;SACF;QACD,OAAO,OAAO,CAAA;IAChB,CAAC;CACF;AArDD,yBAqDC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Buffer } from 'buffer';
|
|
2
|
+
declare type Algorithm = 'sha256';
|
|
3
|
+
export declare const createHmac: (algorithm: Algorithm, key: any, options?: any) => any;
|
|
4
|
+
export declare const randomBytes: (size: number) => Buffer;
|
|
5
|
+
declare const _default: {
|
|
6
|
+
createHmac: (algorithm: "sha256", key: any, options?: any) => any;
|
|
7
|
+
randomBytes: (size: number) => Buffer;
|
|
8
|
+
};
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.randomBytes = exports.createHmac = void 0;
|
|
7
|
+
const hmac_sha256_1 = __importDefault(require("crypto-js/hmac-sha256"));
|
|
8
|
+
const enc_hex_1 = __importDefault(require("crypto-js/enc-hex"));
|
|
9
|
+
const buffer_1 = require("buffer");
|
|
10
|
+
class HMac {
|
|
11
|
+
constructor(algorithm, key = '') {
|
|
12
|
+
this.plainText = '';
|
|
13
|
+
this.algorithm = algorithm;
|
|
14
|
+
this.key = key;
|
|
15
|
+
}
|
|
16
|
+
update(plainText, encoding) {
|
|
17
|
+
this.plainText = plainText;
|
|
18
|
+
return this;
|
|
19
|
+
}
|
|
20
|
+
digest(encoding) {
|
|
21
|
+
if (this.algorithm === 'sha256' || encoding !== 'hex') {
|
|
22
|
+
const { message, key } = { message: this.plainText, key: this.key };
|
|
23
|
+
return (0, hmac_sha256_1.default)(message, key).toString(enc_hex_1.default);
|
|
24
|
+
}
|
|
25
|
+
throw new Error(`algorithm and encoding pair not supported ${String(this.algorithm)} ${String(encoding)}`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const createHmac = (algorithm, key, options) => {
|
|
29
|
+
return new HMac(algorithm, key);
|
|
30
|
+
};
|
|
31
|
+
exports.createHmac = createHmac;
|
|
32
|
+
const randomBytes = (size) => {
|
|
33
|
+
let randomBytes = new Uint8Array(size).fill(255);
|
|
34
|
+
randomBytes = randomBytes.map(val => val * Math.random());
|
|
35
|
+
return buffer_1.Buffer.from(randomBytes);
|
|
36
|
+
};
|
|
37
|
+
exports.randomBytes = randomBytes;
|
|
38
|
+
exports.default = {
|
|
39
|
+
createHmac: exports.createHmac,
|
|
40
|
+
randomBytes: exports.randomBytes
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=crypto_polyfill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto_polyfill.js","sourceRoot":"","sources":["../../src/crypto_polyfill.ts"],"names":[],"mappings":";;;;;;AAAA,wEAA8C;AAC9C,gEAAmC;AACnC,mCAA+B;AAK/B,MAAM,IAAI;IAIR,YAAa,SAAoB,EAAE,MAAW,EAAE;QADhD,cAAS,GAAG,EAAE,CAAA;QAEZ,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;QAC1B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;IAChB,CAAC;IAED,MAAM,CAAE,SAAiB,EAAE,QAAiB;QAC1C,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;QAC1B,OAAO,IAAI,CAAA;IACb,CAAC;IAED,MAAM,CAAE,QAAkB;QACxB,IAAI,IAAI,CAAC,SAAS,KAAK,QAAQ,IAAI,QAAQ,KAAK,KAAK,EAAE;YACrD,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAA;YACnE,OAAO,IAAA,qBAAU,EAAC,OAAO,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,iBAAG,CAAC,CAAA;SAC9C;QACD,MAAM,IAAI,KAAK,CAAC,6CAA6C,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;IAC5G,CAAC;CACF;AAEM,MAAM,UAAU,GAAG,CAAC,SAAoB,EAAE,GAAQ,EAAE,OAAa,EAAO,EAAE;IAC/E,OAAO,IAAI,IAAI,CAAC,SAAS,EAAE,GAAG,CAAC,CAAA;AACjC,CAAC,CAAA;AAFY,QAAA,UAAU,cAEtB;AACM,MAAM,WAAW,GAAG,CAAC,IAAY,EAAU,EAAE;IAClD,IAAI,WAAW,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAChD,WAAW,GAAG,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,CAAA;IACzD,OAAO,eAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;AACjC,CAAC,CAAA;AAJY,QAAA,WAAW,eAIvB;AAED,kBAAe;IACb,UAAU,EAAV,kBAAU;IACV,WAAW,EAAX,mBAAW;CACZ,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import Akamai from './Akamai';
|
|
2
|
+
export { AkamaiConstructorArgs, AkamaiMitigateResponse } from './Akamai';
|
|
3
|
+
export { NetaceaMitigationType, InjectResponse } from '@netacea/netaceaintegrationbase';
|
|
4
|
+
export { createHmac, randomBytes } from './crypto_polyfill';
|
|
5
|
+
export default Akamai;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.randomBytes = exports.createHmac = exports.NetaceaMitigationType = void 0;
|
|
7
|
+
const Akamai_1 = __importDefault(require("./Akamai"));
|
|
8
|
+
var netaceaintegrationbase_1 = require("@netacea/netaceaintegrationbase");
|
|
9
|
+
Object.defineProperty(exports, "NetaceaMitigationType", { enumerable: true, get: function () { return netaceaintegrationbase_1.NetaceaMitigationType; } });
|
|
10
|
+
var crypto_polyfill_1 = require("./crypto_polyfill");
|
|
11
|
+
Object.defineProperty(exports, "createHmac", { enumerable: true, get: function () { return crypto_polyfill_1.createHmac; } });
|
|
12
|
+
Object.defineProperty(exports, "randomBytes", { enumerable: true, get: function () { return crypto_polyfill_1.randomBytes; } });
|
|
13
|
+
exports.default = Akamai_1.default;
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA6B;AAE7B,0EAAuF;AAA9E,+HAAA,qBAAqB,OAAA;AAC9B,qDAA2D;AAAlD,6GAAA,UAAU,OAAA;AAAE,8GAAA,WAAW,OAAA;AAChC,kBAAe,gBAAM,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@netacea/akamai",
|
|
3
|
+
"version": "1.3.9",
|
|
4
|
+
"description": "Netacea Akamai CDN Integration",
|
|
5
|
+
"main": "dist/src/index.js",
|
|
6
|
+
"types": "dist/src/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"test": "npm run test:unit && npm run test:integration",
|
|
9
|
+
"test:integration": "npx nyc -r=html -r=text tape -r ts-node/register -r tsconfig-paths/register './tests/*.test.ts'",
|
|
10
|
+
"test:unit": "npx nyc -r=html -r=text tape -r ts-node/register -r tsconfig-paths/register './unit_tests/*.test.ts'",
|
|
11
|
+
"test:regression": "npx nyc -r=html -r=text tape -r ts-node/register -r tsconfig-paths/register './regression_tests/*.test.ts'",
|
|
12
|
+
"lint": "npx eslint . --ext ts",
|
|
13
|
+
"lint:fix": "npx eslint . --ext ts --fix",
|
|
14
|
+
"prepublishOnly": "npx tsc --project tsconfig.build.json"
|
|
15
|
+
},
|
|
16
|
+
"author": "Kyle Doidge <kyle.doidge@netacea.com> (https://netacea.com)",
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public"
|
|
19
|
+
},
|
|
20
|
+
"license": "ISC",
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@netacea/netaceaintegrationbase": "^1.10.3",
|
|
23
|
+
"@netacea/netaceaintegrationtestrunner": "^1.5.5",
|
|
24
|
+
"buffer": "^6.0.3",
|
|
25
|
+
"crypto-js": "^4.1.1",
|
|
26
|
+
"http-request": "^0.7.0"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@rollup/plugin-commonjs": "^21.0.0",
|
|
30
|
+
"@rollup/plugin-node-resolve": "^13.0.5",
|
|
31
|
+
"@rollup/plugin-typescript": "^8.2.5",
|
|
32
|
+
"@types/akamai-edgeworkers": "^1.0.3",
|
|
33
|
+
"@types/aws4": "^1.11.0",
|
|
34
|
+
"@types/crypto-js": "^4.0.2",
|
|
35
|
+
"@types/node": "^14.17.29",
|
|
36
|
+
"@types/node-fetch": "^2.5.7",
|
|
37
|
+
"@types/proxyquire": "^1.3.28",
|
|
38
|
+
"@types/sinon": "^9.0.8",
|
|
39
|
+
"@types/tape": "^4.13.0",
|
|
40
|
+
"@typescript-eslint/eslint-plugin": "^2.25.0",
|
|
41
|
+
"@typescript-eslint/parser": "^2.25.0",
|
|
42
|
+
"aws4": "^1.11.0",
|
|
43
|
+
"axios": "^0.27.2",
|
|
44
|
+
"eslint": "^6.8.0",
|
|
45
|
+
"eslint-config-standard-with-typescript": "^15.0.1",
|
|
46
|
+
"eslint-plugin-import": "^2.20.2",
|
|
47
|
+
"eslint-plugin-node": "^11.1.0",
|
|
48
|
+
"eslint-plugin-promise": "^4.2.1",
|
|
49
|
+
"eslint-plugin-standard": "^4.0.1",
|
|
50
|
+
"eslint-plugin-typescript": "^0.14.0",
|
|
51
|
+
"fetch": "^1.1.0",
|
|
52
|
+
"form-data": "^4.0.0",
|
|
53
|
+
"http-status-codes": "^2.2.0",
|
|
54
|
+
"json2csv": "^5.0.7",
|
|
55
|
+
"node-fetch": "^2.6.1",
|
|
56
|
+
"nyc": "^15.1.0",
|
|
57
|
+
"proxyquire": "^2.1.3",
|
|
58
|
+
"rollup": "^2.32.1",
|
|
59
|
+
"sinon": "^9.1.0",
|
|
60
|
+
"tape": "^5.0.1",
|
|
61
|
+
"ts-node": "^9.0.0",
|
|
62
|
+
"tsconfig-paths": "^3.9.0",
|
|
63
|
+
"tslib": "^2.0.3",
|
|
64
|
+
"typescript": "^4.0.3"
|
|
65
|
+
},
|
|
66
|
+
"gitHead": "ebcc9dba0491df6bb7ae91dc2a093988ef9c6247"
|
|
67
|
+
}
|