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.
Files changed (49) hide show
  1. package/lib/cjs/additional_activity_handler/AdditionalActivityHandlerUtils.js +1 -1
  2. package/lib/cjs/blocker/utils.js +1 -3
  3. package/lib/cjs/config/ConfigurationBase.js +112 -91
  4. package/lib/cjs/config/ConfigurationBuilderBase.js +8 -7
  5. package/lib/cjs/config/defaults/DefaultCommonConfigurationParams.js +3 -1
  6. package/lib/cjs/config/defaults/DefaultStaticConfigurationParams.js +0 -1
  7. package/lib/cjs/config/remote_config/DefaultRemoteConfigUpdater.js +1 -1
  8. package/lib/cjs/config/remote_config/RemoteConfigUtils.js +1 -1
  9. package/lib/cjs/context/DefaultContext.js +4 -1
  10. package/lib/cjs/custom_parameters/CustomParametersUtils.js +1 -1
  11. package/lib/cjs/graphql/DefaultGraphQLParser.js +155 -30
  12. package/lib/cjs/graphql/ExtractGraphQLKeywordsFunction.js +2 -0
  13. package/lib/cjs/graphql/index.js +1 -0
  14. package/lib/cjs/telemetry/DefaultTelemetry.js +14 -4
  15. package/lib/cjs/utils/constants.js +1 -1
  16. package/lib/cjs/utils/utils.js +25 -1
  17. package/lib/esm/additional_activity_handler/AdditionalActivityHandlerUtils.js +1 -1
  18. package/lib/esm/blocker/utils.js +1 -2
  19. package/lib/esm/config/ConfigurationBase.js +106 -91
  20. package/lib/esm/config/ConfigurationBuilderBase.js +7 -6
  21. package/lib/esm/config/defaults/DefaultCommonConfigurationParams.js +3 -1
  22. package/lib/esm/config/defaults/DefaultStaticConfigurationParams.js +0 -1
  23. package/lib/esm/config/remote_config/DefaultRemoteConfigUpdater.js +1 -1
  24. package/lib/esm/config/remote_config/RemoteConfigUtils.js +1 -1
  25. package/lib/esm/context/DefaultContext.js +5 -2
  26. package/lib/esm/custom_parameters/CustomParametersUtils.js +1 -1
  27. package/lib/esm/graphql/DefaultGraphQLParser.js +109 -25
  28. package/lib/esm/graphql/ExtractGraphQLKeywordsFunction.js +1 -0
  29. package/lib/esm/graphql/index.js +1 -0
  30. package/lib/esm/telemetry/DefaultTelemetry.js +15 -5
  31. package/lib/esm/utils/constants.js +1 -1
  32. package/lib/esm/utils/utils.js +23 -0
  33. package/lib/types/activities/utils.d.ts +60 -30
  34. package/lib/types/blocker/utils.d.ts +6 -3
  35. package/lib/types/config/ConfigurationBase.d.ts +12 -4
  36. package/lib/types/config/IConfiguration.d.ts +28 -8
  37. package/lib/types/config/params/CommonConfigurationParams.d.ts +4 -1
  38. package/lib/types/config/params/StaticConfigurationParams.d.ts +0 -1
  39. package/lib/types/graphql/DefaultGraphQLParser.d.ts +20 -11
  40. package/lib/types/graphql/ExtractGraphQLKeywordsFunction.d.ts +1 -0
  41. package/lib/types/graphql/index.d.ts +1 -0
  42. package/lib/types/graphql/model/GraphQLData.d.ts +2 -1
  43. package/lib/types/monitored_request/MonitoredRequestUtils.d.ts +18 -9
  44. package/lib/types/pxhd/PXHDUtils.d.ts +12 -6
  45. package/lib/types/sensitive_request/SensitiveRequestUtils.d.ts +12 -6
  46. package/lib/types/telemetry/model/TelemetryActivity.d.ts +7 -2
  47. package/lib/types/utils/constants.d.ts +1 -1
  48. package/lib/types/utils/utils.d.ts +1 -0
  49. package/package.json +1 -1
@@ -2,16 +2,17 @@ import { isRouteInPatterns } from '../utils';
2
2
  import { HttpMethod } from '../http';
3
3
  import { GraphQLOperationType } from './model';
