Skip to content

Commit 848a2dc

Browse files
Merge pull request #505 from vtex/3.x-sensitive-fields
[3.x] Fix / Sensitive fields
2 parents 5035d8a + 943ae9e commit 848a2dc

4 files changed

Lines changed: 25 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## [Unreleased]
99

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+
1019
## [3.77.6] - 2022-03-08
1120
### Fixed
1221
- Only remove cookie fields when removing sensitive data from logs.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vtex/api",
3-
"version": "3.77.6",
3+
"version": "3.77.7",
44
"description": "VTEX I/O API client",
55
"main": "lib/index.js",
66
"typings": "lib/index.d.ts",

src/utils/json.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ export function cleanJson(json: {[k: string]: any}, targetFields: string[]) {
22
for (const key of Object.keys(json)) {
33
let deleted = false
44
for (const field of targetFields) {
5-
if (key === field) {
5+
if (key.toLowerCase() === field) {
66
delete json[key]
77
deleted = true
88
}

src/utils/log.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
import { cleanJson } from './json'
22

3-
const SENSITIVE_FIELDS = ['cookie', 'Cookie', 'vtexIdclientautcookie', 'error']
3+
const SENSITIVE_FIELDS = [
4+
'auth',
5+
'authorization',
6+
'authtoken',
7+
'cookie',
8+
'proxy-athorization',
9+
'rawheaders',
10+
'token',
11+
'vtexIdclientautcookie',
12+
'x-vtex-api-appkey',
13+
'x-vtex-api-apptoken',
14+
'x-vtex-credential',
15+
'x-vtex-session',
16+
]
417

518
export const cleanLog = (log: {[k: string]: any}) => {
619
return cleanJson(log, SENSITIVE_FIELDS)

0 commit comments

Comments
 (0)