@contrast/instrumentation 1.1.2 → 1.2.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/LICENSE ADDED
@@ -0,0 +1,12 @@
1
+ Copyright: 2023 Contrast Security, Inc
2
+ Contact: support@contrastsecurity.com
3
+ License: Commercial
4
+
5
+ NOTICE: This Software and the patented inventions embodied within may only be
6
+ used as part of Contrast Security’s commercial offerings. Even though it is
7
+ made available through public repositories, use of this Software is subject to
8
+ the applicable End User Licensing Agreement found at
9
+ https://www.contrastsecurity.com/enduser-terms-0317a or as otherwise agreed
10
+ between Contrast Security and the End User. The Software may not be reverse
11
+ engineered, modified, repackaged, sold, redistributed or otherwise used in a
12
+ way not consistent with the End User License Agreement.
package/lib/http.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright: 2022 Contrast Security, Inc
2
+ * Copyright: 2023 Contrast Security, Inc
3
3
  * Contact: support@contrastsecurity.com
4
4
  * License: Commercial
5
5
 
@@ -28,6 +28,8 @@ module.exports = function(core) {
28
28
  const { name, methods, around, patchType } = obj;
29
29
  methods.forEach((method) => {
30
30
  const patchObj = get(module, name);
31
+ if (!patchObj) return;
32
+
31
33
  patcher.patch(patchObj, method, {
32
34
  name: `${moduleName}.${name}.${method}`,
33
35
  patchType,
package/lib/http2.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright: 2022 Contrast Security, Inc
2
+ * Copyright: 2023 Contrast Security, Inc
3
3
  * Contact: support@contrastsecurity.com
4
4
  * License: Commercial
5
5
 
package/lib/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright: 2022 Contrast Security, Inc
2
+ * Copyright: 2023 Contrast Security, Inc
3
3
  * Contact: support@contrastsecurity.com
4
4
  * License: Commercial
5
5
 
package/lib/mongodb.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright: 2022 Contrast Security, Inc
2
+ * Copyright: 2023 Contrast Security, Inc
3
3
  * Contact: support@contrastsecurity.com
4
4
  * License: Commercial
5
5
 
package/lib/utils.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright: 2022 Contrast Security, Inc
2
+ * Copyright: 2023 Contrast Security, Inc
3
3
  * Contact: support@contrastsecurity.com
4
4
  * License: Commercial
5
5
 
@@ -14,12 +14,16 @@
14
14
  */
15
15
  'use strict';
16
16
 
17
+ const { split } = require('@contrast/common');
18
+
17
19
  function get(obj, name) {
18
20
  if (!name) return obj;
21
+
19
22
  let nest = obj;
20
- name.split('.').forEach((prop) => {
21
- nest = nest[prop];
22
- });
23
+ for (const prop of split(name, '.')) {
24
+ nest = nest?.[prop];
25
+ if (nest === undefined) break;
26
+ }
23
27
  return nest;
24
28
  }
25
29
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrast/instrumentation",
3
- "version": "1.1.2",
3
+ "version": "1.2.1",
4
4
  "description": "Shared hooks and patches between Protect and Assess components",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": "Contrast Security <nodejs@contrastsecurity.com> (https://www.contrastsecurity.com)",
@@ -15,5 +15,8 @@
15
15
  },
16
16
  "scripts": {
17
17
  "test": "../scripts/test.sh"
18
+ },
19
+ "dependencies": {
20
+ "@contrast/common": "1.15.1"
18
21
  }
19
- }
22
+ }