lambda-essentials-ts 5.1.5 → 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,12 @@ 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
+
7
13
  ## [5.1.5] - 2022-11-15
8
14
 
9
15
  ### Changed
@@ -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.5",
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,