perimeterx-js-core 0.18.2 → 0.20.0
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/lib/cjs/additional_activity_handler/AdditionalActivityHandlerUtils.js +1 -1
- package/lib/cjs/blocker/utils.js +1 -3
- package/lib/cjs/config/ConfigurationBase.js +112 -91
- package/lib/cjs/config/ConfigurationBuilderBase.js +8 -7
- package/lib/cjs/config/defaults/DefaultCommonConfigurationParams.js +3 -1
- package/lib/cjs/config/defaults/DefaultStaticConfigurationParams.js +0 -1
- package/lib/cjs/config/remote_config/DefaultRemoteConfigUpdater.js +1 -1
- package/lib/cjs/config/remote_config/RemoteConfigUtils.js +1 -1
- package/lib/cjs/context/DefaultContext.js +4 -1
- package/lib/cjs/custom_parameters/CustomParametersUtils.js +1 -1
- package/lib/cjs/graphql/DefaultGraphQLParser.js +155 -30
- package/lib/cjs/graphql/ExtractGraphQLKeywordsFunction.js +2 -0
- package/lib/cjs/graphql/index.js +1 -0
- package/lib/cjs/telemetry/DefaultTelemetry.js +14 -4
- package/lib/cjs/utils/constants.js +1 -1
- package/lib/cjs/utils/utils.js +25 -1
- package/lib/esm/additional_activity_handler/AdditionalActivityHandlerUtils.js +1 -1
- package/lib/esm/blocker/utils.js +1 -2
- package/lib/esm/config/ConfigurationBase.js +106 -91
- package/lib/esm/config/ConfigurationBuilderBase.js +7 -6
- package/lib/esm/config/defaults/DefaultCommonConfigurationParams.js +3 -1
- package/lib/esm/config/defaults/DefaultStaticConfigurationParams.js +0 -1
- package/lib/esm/config/remote_config/DefaultRemoteConfigUpdater.js +1 -1
- package/lib/esm/config/remote_config/RemoteConfigUtils.js +1 -1
- package/lib/esm/context/DefaultContext.js +5 -2
- package/lib/esm/custom_parameters/CustomParametersUtils.js +1 -1
- package/lib/esm/graphql/DefaultGraphQLParser.js +109 -25
- package/lib/esm/graphql/ExtractGraphQLKeywordsFunction.js +1 -0
- package/lib/esm/graphql/index.js +1 -0
- package/lib/esm/telemetry/DefaultTelemetry.js +15 -5
- package/lib/esm/utils/constants.js +1 -1
- package/lib/esm/utils/utils.js +23 -0
- package/lib/types/activities/utils.d.ts +60 -30
- package/lib/types/blocker/utils.d.ts +6 -3
- package/lib/types/config/ConfigurationBase.d.ts +12 -4
- package/lib/types/config/IConfiguration.d.ts +28 -8
- package/lib/types/config/params/CommonConfigurationParams.d.ts +4 -1
- package/lib/types/config/params/StaticConfigurationParams.d.ts +0 -1
- package/lib/types/graphql/DefaultGraphQLParser.d.ts +20 -11
- package/lib/types/graphql/ExtractGraphQLKeywordsFunction.d.ts +1 -0
- package/lib/types/graphql/index.d.ts +1 -0
- package/lib/types/graphql/model/GraphQLData.d.ts +2 -1
- package/lib/types/monitored_request/MonitoredRequestUtils.d.ts +18 -9
- package/lib/types/pxhd/PXHDUtils.d.ts +12 -6
- package/lib/types/sensitive_request/SensitiveRequestUtils.d.ts +12 -6
- package/lib/types/telemetry/model/TelemetryActivity.d.ts +7 -2
- package/lib/types/utils/constants.d.ts +1 -1
- package/lib/types/utils/utils.d.ts +1 -0
- package/package.json +1 -1
|
@@ -2,14 +2,16 @@ import { DEFAULT_CONFIGURATION_PARAMS } from './defaults';
|
|
|
2
2
|
import { LoggerSeverity, DefaultLogger } from '../logger';
|
|
3
3
|
import { ModuleMode, getScoreApiDomain, getCollectorDomain, isValidEnumValue, EnforcerError, CORE_MODULE_VERSION, } from '../utils';
|
|
4
4
|
export class ConfigurationBase {
|
|
5
|
-
|
|
5
|
+
activeConfigParams;
|
|
6
|
+
staticConfigParams;
|
|
7
|
+
remoteConfigParams;
|
|
8
|
+
defaultConfigParams;
|
|
6
9
|
internalLogger;
|
|
7
10
|
constructor(params, defaultParams) {
|
|
8
|
-
this.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
this.internalLogger = this.createInternalLogger(this.configParams.px_logger_severity);
|
|
11
|
+
this.defaultConfigParams = { ...DEFAULT_CONFIGURATION_PARAMS, ...defaultParams };
|
|
12
|
+
this.activeConfigParams = this.initialize(params, this.defaultConfigParams);
|
|
13
|
+
this.staticConfigParams = params;
|
|
14
|
+
this.internalLogger = this.createInternalLogger(this.activeConfigParams.px_logger_severity);
|
|
13
15
|
}
|
|
14
16
|
initialize(params, defaultParams) {
|
|
15
17
|
this.throwIfMissingRequiredField(params);
|
|
@@ -64,8 +66,18 @@ export class ConfigurationBase {
|
|
|
64
66
|
createInternalLogger(loggerSeverity) {
|
|
65
67
|
return new DefaultLogger(loggerSeverity, false);
|
|
66
68
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
addRemoteConfig(remoteConfigParams) {
|
|
70
|
+
this.remoteConfigParams = remoteConfigParams;
|
|
71
|
+
this.activeConfigParams = this.initialize({ ...this.staticConfigParams, ...remoteConfigParams }, this.defaultConfigParams);
|
|
72
|
+
}
|
|
73
|
+
getActiveConfig() {
|
|
74
|
+
return Object.assign({}, this.activeConfigParams);
|
|
75
|
+
}
|
|
76
|
+
getStaticConfig() {
|
|
77
|
+
return Object.assign({}, this.staticConfigParams);
|
|
78
|
+
}
|
|
79
|
+
getRemoteConfig() {
|
|
80
|
+
return Object.assign({}, this.remoteConfigParams);
|
|
69
81
|
}
|
|
70
82
|
get moduleVersion() {
|
|
71
83
|
return `${this.getModuleVersion()} (${CORE_MODULE_VERSION})`;
|
|
@@ -74,252 +86,255 @@ export class ConfigurationBase {
|
|
|
74
86
|
return this.internalLogger;
|
|
75
87
|
}
|
|
76
88
|
get appId() {
|
|
77
|
-
return this.
|
|
89
|
+
return this.activeConfigParams.px_app_id;
|
|
78
90
|
}
|
|
79
91
|
get authToken() {
|
|
80
|
-
return this.
|
|
92
|
+
return this.activeConfigParams.px_auth_token;
|
|
81
93
|
}
|
|
82
94
|
get blockingScore() {
|
|
83
|
-
return this.
|
|
95
|
+
return this.activeConfigParams.px_blocking_score;
|
|
84
96
|
}
|
|
85
97
|
get bypassMonitorHeader() {
|
|
86
|
-
return this.
|
|
98
|
+
return this.activeConfigParams.px_bypass_monitor_header;
|
|
87
99
|
}
|
|
88
100
|
get cookieSecret() {
|
|
89
|
-
return this.
|
|
101
|
+
return this.activeConfigParams.px_cookie_secret;
|
|
90
102
|
}
|
|
91
103
|
get customCookieHeader() {
|
|
92
|
-
return this.
|
|
104
|
+
return this.activeConfigParams.px_custom_cookie_header;
|
|
93
105
|
}
|
|
94
106
|
get customLogo() {
|
|
95
|
-
return this.
|
|
107
|
+
return this.activeConfigParams.px_custom_logo;
|
|
96
108
|
}
|
|
97
109
|
get enforcedRoutes() {
|
|
98
|
-
return this.
|
|
110
|
+
return this.activeConfigParams.px_enforced_routes;
|
|
99
111
|
}
|
|
100
112
|
get customIsEnforcedRequest() {
|
|
101
|
-
return this.
|
|
113
|
+
return this.activeConfigParams.px_custom_is_enforced_request;
|
|
102
114
|
}
|
|
103
115
|
get filteredExtensions() {
|
|
104
|
-
return this.
|
|
116
|
+
return this.activeConfigParams.px_filter_by_extension.map((ext) => ext.startsWith('.') ? ext : `.${ext}`);
|
|
105
117
|
}
|
|
106
118
|
get filteredHttpMethods() {
|
|
107
|
-
return this.
|
|
119
|
+
return this.activeConfigParams.px_filter_by_http_method;
|
|
108
120
|
}
|
|
109
121
|
get filteredIps() {
|
|
110
|
-
return this.
|
|
122
|
+
return this.activeConfigParams.px_filter_by_ip;
|
|
111
123
|
}
|
|
112
124
|
get filteredRoutes() {
|
|
113
|
-
return this.
|
|
125
|
+
return this.activeConfigParams.px_filter_by_route;
|
|
114
126
|
}
|
|
115
127
|
get filteredUserAgents() {
|
|
116
|
-
return this.
|
|
128
|
+
return this.activeConfigParams.px_filter_by_user_agent;
|
|
117
129
|
}
|
|
118
130
|
get firstPartyEnabled() {
|
|
119
|
-
return this.
|
|
131
|
+
return this.activeConfigParams.px_first_party_enabled;
|
|
120
132
|
}
|
|
121
133
|
get customIsFilteredRequest() {
|
|
122
|
-
return this.
|
|
134
|
+
return this.activeConfigParams.px_custom_is_filtered_request;
|
|
123
135
|
}
|
|
124
136
|
get customFirstPartyPrefix() {
|
|
125
|
-
return this.
|
|
137
|
+
return this.activeConfigParams.px_custom_first_party_prefix;
|
|
126
138
|
}
|
|
127
139
|
get customFirstPartySensorEndpoint() {
|
|
128
|
-
return this.
|
|
140
|
+
return this.activeConfigParams.px_custom_first_party_sensor_endpoint;
|
|
129
141
|
}
|
|
130
142
|
get customFirstPartyXhrEndpoint() {
|
|
131
|
-
return this.
|
|
143
|
+
return this.activeConfigParams.px_custom_first_party_xhr_endpoint;
|
|
132
144
|
}
|
|
133
145
|
get customFirstPartyCaptchaEndpoint() {
|
|
134
|
-
return this.
|
|
146
|
+
return this.activeConfigParams.px_custom_first_party_captcha_endpoint;
|
|
135
147
|
}
|
|
136
148
|
get firstPartyTimeoutMs() {
|
|
137
|
-
return this.
|
|
149
|
+
return this.activeConfigParams.px_first_party_timeout_ms;
|
|
138
150
|
}
|
|
139
151
|
get loggerSeverity() {
|
|
140
152
|
return this.logger.getLoggerSeverity();
|
|
141
153
|
}
|
|
142
154
|
get moduleEnabled() {
|
|
143
|
-
return this.
|
|
155
|
+
return this.activeConfigParams.px_module_enabled;
|
|
144
156
|
}
|
|
145
157
|
get moduleMode() {
|
|
146
|
-
return this.
|
|
158
|
+
return this.activeConfigParams.px_module_mode;
|
|
147
159
|
}
|
|
148
160
|
get monitoredRoutes() {
|
|
149
|
-
return this.
|
|
161
|
+
return this.activeConfigParams.px_monitored_routes;
|
|
150
162
|
}
|
|
151
163
|
get customIsMonitoredRequest() {
|
|
152
|
-
return this.
|
|
164
|
+
return this.activeConfigParams.px_custom_is_monitored_request;
|
|
153
165
|
}
|
|
154
166
|
get s2sTimeout() {
|
|
155
|
-
return this.
|
|
167
|
+
return this.activeConfigParams.px_s2s_timeout;
|
|
156
168
|
}
|
|
157
169
|
get sensitiveHeaders() {
|
|
158
|
-
return this.
|
|
170
|
+
return this.activeConfigParams.px_sensitive_headers;
|
|
159
171
|
}
|
|
160
172
|
get sensitiveRoutes() {
|
|
161
|
-
return this.
|
|
173
|
+
return this.activeConfigParams.px_sensitive_routes;
|
|
162
174
|
}
|
|
163
175
|
get customIsSensitiveRequest() {
|
|
164
|
-
return this.
|
|
176
|
+
return this.activeConfigParams.px_custom_is_sensitive_request;
|
|
165
177
|
}
|
|
166
178
|
get advancedBlockingResponseEnabled() {
|
|
167
|
-
return this.
|
|
179
|
+
return this.activeConfigParams.px_advanced_blocking_response_enabled;
|
|
168
180
|
}
|
|
169
181
|
get backendScoreApiUrl() {
|
|
170
|
-
return this.
|
|
182
|
+
return this.activeConfigParams.px_backend_url;
|
|
171
183
|
}
|
|
172
184
|
get ipHeaders() {
|
|
173
|
-
return this.
|
|
185
|
+
return this.activeConfigParams.px_ip_headers;
|
|
174
186
|
}
|
|
175
187
|
get backendCaptchaUrl() {
|
|
176
|
-
return this.
|
|
188
|
+
return this.activeConfigParams.px_backend_captcha_url;
|
|
177
189
|
}
|
|
178
190
|
get backendClientUrl() {
|
|
179
|
-
return this.
|
|
191
|
+
return this.activeConfigParams.px_backend_client_url;
|
|
180
192
|
}
|
|
181
193
|
get backendCollectorUrl() {
|
|
182
|
-
return this.
|
|
194
|
+
return this.activeConfigParams.px_backend_collector_url;
|
|
183
195
|
}
|
|
184
196
|
get cssRef() {
|
|
185
|
-
return this.
|
|
197
|
+
return this.activeConfigParams.px_css_ref;
|
|
186
198
|
}
|
|
187
199
|
get jsRef() {
|
|
188
|
-
return this.
|
|
200
|
+
return this.activeConfigParams.px_js_ref;
|
|
189
201
|
}
|
|
190
202
|
get riskCookieMaxIterations() {
|
|
191
|
-
return this.
|
|
203
|
+
return this.activeConfigParams.px_risk_cookie_max_iterations;
|
|
192
204
|
}
|
|
193
205
|
get riskCookieMinIterations() {
|
|
194
|
-
return this.
|
|
206
|
+
return this.activeConfigParams.px_risk_cookie_min_iterations;
|
|
195
207
|
}
|
|
196
208
|
get riskCookieMaxLength() {
|
|
197
|
-
return this.
|
|
209
|
+
return this.activeConfigParams.px_risk_cookie_max_length;
|
|
198
210
|
}
|
|
199
211
|
get userAgentMaxLength() {
|
|
200
|
-
return this.
|
|
212
|
+
return this.activeConfigParams.px_user_agent_max_length;
|
|
201
213
|
}
|
|
202
214
|
get maxActivityBatchSize() {
|
|
203
|
-
return this.
|
|
215
|
+
return this.activeConfigParams.px_max_activity_batch_size;
|
|
204
216
|
}
|
|
205
217
|
get activityBatchTimeoutMs() {
|
|
206
|
-
return this.
|
|
218
|
+
return this.activeConfigParams.px_batch_activities_timeout_ms;
|
|
207
219
|
}
|
|
208
220
|
get graphqlEnabled() {
|
|
209
|
-
return this.
|
|
221
|
+
return this.activeConfigParams.px_graphql_enabled;
|
|
210
222
|
}
|
|
211
223
|
get graphqlRoutes() {
|
|
212
|
-
return this.
|
|
224
|
+
return this.activeConfigParams.px_graphql_routes;
|
|
225
|
+
}
|
|
226
|
+
get graphqlKeywords() {
|
|
227
|
+
return this.activeConfigParams.px_graphql_keywords;
|
|
228
|
+
}
|
|
229
|
+
get extractGraphQLKeywords() {
|
|
230
|
+
return this.activeConfigParams.px_extract_graphql_keywords;
|
|
213
231
|
}
|
|
214
232
|
get sensitiveGraphqlOperationNames() {
|
|
215
|
-
return this.
|
|
233
|
+
return this.activeConfigParams.px_sensitive_graphql_operation_names;
|
|
216
234
|
}
|
|
217
235
|
get sensitiveGraphqlOperationTypes() {
|
|
218
|
-
return this.
|
|
236
|
+
return this.activeConfigParams.px_sensitive_graphql_operation_types;
|
|
219
237
|
}
|
|
220
238
|
get enrichCustomParameters() {
|
|
221
|
-
return this.
|
|
239
|
+
return this.activeConfigParams.px_enrich_custom_parameters || null;
|
|
222
240
|
}
|
|
223
241
|
get additionalActivityHandler() {
|
|
224
|
-
return this.
|
|
242
|
+
return this.activeConfigParams.px_additional_activity_handler || null;
|
|
225
243
|
}
|
|
226
244
|
get altBackendCaptchaUrl() {
|
|
227
245
|
return 'https://captcha.px-cloud.net';
|
|
228
246
|
}
|
|
229
247
|
get corsSupportEnabled() {
|
|
230
|
-
return this.
|
|
248
|
+
return this.activeConfigParams.px_cors_support_enabled;
|
|
231
249
|
}
|
|
232
250
|
get corsCustomPreflightHandler() {
|
|
233
|
-
return this.
|
|
251
|
+
return this.activeConfigParams.px_cors_custom_preflight_handler || null;
|
|
234
252
|
}
|
|
235
253
|
get corsPreflightRequestFilterEnabled() {
|
|
236
|
-
return this.
|
|
254
|
+
return this.activeConfigParams.px_cors_preflight_request_filter_enabled;
|
|
237
255
|
}
|
|
238
256
|
get corsCreateCustomBlockResponseHeaders() {
|
|
239
|
-
return this.
|
|
257
|
+
return this.activeConfigParams.px_cors_create_custom_block_response_headers || null;
|
|
240
258
|
}
|
|
241
259
|
get jwtCookieAdditionalFieldNames() {
|
|
242
|
-
return this.
|
|
260
|
+
return this.activeConfigParams.px_jwt_cookie_additional_field_names;
|
|
243
261
|
}
|
|
244
262
|
get jwtCookieName() {
|
|
245
|
-
return this.
|
|
263
|
+
return this.activeConfigParams.px_jwt_cookie_name;
|
|
246
264
|
}
|
|
247
265
|
get jwtCookieUserIdFieldName() {
|
|
248
|
-
return this.
|
|
266
|
+
return this.activeConfigParams.px_jwt_cookie_user_id_field_name;
|
|
249
267
|
}
|
|
250
268
|
get jwtHeaderAdditionalFieldNames() {
|
|
251
|
-
return this.
|
|
269
|
+
return this.activeConfigParams.px_jwt_header_additional_field_names;
|
|
252
270
|
}
|
|
253
271
|
get jwtHeaderName() {
|
|
254
|
-
return this.
|
|
272
|
+
return this.activeConfigParams.px_jwt_header_name;
|
|
255
273
|
}
|
|
256
274
|
get jwtHeaderUserIdFieldName() {
|
|
257
|
-
return this.
|
|
275
|
+
return this.activeConfigParams.px_jwt_header_user_id_field_name;
|
|
258
276
|
}
|
|
259
277
|
get ciEnabled() {
|
|
260
|
-
return this.
|
|
278
|
+
return this.activeConfigParams.px_login_credentials_extraction_enabled;
|
|
261
279
|
}
|
|
262
280
|
get loggerAuthToken() {
|
|
263
|
-
return this.
|
|
281
|
+
return this.activeConfigParams.px_logger_auth_token;
|
|
264
282
|
}
|
|
265
283
|
get ciEndpoints() {
|
|
266
|
-
return this.
|
|
284
|
+
return this.activeConfigParams.px_login_credentials_extraction;
|
|
267
285
|
}
|
|
268
286
|
get ciCompromisedCredentialsHeaderName() {
|
|
269
|
-
return this.
|
|
287
|
+
return this.activeConfigParams.px_compromised_credentials_header;
|
|
270
288
|
}
|
|
271
289
|
get ciSendRawUsernameOnAdditionalS2SActivity() {
|
|
272
|
-
return this.
|
|
290
|
+
return this.activeConfigParams.px_send_raw_username_on_additional_s2s_activity;
|
|
273
291
|
}
|
|
274
292
|
get ciAutomaticAdditionalS2SEnabled() {
|
|
275
|
-
return this.
|
|
293
|
+
return this.activeConfigParams.px_automatic_additional_s2s_activity_enabled;
|
|
276
294
|
}
|
|
277
295
|
get ciAdditionalS2SHeaderEnabled() {
|
|
278
|
-
return this.
|
|
296
|
+
return this.activeConfigParams.px_additional_s2s_activity_header_enabled;
|
|
279
297
|
}
|
|
280
298
|
get ciDefaultVersion() {
|
|
281
|
-
return this.
|
|
299
|
+
return this.activeConfigParams.px_credentials_intelligence_version;
|
|
282
300
|
}
|
|
283
301
|
get ciDefaultLoginSuccessfulReportingMethod() {
|
|
284
|
-
return this.
|
|
302
|
+
return this.activeConfigParams.px_login_successful_reporting_method;
|
|
285
303
|
}
|
|
286
304
|
get ciDefaultLoginSuccessfulStatus() {
|
|
287
|
-
return this.
|
|
305
|
+
return this.activeConfigParams.px_login_successful_status;
|
|
288
306
|
}
|
|
289
307
|
get ciDefaultLoginSuccessfulBodyRegex() {
|
|
290
|
-
return this.
|
|
308
|
+
return this.activeConfigParams.px_login_successful_body_regex;
|
|
291
309
|
}
|
|
292
310
|
get ciDefaultLoginSuccessfulHeaderName() {
|
|
293
|
-
return this.
|
|
311
|
+
return this.activeConfigParams.px_login_successful_header_name;
|
|
294
312
|
}
|
|
295
313
|
get ciDefaultLoginSuccessfulHeaderValue() {
|
|
296
|
-
return this.
|
|
314
|
+
return this.activeConfigParams.px_login_successful_header_value;
|
|
297
315
|
}
|
|
298
316
|
get ciDefaultLoginSuccessfulCustomCallback() {
|
|
299
|
-
return this.
|
|
317
|
+
return this.activeConfigParams.px_login_successful_custom_callback;
|
|
300
318
|
}
|
|
301
319
|
get remoteConfigAuthToken() {
|
|
302
|
-
return this.
|
|
303
|
-
}
|
|
304
|
-
get remoteConfigSecret() {
|
|
305
|
-
return this.configParams.px_remote_config_secret;
|
|
320
|
+
return this.activeConfigParams.px_remote_config_auth_token;
|
|
306
321
|
}
|
|
307
322
|
get remoteConfigVersion() {
|
|
308
|
-
return this.
|
|
323
|
+
return this.activeConfigParams.px_remote_config_version;
|
|
309
324
|
}
|
|
310
325
|
get remoteConfigId() {
|
|
311
|
-
return this.
|
|
326
|
+
return this.activeConfigParams.px_remote_config_id;
|
|
312
327
|
}
|
|
313
328
|
get remoteConfigRetryIntervalMs() {
|
|
314
|
-
return this.
|
|
329
|
+
return this.activeConfigParams.px_remote_config_retry_interval_ms;
|
|
315
330
|
}
|
|
316
331
|
get remoteConfigMaxFetchAttempts() {
|
|
317
|
-
return this.
|
|
332
|
+
return this.activeConfigParams.px_remote_config_max_fetch_attempts;
|
|
318
333
|
}
|
|
319
334
|
get urlDecodeReservedCharacters() {
|
|
320
|
-
return this.
|
|
335
|
+
return this.activeConfigParams.px_url_decode_reserved_characters;
|
|
321
336
|
}
|
|
322
337
|
get securedPxhdEnabled() {
|
|
323
|
-
return this.
|
|
338
|
+
return this.activeConfigParams.px_secured_pxhd_enabled;
|
|
324
339
|
}
|
|
325
340
|
}
|
|
@@ -4,15 +4,16 @@ export class ConfigurationBuilderBase {
|
|
|
4
4
|
this.base64Utils = base64Utils;
|
|
5
5
|
}
|
|
6
6
|
async build(params) {
|
|
7
|
-
const
|
|
8
|
-
if (!
|
|
9
|
-
return
|
|
7
|
+
const config = this.createConfiguration(params);
|
|
8
|
+
if (!config.remoteConfigAuthToken) {
|
|
9
|
+
return config;
|
|
10
10
|
}
|
|
11
|
-
const remoteConfigParams = await this.getRemoteConfigParams(
|
|
11
|
+
const remoteConfigParams = await this.getRemoteConfigParams(config);
|
|
12
12
|
if (!remoteConfigParams) {
|
|
13
|
-
return
|
|
13
|
+
return config;
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
config.addRemoteConfig(remoteConfigParams);
|
|
16
|
+
return config;
|
|
16
17
|
}
|
|
17
18
|
async getRemoteConfigParams(staticConfig) {
|
|
18
19
|
try {
|
|
@@ -16,7 +16,7 @@ export const DEFAULT_COMMON_CONFIGURATION_PARAMS = {
|
|
|
16
16
|
px_advanced_blocking_response_enabled: true,
|
|
17
17
|
px_max_activity_batch_size: 0,
|
|
18
18
|
px_batch_activities_timeout_ms: 1000,
|
|
19
|
-
px_bypass_monitor_header: '',
|
|
19
|
+
px_bypass_monitor_header: 'x-px-block',
|
|
20
20
|
px_enforced_routes: [],
|
|
21
21
|
px_first_party_enabled: true,
|
|
22
22
|
px_custom_first_party_prefix: '',
|
|
@@ -94,6 +94,7 @@ export const DEFAULT_COMMON_CONFIGURATION_PARAMS = {
|
|
|
94
94
|
px_custom_logo: '',
|
|
95
95
|
px_graphql_enabled: true,
|
|
96
96
|
px_graphql_routes: ['/graphql'],
|
|
97
|
+
px_graphql_keywords: [],
|
|
97
98
|
px_sensitive_graphql_operation_names: [],
|
|
98
99
|
px_sensitive_graphql_operation_types: [],
|
|
99
100
|
px_enrich_custom_parameters: null,
|
|
@@ -115,4 +116,5 @@ export const DEFAULT_COMMON_CONFIGURATION_PARAMS = {
|
|
|
115
116
|
px_custom_is_monitored_request: null,
|
|
116
117
|
px_custom_is_enforced_request: null,
|
|
117
118
|
px_custom_is_filtered_request: null,
|
|
119
|
+
px_extract_graphql_keywords: null,
|
|
118
120
|
};
|
|
@@ -11,7 +11,7 @@ export class DefaultRemoteConfigUpdater {
|
|
|
11
11
|
this.storageClient = options.storageClient;
|
|
12
12
|
this.timestampHmacHeaderValidator =
|
|
13
13
|
options.timestampHmacHeaderValidator ||
|
|
14
|
-
new DefaultTimestampHmacHeaderValidator(config, config.
|
|
14
|
+
new DefaultTimestampHmacHeaderValidator(config, config.remoteConfigAuthToken, options.base64Utils, options.hmacUtils);
|
|
15
15
|
}
|
|
16
16
|
isUpdateRemoteConfigRequest(context) {
|
|
17
17
|
return context.isRemoteConfigUpdateRequest;
|
|
@@ -3,7 +3,7 @@ import { PUSH_DATA_FEATURE_HEADER_NAME, PUSH_DATA_HMAC_HEADER_NAME } from '../..
|
|
|
3
3
|
import { REMOTE_CONFIG_PUSH_DATA_FEATURE_NAME } from './constants';
|
|
4
4
|
export var RemoteConfigUtils;
|
|
5
5
|
(function (RemoteConfigUtils) {
|
|
6
|
-
RemoteConfigUtils.isRemoteConfigUpdateRequest = (request) => request.method === HttpMethod.
|
|
6
|
+
RemoteConfigUtils.isRemoteConfigUpdateRequest = (request) => request.method === HttpMethod.POST &&
|
|
7
7
|
request.headers.get(PUSH_DATA_FEATURE_HEADER_NAME) === REMOTE_CONFIG_PUSH_DATA_FEATURE_NAME &&
|
|
8
8
|
!!request.headers.get(PUSH_DATA_HMAC_HEADER_NAME);
|
|
9
9
|
})(RemoteConfigUtils || (RemoteConfigUtils = {}));
|
|
@@ -4,7 +4,7 @@ import { PXHDSource } from '../pxhd';
|
|
|
4
4
|
import { TokenOrigin, TokenParseResult } from '../risk_token';
|
|
5
5
|
import { RiskApiCallResult } from '../risk_api';
|
|
6
6
|
import { COOKIE_HEADER_NAME, toReadonlyHeaders, USER_AGENT_HEADER_NAME, } from '../http';
|
|
7
|
-
import { StringSplitCookieParser, PXHD_COOKIE_NAME, PXVID_COOKIE_NAME, X_PX_AUTHORIZATION_HEADER_NAME, } from '../utils';
|
|
7
|
+
import { StringSplitCookieParser, PXHD_COOKIE_NAME, PXVID_COOKIE_NAME, X_PX_AUTHORIZATION_HEADER_NAME, isValidUuid, } from '../utils';
|
|
8
8
|
import { DefaultLogger, X_PX_ENFORCER_LOG_HEADER } from '../logger';
|
|
9
9
|
export class DefaultContext {
|
|
10
10
|
requestId;
|
|
@@ -125,7 +125,10 @@ export class DefaultContext {
|
|
|
125
125
|
return request.headers.get(X_PX_AUTHORIZATION_HEADER_NAME) ? TokenOrigin.HEADER : TokenOrigin.COOKIE;
|
|
126
126
|
}
|
|
127
127
|
setCookiesOnContext() {
|
|
128
|
-
|
|
128
|
+
const vidValue = this.requestData.cookies[PXVID_COOKIE_NAME];
|
|
129
|
+
if (isValidUuid(vidValue)) {
|
|
130
|
+
this.vid = vidValue;
|
|
131
|
+
}
|
|
129
132
|
const pxhdCookie = this.requestData.cookies[PXHD_COOKIE_NAME];
|
|
130
133
|
if (pxhdCookie) {
|
|
131
134
|
this.pxhd = {
|
|
@@ -4,7 +4,7 @@ export var CustomParametersUtils;
|
|
|
4
4
|
CustomParametersUtils.createCustomParameters = async (config, context) => {
|
|
5
5
|
if (config.enrichCustomParameters && typeof config.enrichCustomParameters === 'function') {
|
|
6
6
|
try {
|
|
7
|
-
const parameters = await config.enrichCustomParameters(config.
|
|
7
|
+
const parameters = await config.enrichCustomParameters(config.getActiveConfig(), context.requestData.request.getUnderlyingRequest());
|
|
8
8
|
return CustomParametersUtils.normalizeCustomParams(parameters);
|
|
9
9
|
}
|
|
10
10
|
catch (e) {
|