Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove PII from log #2256

Merged
merged 2 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lib/auth/AuthInfo.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
import * as constants from '../constants';

export type AuthInfoType = {
arn: string;
canonicalID: string;
shortid: string;
email: string;
accountDisplayName: string;
IAMdisplayName: string;
};

/**
* Class containing requester's information received from Vault
* @param {object} info from Vault including arn, canonicalID,
Expand Down
28 changes: 25 additions & 3 deletions lib/auth/Vault.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Logger } from 'werelogs';
import errors from '../errors';
import AuthInfo from './AuthInfo';
import AuthInfo, { AuthInfoType } from './AuthInfo';

/** vaultSignatureCb parses message from Vault and instantiates
* @param err - error from vault
Expand All @@ -12,7 +12,16 @@ import AuthInfo from './AuthInfo';
*/
function vaultSignatureCb(
err: Error | null,
authInfo: { message: { body: any } },
authInfo: {
message: {
message: string,
body: {
userInfo: AuthInfoType,
authorizationResults: { [key: string]: any },
accountQuota: number,
},
},
},
log: Logger,
callback: (err: Error | null, data?: any, results?: any, params?: any, infos?: any) => void,
streamingV4Params?: any
Expand All @@ -26,7 +35,20 @@ function vaultSignatureCb(
{ errorMessage: err });
return callback(err);
}
log.debug('received info from Vault', { authInfo });

const { email, ...userInfoWithoutEmail } = authInfo.message.body.userInfo;

log.debug('received info from Vault', {
...authInfo,
message: {
message: authInfo.message.message,
body: {
...authInfo.message.body,
userInfo: userInfoWithoutEmail,
},
},
});

const info = authInfo.message.body;
const userInfo = new AuthInfo(info.userInfo);
const authorizationResults = info.authorizationResults;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"engines": {
"node": ">=16"
},
"version": "8.1.134",
"version": "8.1.135",
"description": "Common utilities for the S3 project components",
"main": "build/index.js",
"repository": {
Expand Down
Loading