@itentialopensource/adapter-utils 5.9.5 → 5.10.1

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 CHANGED
@@ -1,4 +1,22 @@
1
1
 
2
+ ## 5.10.1 [11-18-2024]
3
+
4
+ * mask values in the STS log
5
+
6
+ Closes ENG-7296
7
+
8
+ See merge request itentialopensource/adapter-utils!311
9
+
10
+ ---
11
+
12
+ ## 5.10.0 [11-15-2024]
13
+
14
+ * query without keys
15
+
16
+ See merge request itentialopensource/adapter-utils!310
17
+
18
+ ---
19
+
2
20
  ## 5.9.5 [11-06-2024]
3
21
 
4
22
  * more role chain changes for AWS
@@ -19,10 +19,11 @@ class AuthenticationHandler {
19
19
  * Adapter Authentication Handler
20
20
  * @constructor
21
21
  */
22
- constructor(prongId, properties, reqH) {
22
+ constructor(prongId, properties, reqH, propUtilCl) {
23
23
  this.myid = prongId;
24
24
  this.allProps = properties;
25
25
  this.requestHandlerInst = reqH;
26
+ this.propUtil = propUtilCl;
26
27
 
27
28
  // set up the properties I care about
28
29
  this.refreshProperties(properties);
@@ -101,7 +102,7 @@ class AuthenticationHandler {
101
102
  // set the original AWS access information (from properties)
102
103
  AWS.config.update(configObj);
103
104
  const sts = new AWS.STS();
104
- log.debug(`STS OPTIONS: ${JSON.stringify(configObj)}`);
105
+ log.debug(`STS OPTIONS: ${this.propUtil.scrubSensitiveInfo(JSON.stringify(configObj))}`);
105
106
 
106
107
  // use STS to get the AWS access information for the user defined in STWS Params
107
108
  const stsData = {
@@ -466,7 +466,7 @@ class RequestHandler {
466
466
  this.transUtil = new TransUtilCl(prongId, this.propUtil);
467
467
  transUtilInst = this.transUtil;
468
468
 
469
- this.authHandler = new AuthHandlerCl(this.myid, this.props, this);
469
+ this.authHandler = new AuthHandlerCl(this.myid, this.props, this, this.propUtil);
470
470
  // validate the action files for the adapter
471
471
  this.clean = walkThroughActionFiles(this.directory);
472
472
 
@@ -23,6 +23,7 @@ let globalRequestGl = null;
23
23
  let returnRawGl = false;
24
24
  let encodePath = true;
25
25
  let encodeUri = true;
26
+ let queryKeyGl = true;
26
27
  let stripEscapes = false;
27
28
  let returnResponseHeaders = true;
28
29
  let healthcheckHeaders = null;
@@ -797,12 +798,20 @@ function buildRequestPath(entity, action, entitySchema, reqPath, uriPathVars, ur
797
798
  addquery = entitySchema.querykey;
798
799
  }
799
800
  if (systemQuery !== null) {
801
+ // do not want to change the global only change this call so use a local var
802
+ let localEncode = encodeUri;
803
+ let localKey = queryKeyGl;
804
+
800
805
  // if encoding is changed in call properties that overrides the default
801
806
  if (callProperties && Object.hasOwnProperty.call(callProperties, 'encode_queryvars')) {
802
- encodeUri = callProperties.encode_queryvars;
807
+ localEncode = callProperties.encode_queryvars;
808
+ }
809
+ if (callProperties && Object.hasOwnProperty.call(callProperties, 'query_keys')) {
810
+ localKey = callProperties.query_keys;
803
811
  }
804
- // if we are encoding - use querystring since it does it all!
805
- if (encodeUri === true) {
812
+
813
+ // if we are encoding with keys - use querystring since it does it all!
814
+ if (localEncode === true && localKey === true) {
806
815
  addquery += querystring.stringify(systemQuery);
807
816
  } else {
808
817
  // if not encoding we need to build
@@ -814,8 +823,17 @@ function buildRequestPath(entity, action, entitySchema, reqPath, uriPathVars, ur
814
823
  if (k > 0) {
815
824
  addquery += '&';
816
825
  }
817
- // adds key=value
818
- addquery += `${qkeys[k]}=${systemQuery[qkeys[k]]}`;
826
+
827
+ if (localKey === true) {
828
+ // adds key=value
829
+ addquery += `${qkeys[k]}=${systemQuery[qkeys[k]]}`;
830
+ } else if (localEncode === true) {
831
+ // adds value but encoded
832
+ addquery += encodeURIComponent(systemQuery[qkeys[k]]);
833
+ } else {
834
+ // adds value
835
+ addquery += `${systemQuery[qkeys[k]]}`;
836
+ }
819
837
  }
820
838
  }
821
839
  }
@@ -1147,6 +1165,11 @@ class RestHandler {
1147
1165
  encodePath = this.encode;
1148
1166
  this.encodeQ = properties.encode_queryvars;
1149
1167
  encodeUri = this.encodeQ;
1168
+ this.queryKey = true;
1169
+ if (Object.hasOwnProperty.call(properties, 'query_keys')) {
1170
+ this.queryKey = properties.query_keys;
1171
+ }
1172
+ queryKeyGl = this.queryKey;
1150
1173
 
1151
1174
  // optional to strip extra escapes - default is false
1152
1175
  if (properties.stripEscapes) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itentialopensource/adapter-utils",
3
- "version": "5.9.5",
3
+ "version": "5.10.1",
4
4
  "description": "Itential Adapter Utility Libraries",
5
5
  "scripts": {
6
6
  "postinstall": "node utils/setup.js",
Binary file
@@ -69,6 +69,11 @@
69
69
  "description": "When true the query parameters are encoded in the url",
70
70
  "default": true
71
71
  },
72
+ "query_keys": {
73
+ "type": "boolean",
74
+ "description": "When true the query keys are put into the url (e.g. key=value)",
75
+ "default": true
76
+ },
72
77
  "save_metric": {
73
78
  "type": [
74
79
  "boolean",