@vtex/api 3.77.4 → 3.77.7

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
@@ -7,6 +7,23 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [3.77.7] - 2022-04-14
11
+
12
+ ### Fixed
13
+ - Update sensitive fields.
14
+ - Remove "error".
15
+ - Add missing fields.
16
+ - Fix cleanJson.
17
+ - Lowercase keys before comparison.
18
+
19
+ ## [3.77.6] - 2022-03-08
20
+ ### Fixed
21
+ - Only remove cookie fields when removing sensitive data from logs.
22
+
23
+ ## [3.77.5] - 2022-02-24
24
+ ### Fixed
25
+ - Remove sensitive data from logs.
26
+
10
27
  ## [3.77.4] - 2021-10-22
11
28
 
12
29
  ## [3.77.3] - 2021-10-22
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const error_1 = require("../../utils/error");
4
+ const log_1 = require("../../utils/log");
4
5
  const linked = !!process.env.VTEX_APP_LINK;
5
6
  const app = process.env.VTEX_APP_ID;
6
7
  const EMPTY_MESSAGE = 'Logger.log was called with null or undefined message';
@@ -22,6 +23,7 @@ class Logger {
22
23
  this.error = (error) => this.log(error, LogLevel.Error);
23
24
  this.log = (message, level) => {
24
25
  const data = message ? error_1.cleanError(message) : EMPTY_MESSAGE;
26
+ log_1.cleanLog(data);
25
27
  /* tslint:disable:object-literal-sort-keys */
26
28
  const inflatedLog = {
27
29
  __VTEX_IO_LOG: true,
@@ -0,0 +1,5 @@
1
+ export declare function cleanJson(json: {
2
+ [k: string]: any;
3
+ }, targetFields: string[]): {
4
+ [k: string]: any;
5
+ };
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function cleanJson(json, targetFields) {
4
+ for (const key of Object.keys(json)) {
5
+ let deleted = false;
6
+ for (const field of targetFields) {
7
+ if (key.toLowerCase() === field) {
8
+ delete json[key];
9
+ deleted = true;
10
+ }
11
+ }
12
+ if (!deleted && json[key] && typeof json[key] === 'object') {
13
+ json[key] = cleanJson(json[key], targetFields);
14
+ }
15
+ }
16
+ return json;
17
+ }
18
+ exports.cleanJson = cleanJson;
@@ -0,0 +1,5 @@
1
+ export declare const cleanLog: (log: {
2
+ [k: string]: any;
3
+ }) => {
4
+ [k: string]: any;
5
+ };
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const json_1 = require("./json");
4
+ const SENSITIVE_FIELDS = [
5
+ 'auth',
6
+ 'authorization',
7
+ 'authtoken',
8
+ 'cookie',
9
+ 'proxy-athorization',
10
+ 'rawheaders',
11
+ 'token',
12
+ 'vtexIdclientautcookie',
13
+ 'x-vtex-api-appkey',
14
+ 'x-vtex-api-apptoken',
15
+ 'x-vtex-credential',
16
+ 'x-vtex-session',
17
+ ];
18
+ exports.cleanLog = (log) => {
19
+ return json_1.cleanJson(log, SENSITIVE_FIELDS);
20
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtex/api",
3
- "version": "3.77.4",
3
+ "version": "3.77.7",
4
4
  "description": "VTEX I/O API client",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",