4
4
  export class DefaultGraphQLParser {
5
- graphqlRoutes;
6
- sensitiveOperationTypes;
7
- sensitiveOperationNames;
5
+ config;
6
+ maxCharactersInGraphqlKeyword;
7
+ maxGraphqlKeywordCount;
8
8
  constructor(config) {
9
- this.graphqlRoutes = config.graphqlRoutes;
10
- this.sensitiveOperationNames = config.sensitiveGraphqlOperationNames;
11
- this.sensitiveOperationTypes = config.sensitiveGraphqlOperationTypes;
9
+ this.config = config;
10
+ this.maxCharactersInGraphqlKeyword = 100;
11
+ this.maxGraphqlKeywordCount = 500;
12
12
  }
13
13
  isGraphQLRequest({ requestData }) {
14
- return (requestData.method === HttpMethod.POST && isRouteInPatterns(requestData.url.pathname, this.graphqlRoutes));
14
+ return (requestData.method === HttpMethod.POST &&
15
+ isRouteInPatterns(requestData.url.pathname, this.config.graphqlRoutes));
15
16
  }
16
17
  async parseGraphQLRequest(context) {
17
18
  try {
@@ -21,7 +22,7 @@ export class DefaultGraphQLParser {
21
22
  context.logger.debug('unable to get graphql operations from request body');
22
23
  return null;
23
24
  }
24
- const data = this.parseGraphQLOperations(graphQLOperations);
25
+ const data = await this.parseGraphQLOperations(graphQLOperations, context);
25
26
  if (!data || data.length === 0) {
26
27
  context.logger.debug('unable to parse graphql operations');
27
28
  return null;
@@ -36,8 +37,9 @@ export class DefaultGraphQLParser {
36
37
  }
37
38
  async getGraphQLOperationsFromBody(request, context) {
38
39
  try {
39
- let body = await request.json();
40
+ const body = await request.json();
40
41
  if (!body) {
42
+ context.logger.debug(`received empty graphql body when calling .json()`);
41
43
  return null;
42
44
  }
43
45
  return Array.isArray(body) ? body : [body];
@@ -47,18 +49,21 @@ export class DefaultGraphQLParser {
47
49
  return null;
48
50
  }
49
51
  }
50
- parseGraphQLOperations(operations) {
51
- return operations.map((operation) => this.parseGraphQlOperation(operation)).filter((x) => x);
52
+ async parseGraphQLOperations(operations, context) {
53
+ const data = await Promise.all(operations.map((operation) => this.parseGraphQLOperation(operation, context)));
54
+ return data.filter(Boolean);
52
55
  }
53
- parseGraphQlOperation(operation) {
56
+ parseGraphQLOperation(operation, context) {
54
57
  if (!operation.query || typeof operation.query !== 'string') {
58
+ context.logger.debug('no query found');
55
59
  return null;
56
60
  }
57
61
  const operationNameToTypeMap = this.getOperationNameToTypeMap(operation.query);
58
62
  if (!operationNameToTypeMap) {
63
+ context.logger.debug('operationNameToTypeMap returned null');
59
64
  return null;
60
65
  }
61
- return this.getGraphQLData(operationNameToTypeMap, operation);
66
+ return this.getGraphQLData(operationNameToTypeMap, operation, context);
62
67
  }
63
68
  getOperationNameToTypeMap(query) {
64
69
  const operationTypesString = Object.values(GraphQLOperationType).join('|');
@@ -78,18 +83,21 @@ export class DefaultGraphQLParser {
78
83
  }
79
84
  return map;
80
85
  }
81
- getGraphQLData(operationNameToTypeMap, operation) {
82
- let name = operation.operationName ||
83
- (Object.keys(operationNameToTypeMap).length === 1 ? Object.keys(operationNameToTypeMap)[0] : undefined);
84
- let type = operationNameToTypeMap[name];
85
- if (!type && /^\s*{/.test(operation.query)) {
86
- type = GraphQLOperationType.QUERY;
87
- }
86
+ async getGraphQLData(operationNameToTypeMap, operation, context) {
87
+ const name = this.getOperationName(operationNameToTypeMap, operation);
88
+ const type = this.getOperationType(operation, name, operationNameToTypeMap);
88
89
  if (!type) {
89
90
  return null;
90
91
  }
91
- const data = { name, type };
92
- if (this.isSensitiveOperation(name, type)) {
92
+ const data = { type };
93
+ if (name) {
94
+ data.name = name;
95
+ }
96
+ const keywords = await this.getQueryKeywords(operation.query, context);
97
+ if (keywords) {
98
+ data.keywords = this.cleanKeywords(keywords);
99
+ }
100
+ if (this.isSensitiveOperation(name, type, keywords)) {
93
101
  data.sensitive = true;
94
102
  }
95
103
  if (operation.variables && typeof operation.variables === 'object') {
@@ -97,9 +105,76 @@ export class DefaultGraphQLParser {
97
105
  }
98
106
  return data;
99
107
  }
100
- isSensitiveOperation(operationName, operationType) {
101
- return (this.sensitiveOperationTypes.some((type) => type === operationType) ||
102
- this.sensitiveOperationNames.some((name) => name === operationName));
108
+ getOperationType(operation, operationName, operationNameToTypeMap) {
109
+ if (operationName && operationNameToTypeMap[operationName]) {
110
+ return operationNameToTypeMap[operationName];
111
+ }
112
+ if (this.isGraphqlQueryShorthand(operation.query)) {
113
+ return GraphQLOperationType.QUERY;
114
+ }
115
+ const match = operation.query.match(new RegExp(`^\\s*(${Object.values(GraphQLOperationType).join('|')})(?:\\s|{)`));
116
+ if (match?.[1] && !operationName) {
117
+ return match[1];
118
+ }
119
+ return null;
120
+ }
121
+ isGraphqlQueryShorthand(query) {
122
+ return /^\s*{/.test(query);
123
+ }
124
+ getOperationName(operationNameToTypeMap, operation) {
125
+ return (operation.operationName ||
126
+ (Object.keys(operationNameToTypeMap).length === 1 ? Object.keys(operationNameToTypeMap)[0] : undefined));
127
+ }
128
+ async getQueryKeywords(query, context) {
129
+ if (this.config.extractGraphQLKeywords && typeof this.config.extractGraphQLKeywords === 'function') {
130
+ const keywords = await this.getQueryKeywordsFromCustomFunction(query, context);
131
+ if (Array.isArray(keywords)) {
132
+ return keywords;
133
+ }
134
+ }
135
+ if (this.config.graphqlKeywords?.length > 0) {
136
+ return this.getQueryKeywordsFromArray(query, context);
137
+ }
138
+ return null;
139
+ }
140
+ cleanKeywords(keywords) {
141
+ return keywords
142
+ .slice(0, this.maxGraphqlKeywordCount)
143
+ .map((kw) => kw.trim().substring(0, this.maxCharactersInGraphqlKeyword));
144
+ }
145
+ async getQueryKeywordsFromCustomFunction(query, context) {
146
+ try {
147
+ return this.config.extractGraphQLKeywords(query);
148
+ }
149
+ catch (e) {
150
+ context.logger.debug(`unable to extract graphql keywords via custom function: ${e}`);
151
+ return null;
152
+ }
153
+ }
154
+ getQueryKeywordsFromArray(query, context) {
155
+ let keywords = [];
156
+ try {
157
+ this.config.graphqlKeywords.forEach((keyword) => {
158
+ const pattern = this.toGlobalRegExp(keyword);
159
+ let matchGroup = query.match(pattern);
160
+ if (!matchGroup) {
161
+ return;
162
+ }
163
+ keywords = keywords.concat(matchGroup);
164
+ });
165
+ }
166
+ catch (e) {
167
+ context.logger.debug(`unable to extract graphql keywords via array: ${e}`);
168
+ return null;
169
+ }
170
+ return keywords;
171
+ }
172
+ isSensitiveOperation(operationName, operationType, keywords) {
173
+ return (this.config.sensitiveGraphqlOperationTypes.some((type) => type === operationType) ||
174
+ this.config.sensitiveGraphqlOperationNames.some((name) => {
175
+ const pattern = this.toGlobalRegExp(name);
176
+ return pattern.test(operationName) || keywords?.some((kw) => pattern.test(kw));
177
+ }));
103
178
  }
104
179
  extractGraphQLVariableNames(variables) {
105
180
  const processVariables = (variablesObj, prefix) => Object.entries(variablesObj).reduce((total, [key, value]) => {
@@ -113,4 +188,13 @@ export class DefaultGraphQLParser {
113
188
  }, []);
114
189
  return processVariables(variables, '');
115
190
  }
191
+ toGlobalRegExp(pattern) {
192
+ if (typeof pattern === 'string') {
193
+ return new RegExp(pattern, 'g');
194
+ }
195
+ if (pattern.global) {
196
+ return pattern;
197
+ }
198
+ return new RegExp(pattern, pattern.flags + 'g');
199
+ }
116
200
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,4 @@
1
1
  export * from './model';
2
2
  export * from './IGraphQLParser';
3
3
  export * from './DefaultGraphQLParser';
4
+ export * from './ExtractGraphQLKeywordsFunction';
@@ -1,6 +1,6 @@
1
1
  import { AUTHORIZATION_HEADER_NAME, CONTENT_TYPE_HEADER_NAME, ContentType, HttpMethod, OutgoingRequestImpl, } from '../http';
2
2
  import { ActivityType } from '../activities';
3
- import { getAuthorizationHeader, removeSensitiveFields, transferExistingProperties, DefaultTimestampHmacHeaderValidator, } from '../utils';
3
+ import { getAuthorizationHeader, removeSensitiveFields, transferExistingProperties, DefaultTimestampHmacHeaderValidator, telemetryConfigReplacer, } from '../utils';
4
4
  import { TELEMETRY_ENDPOINT, TELEMETRY_HEADER_NAME, TELEMETRY_UPDATE_REASON } from './constants';
5
5
  export class DefaultTelemetry {
6
6
  config;
@@ -49,16 +49,26 @@ export class DefaultTelemetry {
49
49
  [AUTHORIZATION_HEADER_NAME]: [getAuthorizationHeader(this.config.authToken)],
50
50
  };
51
51
  const activity = this.createTelemetryActivity(context);
52
- return new OutgoingRequestImpl({ url: url, method: method, headers: headers, body: JSON.stringify(activity) });
52
+ context.logger.debug(`created telemetry activity config - ${JSON.stringify(activity.details.enforcer_configs, telemetryConfigReplacer)}`);
53
+ return new OutgoingRequestImpl({
54
+ url: url,
55
+ method: method,
56
+ headers: headers,
57
+ body: JSON.stringify(activity, telemetryConfigReplacer),
58
+ });
53
59
  }
54
60
  createTelemetryActivity(context) {
55
61
  const SENSITIVE_CONFIG_FIELDS = [
56
62
  'px_auth_token',
57
63
  'px_cookie_secret',
58
64
  'px_logger_auth_token',
65
+ 'px_remote_config_auth_token',
59
66
  ];
60
- let config = this.config.toParams();
61
- config = removeSensitiveFields(config, SENSITIVE_CONFIG_FIELDS);
67
+ const telemetryConfig = {
68
+ active_config: removeSensitiveFields(this.config.getActiveConfig(), SENSITIVE_CONFIG_FIELDS),
69
+ static_config: removeSensitiveFields(this.config.getStaticConfig(), SENSITIVE_CONFIG_FIELDS),
70
+ remote_config: removeSensitiveFields(this.config.getRemoteConfig(), SENSITIVE_CONFIG_FIELDS),
71
+ };
62
72
  const activity = {
63
73
  type: ActivityType.ENFORCER_TELEMETRY,
64
74
  timestamp: Date.now(),
@@ -66,7 +76,7 @@ export class DefaultTelemetry {
66
76
  details: {
67
77
  update_reason: TELEMETRY_UPDATE_REASON,
68
78
  module_version: this.config.moduleVersion,
69
- enforcer_configs: config,
79
+ enforcer_configs: telemetryConfig,
70
80
  },
71
81
  };
72
82
  transferExistingProperties(context.serverData, activity.details, {
@@ -10,4 +10,4 @@ export const PUSH_DATA_HMAC_HEADER_NAME = 'x-px-pushdata';
10
10
  export const PUSH_DATA_FEATURE_HEADER_NAME = 'x-px-feature';
11
11
  export const EMAIL_ADDRESS_REGEX = /^[a-zA-Z0-9_+&*-]+(?:\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,7}$/;
12
12
  export const URL_REGEX = /^(https?\:)\/\/(([^@\s:]+):?([^@\s]*)@)?(([^:\/?#]*)(?:\:([0-9]+))?)([\/]{0,1}[^?#]*)(\?[^#]*|)(#.*|)$/;
13
- export const CORE_MODULE_VERSION = 'JS Core 0.18.2';
13
+ export const CORE_MODULE_VERSION = 'JS Core 0.20.0';
@@ -115,3 +115,26 @@ export const algoToCryptoString = (algo) => {
115
115
  return 'sha256';
116
116
  }
117
117
  };
118
+ // Hash based on https://stackoverflow.com/questions/7616461/generate-a-hash-from-string-in-javascript
119
+ const toHash = (string) => {
120
+ let hash = 0;
121
+ if (string.length === 0) {
122
+ return hash.toString();
123
+ }
124
+ for (let i = 0; i < string.length; i++) {
125
+ const char = string.charCodeAt(i);
126
+ hash = (hash << 5) - hash + char;
127
+ hash = hash & hash;
128
+ }
129
+ return hash.toString();
130
+ };
131
+ export const telemetryConfigReplacer = (key, value) => {
132
+ if (value instanceof RegExp) {
133
+ return '_REGEXP ' + value.toString();
134
+ }
135
+ if (value instanceof Function) {
136
+ return '_FUNCTION_HASH' + toHash(value.toString()); // NOTE: Do not log functions
137
+ }
138
+ else
139
+ return value;
140
+ };
@@ -268,7 +268,8 @@ export declare const createAsyncActivity: <Req, Res>(activityType: ActivityType,
268
268
  readonly is_hype_sale?: boolean;
269
269
  };
270
270
  readonly graphqlData?: readonly {
271
- readonly type: import("..").GraphQLOperationType;
271
+ readonly type?: import("..").GraphQLOperationType;
272
+ readonly keywords?: readonly string[];
272
273
  readonly name?: string;
273
274
  readonly sensitive?: boolean;
274
275
  readonly variables?: readonly string[];
@@ -494,7 +495,8 @@ export declare const createAsyncActivity: <Req, Res>(activityType: ActivityType,
494
495
  readonly is_hype_sale?: boolean;
495
496
  };
496
497
  readonly graphqlData?: readonly {
497
- readonly type: import("..").GraphQLOperationType;
498
+ readonly type?: import("..").GraphQLOperationType;
499
+ readonly keywords?: readonly string[];
498
500
  readonly name?: string;
499
501
  readonly sensitive?: boolean;
500
502
  readonly variables?: readonly string[];
@@ -651,7 +653,8 @@ export declare const createAsyncActivity: <Req, Res>(activityType: ActivityType,
651
653
  readonly is_hype_sale?: boolean;
652
654
  };
653
655
  readonly graphqlData?: readonly {
654
- readonly type: import("..").GraphQLOperationType;
656
+ readonly type?: import("..").GraphQLOperationType;
657
+ readonly keywords?: readonly string[];
655
658
  readonly name?: string;
656
659
  readonly sensitive?: boolean;
657
660
  readonly variables?: readonly string[];
@@ -934,7 +937,8 @@ export declare const createActivityDetails: <Req, Res>(activityType: ActivityTyp
934
937
  readonly is_hype_sale?: boolean;
935
938
  };
936
939
  readonly graphqlData?: readonly {
937
- readonly type: import("..").GraphQLOperationType;
940
+ readonly type?: import("..").GraphQLOperationType;
941
+ readonly keywords?: readonly string[];
938
942
  readonly name?: string;
939
943
  readonly sensitive?: boolean;
940
944
  readonly variables?: readonly string[];
@@ -1160,7 +1164,8 @@ export declare const createActivityDetails: <Req, Res>(activityType: ActivityTyp
1160
1164
  readonly is_hype_sale?: boolean;
1161
1165
  };
1162
1166
  readonly graphqlData?: readonly {
1163
- readonly type: import("..").GraphQLOperationType;
1167
+ readonly type?: import("..").GraphQLOperationType;
1168
+ readonly keywords?: readonly string[];
1164
1169
  readonly name?: string;
1165
1170
  readonly sensitive?: boolean;
1166
1171
  readonly variables?: readonly string[];
@@ -1317,7 +1322,8 @@ export declare const createActivityDetails: <Req, Res>(activityType: ActivityTyp
1317
1322
  readonly is_hype_sale?: boolean;
1318
1323
  };
1319
1324
  readonly graphqlData?: readonly {
1320
- readonly type: import("..").GraphQLOperationType;
1325
+ readonly type?: import("..").GraphQLOperationType;
1326
+ readonly keywords?: readonly string[];
1321
1327
  readonly name?: string;
1322
1328
  readonly sensitive?: boolean;
1323
1329
  readonly variables?: readonly string[];
@@ -1600,7 +1606,8 @@ export declare const createAsyncActivityCommonDetails: <Req, Res>(context: {
1600
1606
  readonly is_hype_sale?: boolean;
1601
1607
  };
1602
1608
  readonly graphqlData?: readonly {
1603
- readonly type: import("..").GraphQLOperationType;
1609
+ readonly type?: import("..").GraphQLOperationType;
1610
+ readonly keywords?: readonly string[];
1604
1611
  readonly name?: string;
1605
1612
  readonly sensitive?: boolean;
1606
1613
  readonly variables?: readonly string[];
@@ -1826,7 +1833,8 @@ export declare const createAsyncActivityCommonDetails: <Req, Res>(context: {
1826
1833
  readonly is_hype_sale?: boolean;
1827
1834
  };
1828
1835
  readonly graphqlData?: readonly {
1829
- readonly type: import("..").GraphQLOperationType;
1836
+ readonly type?: import("..").GraphQLOperationType;
1837
+ readonly keywords?: readonly string[];
1830
1838
  readonly name?: string;
1831
1839
  readonly sensitive?: boolean;
1832
1840
  readonly variables?: readonly string[];
@@ -1983,7 +1991,8 @@ export declare const createAsyncActivityCommonDetails: <Req, Res>(context: {
1983
1991
  readonly is_hype_sale?: boolean;
1984
1992
  };
1985
1993
  readonly graphqlData?: readonly {
1986
- readonly type: import("..").GraphQLOperationType;
1994
+ readonly type?: import("..").GraphQLOperationType;
1995
+ readonly keywords?: readonly string[];
1987
1996
  readonly name?: string;
1988
1997
  readonly sensitive?: boolean;
1989
1998
  readonly variables?: readonly string[];
@@ -2266,7 +2275,8 @@ export declare const createCommonActivityDetails: <Req, Res>(config: IConfigurat
2266
2275
  readonly is_hype_sale?: boolean;
2267
2276
  };
2268
2277
  readonly graphqlData?: readonly {
2269
- readonly type: import("..").GraphQLOperationType;
2278
+ readonly type?: import("..").GraphQLOperationType;
2279
+ readonly keywords?: readonly string[];
2270
2280
  readonly name?: string;
2271
2281
  readonly sensitive?: boolean;
2272
2282
  readonly variables?: readonly string[];
@@ -2492,7 +2502,8 @@ export declare const createCommonActivityDetails: <Req, Res>(config: IConfigurat
2492
2502
  readonly is_hype_sale?: boolean;
2493
2503
  };
2494
2504
  readonly graphqlData?: readonly {
2495
- readonly type: import("..").GraphQLOperationType;
2505
+ readonly type?: import("..").GraphQLOperationType;
2506
+ readonly keywords?: readonly string[];
2496
2507
  readonly name?: string;
2497
2508
  readonly sensitive?: boolean;
2498
2509
  readonly variables?: readonly string[];
@@ -2649,7 +2660,8 @@ export declare const createCommonActivityDetails: <Req, Res>(config: IConfigurat
2649
2660
  readonly is_hype_sale?: boolean;
2650
2661
  };
2651
2662
  readonly graphqlData?: readonly {
2652
- readonly type: import("..").GraphQLOperationType;
2663
+ readonly type?: import("..").GraphQLOperationType;
2664
+ readonly keywords?: readonly string[];
2653
2665
  readonly name?: string;
2654
2666
  readonly sensitive?: boolean;
2655
2667
  readonly variables?: readonly string[];
@@ -2932,7 +2944,8 @@ export declare const addRootContextDataToDetails: <Req, Res>(details: CommonActi
2932
2944
  readonly is_hype_sale?: boolean;
2933
2945
  };
2934
2946
  readonly graphqlData?: readonly {
2935
- readonly type: import("..").GraphQLOperationType;
2947
+ readonly type?: import("..").GraphQLOperationType;
2948
+ readonly keywords?: readonly string[];
2936
2949
  readonly name?: string;
2937
2950
  readonly sensitive?: boolean;
2938
2951
  readonly variables?: readonly string[];
@@ -3158,7 +3171,8 @@ export declare const addRootContextDataToDetails: <Req, Res>(details: CommonActi
3158
3171
  readonly is_hype_sale?: boolean;
3159
3172
  };
3160
3173
  readonly graphqlData?: readonly {
3161
- readonly type: import("..").GraphQLOperationType;
3174
+ readonly type?: import("..").GraphQLOperationType;
3175
+ readonly keywords?: readonly string[];
3162
3176
  readonly name?: string;
3163
3177
  readonly sensitive?: boolean;
3164
3178
  readonly variables?: readonly string[];
@@ -3315,7 +3329,8 @@ export declare const addRootContextDataToDetails: <Req, Res>(details: CommonActi
3315
3329
  readonly is_hype_sale?: boolean;
3316
3330
  };
3317
3331
  readonly graphqlData?: readonly {
3318
- readonly type: import("..").GraphQLOperationType;
3332
+ readonly type?: import("..").GraphQLOperationType;
3333
+ readonly keywords?: readonly string[];
3319
3334
  readonly name?: string;
3320
3335
  readonly sensitive?: boolean;
3321
3336
  readonly variables?: readonly string[];
@@ -3656,7 +3671,8 @@ export declare const addRiskApiDataToAsyncActivityCommonDetails: <Req, Res>(deta
3656
3671
  readonly is_hype_sale?: boolean;
3657
3672
  };
3658
3673
  readonly graphqlData?: readonly {
3659
- readonly type: import("..").GraphQLOperationType;
3674
+ readonly type?: import("..").GraphQLOperationType;
3675
+ readonly keywords?: readonly string[];
3660
3676
  readonly name?: string;
3661
3677
  readonly sensitive?: boolean;
3662
3678
  readonly variables?: readonly string[];
@@ -3882,7 +3898,8 @@ export declare const addRiskApiDataToAsyncActivityCommonDetails: <Req, Res>(deta
3882
3898
  readonly is_hype_sale?: boolean;
3883
3899
  };
3884
3900
  readonly graphqlData?: readonly {
3885
- readonly type: import("..").GraphQLOperationType;
3901
+ readonly type?: import("..").GraphQLOperationType;
3902
+ readonly keywords?: readonly string[];
3886
3903
  readonly name?: string;
3887
3904
  readonly sensitive?: boolean;
3888
3905
  readonly variables?: readonly string[];
@@ -4039,7 +4056,8 @@ export declare const addRiskApiDataToAsyncActivityCommonDetails: <Req, Res>(deta
4039
4056
  readonly is_hype_sale?: boolean;
4040
4057
  };
4041
4058
  readonly graphqlData?: readonly {
4042
- readonly type: import("..").GraphQLOperationType;
4059
+ readonly type?: import("..").GraphQLOperationType;
4060
+ readonly keywords?: readonly string[];
4043
4061
  readonly name?: string;
4044
4062
  readonly sensitive?: boolean;
4045
4063
  readonly variables?: readonly string[];
@@ -4322,7 +4340,8 @@ export declare const addResponseDataToAsyncActivityCommonDetails: <Req, Res>(det
4322
4340
  readonly is_hype_sale?: boolean;
4323
4341
  };
4324
4342
  readonly graphqlData?: readonly {
4325
- readonly type: import("..").GraphQLOperationType;
4343
+ readonly type?: import("..").GraphQLOperationType;
4344
+ readonly keywords?: readonly string[];
4326
4345
  readonly name?: string;
4327
4346
  readonly sensitive?: boolean;
4328
4347
  readonly variables?: readonly string[];
@@ -4548,7 +4567,8 @@ export declare const addResponseDataToAsyncActivityCommonDetails: <Req, Res>(det
4548
4567
  readonly is_hype_sale?: boolean;
4549
4568
  };
4550
4569
  readonly graphqlData?: readonly {
4551
- readonly type: import("..").GraphQLOperationType;
4570
+ readonly type?: import("..").GraphQLOperationType;
4571
+ readonly keywords?: readonly string[];
4552
4572
  readonly name?: string;
4553
4573
  readonly sensitive?: boolean;
4554
4574
  readonly variables?: readonly string[];
@@ -4705,7 +4725,8 @@ export declare const addResponseDataToAsyncActivityCommonDetails: <Req, Res>(det
4705
4725
  readonly is_hype_sale?: boolean;
4706
4726
  };
4707
4727
  readonly graphqlData?: readonly {
4708
- readonly type: import("..").GraphQLOperationType;
4728
+ readonly type?: import("..").GraphQLOperationType;
4729
+ readonly keywords?: readonly string[];
4709
4730
  readonly name?: string;
4710
4731
  readonly sensitive?: boolean;
4711
4732
  readonly variables?: readonly string[];
@@ -4988,7 +5009,8 @@ export declare const createPageRequestedActivityDetails: <Req, Res>(context: {
4988
5009
  readonly is_hype_sale?: boolean;
4989
5010
  };
4990
5011
  readonly graphqlData?: readonly {
4991
- readonly type: import("..").GraphQLOperationType;
5012
+ readonly type?: import("..").GraphQLOperationType;
5013
+ readonly keywords?: readonly string[];
4992
5014
  readonly name?: string;
4993
5015
  readonly sensitive?: boolean;
4994
5016
  readonly variables?: readonly string[];
@@ -5214,7 +5236,8 @@ export declare const createPageRequestedActivityDetails: <Req, Res>(context: {
5214
5236
  readonly is_hype_sale?: boolean;
5215
5237
  };
5216
5238
  readonly graphqlData?: readonly {
5217
- readonly type: import("..").GraphQLOperationType;
5239
+ readonly type?: import("..").GraphQLOperationType;
5240
+ readonly keywords?: readonly string[];
5218
5241
  readonly name?: string;
5219
5242
  readonly sensitive?: boolean;
5220
5243
  readonly variables?: readonly string[];
@@ -5371,7 +5394,8 @@ export declare const createPageRequestedActivityDetails: <Req, Res>(context: {
5371
5394
  readonly is_hype_sale?: boolean;
5372
5395
  };
5373
5396
  readonly graphqlData?: readonly {
5374
- readonly type: import("..").GraphQLOperationType;
5397
+ readonly type?: import("..").GraphQLOperationType;
5398
+ readonly keywords?: readonly string[];
5375
5399
  readonly name?: string;
5376
5400
  readonly sensitive?: boolean;
5377
5401
  readonly variables?: readonly string[];
@@ -5654,7 +5678,8 @@ export declare const createBlockActivityDetails: <Req, Res>(context: {
5654
5678
  readonly is_hype_sale?: boolean;
5655
5679
  };
5656
5680
  readonly graphqlData?: readonly {
5657
- readonly type: import("..").GraphQLOperationType;
5681
+ readonly type?: import("..").GraphQLOperationType;
5682
+ readonly keywords?: readonly string[];
5658
5683
  readonly name?: string;
5659
5684
  readonly sensitive?: boolean;
5660
5685
  readonly variables?: readonly string[];
@@ -5880,7 +5905,8 @@ export declare const createBlockActivityDetails: <Req, Res>(context: {
5880
5905
  readonly is_hype_sale?: boolean;
5881
5906
  };
5882
5907
  readonly graphqlData?: readonly {
5883
- readonly type: import("..").GraphQLOperationType;
5908
+ readonly type?: import("..").GraphQLOperationType;
5909
+ readonly keywords?: readonly string[];
5884
5910
  readonly name?: string;
5885
5911
  readonly sensitive?: boolean;
5886
5912
  readonly variables?: readonly string[];
@@ -6037,7 +6063,8 @@ export declare const createBlockActivityDetails: <Req, Res>(context: {
6037
6063
  readonly is_hype_sale?: boolean;
6038
6064
  };
6039
6065
  readonly graphqlData?: readonly {
6040
- readonly type: import("..").GraphQLOperationType;
6066
+ readonly type?: import("..").GraphQLOperationType;
6067
+ readonly keywords?: readonly string[];
6041
6068
  readonly name?: string;
6042
6069
  readonly sensitive?: boolean;
6043
6070
  readonly variables?: readonly string[];
@@ -6320,7 +6347,8 @@ export declare const createAdditionalS2SActivityDetails: <Req, Res>({ ciSendRawU
6320
6347
  readonly is_hype_sale?: boolean;
6321
6348
  };
6322
6349
  readonly graphqlData?: readonly {
6323
- readonly type: import("..").GraphQLOperationType;
6350
+ readonly type?: import("..").GraphQLOperationType;
6351
+ readonly keywords?: readonly string[];
6324
6352
  readonly name?: string;
6325
6353
  readonly sensitive?: boolean;
6326
6354
  readonly variables?: readonly string[];
@@ -6546,7 +6574,8 @@ export declare const createAdditionalS2SActivityDetails: <Req, Res>({ ciSendRawU
6546
6574
  readonly is_hype_sale?: boolean;
6547
6575
  };
6548
6576
  readonly graphqlData?: readonly {
6549
- readonly type: import("..").GraphQLOperationType;
6577
+ readonly type?: import("..").GraphQLOperationType;
6578
+ readonly keywords?: readonly string[];
6550
6579
  readonly name?: string;
6551
6580
  readonly sensitive?: boolean;
6552
6581
  readonly variables?: readonly string[];
@@ -6703,7 +6732,8 @@ export declare const createAdditionalS2SActivityDetails: <Req, Res>({ ciSendRawU
6703
6732
  readonly is_hype_sale?: boolean;
6704
6733
  };
6705
6734
  readonly graphqlData?: readonly {
6706
- readonly type: import("..").GraphQLOperationType;
6735
+ readonly type?: import("..").GraphQLOperationType;
6736
+ readonly keywords?: readonly string[];
6707
6737
  readonly name?: string;
6708
6738
  readonly sensitive?: boolean;
6709
6739
  readonly variables?: readonly string[];
@@ -264,7 +264,8 @@ export declare const createBlockData: <Req, Res>(config: IConfiguration<Req, Res
264
264
  readonly is_hype_sale?: boolean;
265
265
  };
266
266
  readonly graphqlData?: readonly {
267
- readonly type: import("..").GraphQLOperationType;
267
+ readonly type?: import("..").GraphQLOperationType;
268
+ readonly keywords?: readonly string[];
268
269
  readonly name?: string;
269
270
  readonly sensitive?: boolean;
270
271
  readonly variables?: readonly string[];
@@ -490,7 +491,8 @@ export declare const createBlockData: <Req, Res>(config: IConfiguration<Req, Res
490
491
  readonly is_hype_sale?: boolean;
491
492
  };
492
493
  readonly graphqlData?: readonly {
493
- readonly type: import("..").GraphQLOperationType;
494
+ readonly type?: import("..").GraphQLOperationType;
495
+ readonly keywords?: readonly string[];
494
496
  readonly name?: string;
495
497
  readonly sensitive?: boolean;
496
498
  readonly variables?: readonly string[];
@@ -647,7 +649,8 @@ export declare const createBlockData: <Req, Res>(config: IConfiguration<Req, Res
647
649
  readonly is_hype_sale?: boolean;
648
650
  };
649
651
  readonly graphqlData?: readonly {
650
- readonly type: import("..").GraphQLOperationType;
652
+ readonly type?: import("..").GraphQLOperationType;
653
+ readonly keywords?: readonly string[];
651
654
  readonly name?: string;
652
655
  readonly sensitive?: boolean;
653
656
  readonly variables?: readonly string[];
@@ -7,8 +7,12 @@ import { CustomBlockResponseHeadersHandler, CustomPreflightHandler } from '../co
7
7
  import { ModuleMode } from '../utils';
8
8
  import { CredentialEndpointConfiguration, CredentialIntelligenceVersion, CustomLoginSuccessfulCallback, LoginSuccessfulReportingMethod } from '../products';
9
9
  import { CustomRequestFunction } from './CustomRequestFunction';
10
+ import { ExtractGraphQLKeywordsFunction } from '../graphql/ExtractGraphQLKeywordsFunction';
10
11
  export declare abstract class ConfigurationBase<Req, Res, ParamsType extends ConfigurationParams<Req, Res> = ConfigurationParams<Req, Res>> implements IConfiguration<Req, Res, ParamsType> {
11
- protected readonly configParams: ParamsType;
12
+ protected activeConfigParams: ParamsType;
13
+ protected readonly staticConfigParams: ParamsType;
14
+ protected remoteConfigParams: ParamsType;
15
+ protected readonly defaultConfigParams: ParamsType;
12
16
  protected internalLogger: ILogger;
13
17
  protected abstract getModuleVersion(): string;
14
18
  protected constructor(params: ParamsType, defaultParams?: Partial<ParamsType>);
@@ -18,7 +22,10 @@ export declare abstract class ConfigurationBase<Req, Res, ParamsType extends Con
18
22
  protected isValidConfigValue(params: ParamsType, defaultParams: ParamsType, key: keyof ParamsType): boolean;
19
23
  protected getDefaultConfigurationValue<K extends keyof ParamsType, V extends ParamsType[K]>(params: ParamsType, defaultParams: ParamsType, key: K): V;
20
24
  protected createInternalLogger(loggerSeverity: LoggerSeverity): ILogger;
21
- toParams(): ParamsType;
25
+ addRemoteConfig(remoteConfigParams: ParamsType): void;
26
+ getActiveConfig(): ParamsType;
27
+ getStaticConfig(): ParamsType;
28
+ getRemoteConfig(): ParamsType;
22
29
  get moduleVersion(): string;
23
30
  get logger(): ILogger;
24
31
  get appId(): string;
@@ -67,7 +74,9 @@ export declare abstract class ConfigurationBase<Req, Res, ParamsType extends Con
67
74
  get activityBatchTimeoutMs(): number;
68
75
  get graphqlEnabled(): boolean;
69
76
  get graphqlRoutes(): Array<string | RegExp>;
70
- get sensitiveGraphqlOperationNames(): string[];
77
+ get graphqlKeywords(): Array<string | RegExp>;
78
+ get extractGraphQLKeywords(): ExtractGraphQLKeywordsFunction<Req>;
79
+ get sensitiveGraphqlOperationNames(): Array<string | RegExp>;
71
80
  get sensitiveGraphqlOperationTypes(): string[];
72
81
  get enrichCustomParameters(): CustomParametersFunction<Req, Res>;
73
82
  get additionalActivityHandler(): AdditionalActivityHandler<Req, Res>;
@@ -97,7 +106,6 @@ export declare abstract class ConfigurationBase<Req, Res, ParamsType extends Con
97
106
  get ciDefaultLoginSuccessfulHeaderValue(): string;
98
107
  get ciDefaultLoginSuccessfulCustomCallback(): CustomLoginSuccessfulCallback<Res>;
99
108
  get remoteConfigAuthToken(): string;
100
- get remoteConfigSecret(): string;
101
109
  get remoteConfigVersion(): number;
102
110
  get remoteConfigId(): string;
103
111
  get remoteConfigRetryIntervalMs(): number;