lambda-essentials-ts 5.1.4 → 5.1.6

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
@@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
6
6
 
7
+ ## [5.1.6] - 2022-11-30
8
+
9
+ ### Changed
10
+
11
+ Removed logging of client_secret
12
+
13
+ ## [5.1.5] - 2022-11-15
14
+
15
+ ### Changed
16
+
17
+ The fix described in 5.1.4 missed one instance where the bug can occur. This change covers all known instances.
18
+
7
19
  ## [5.1.4] - 2022-11-08
8
20
 
9
21
  ### Changed
@@ -161,7 +161,9 @@ class HttpClient {
161
161
  error: serializedAxiosError,
162
162
  });
163
163
  }
164
- const hostname = ((_a = error.config) === null || _a === void 0 ? void 0 : _a.url) ? new url_1.URL(error.config.url).hostname : 'N/A';
164
+ const hostname = ((_a = error.config) === null || _a === void 0 ? void 0 : _a.url)
165
+ ? new url_1.URL(error.config.url, error.config.baseURL).hostname
166
+ : 'N/A';
165
167
  throw new clientException_1.ClientException(hostname, serializedAxiosError === null || serializedAxiosError === void 0 ? void 0 : serializedAxiosError.status, serializedAxiosError === null || serializedAxiosError === void 0 ? void 0 : serializedAxiosError.details);
166
168
  });
167
169
  }
@@ -74,8 +74,12 @@ class Logger {
74
74
  const truncateToken = (innerPayload) => {
75
75
  return innerPayload.replace(/(eyJ[a-zA-Z0-9_-]{5,}\.eyJ[a-zA-Z0-9_-]{5,})\.[a-zA-Z0-9_-]*/gi, (m, p1) => `${p1}.<sig>`);
76
76
  };
77
+ const truncateSecret = (data) => {
78
+ return data.replace(/(\\*"client_secret\\*":\\*")([a-zA-Z0-9_+=.@/-]{60,})(\\*")/gi, (m, p1, p2, p3) => `${p1}<REDACTED>${p3}`);
79
+ };
77
80
  const replacer = (key, value) => ((0, is_error_1.default)(value) ? Logger.errorToObject(value) : value);
78
81
  let stringifiedPayload = truncateToken((0, fast_safe_stringify_1.default)(payload, replacer, this.jsonSpace));
82
+ stringifiedPayload = truncateSecret(stringifiedPayload);
79
83
  // https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/cloudwatch_limits_cwl.html 256KB => 32768 characters
80
84
  if (stringifiedPayload.length >= 32768) {
81
85
  const replacementPayload = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lambda-essentials-ts",
3
- "version": "5.1.4",
3
+ "version": "5.1.6",
4
4
  "description": "A selection of the finest modules supporting authorization, API routing, error handling, logging and sending HTTP requests.",
5
5
  "main": "lib/index.js",
6
6
  "private": false,