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

Stop logging event data #117

Merged
merged 2 commits into from
Oct 26, 2023
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
1 change: 0 additions & 1 deletion src/resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,6 @@ export abstract class BaseResource<
this.prepareCredentialsFilter(this.callerSession)
);
}
this.log('EVENT DATA\n', eventData);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is that the only place?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is the only place logging event data in the repo.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validated this is the only place logging event data by invoking CUD handlers of a resource.

progress = await this.invokeHandler(
this.callerSession,
request,
Expand Down
15 changes: 1 addition & 14 deletions tests/lib/resource.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ describe('when getting resource', () => {
});

test('entrypoint redacting credentials', async () => {
expect.assertions(13);
expect.assertions(5);
const spyPublishLogEvent = jest.spyOn<any, any>(
LogPublisher.prototype,
'publishLogEvent'
Expand Down Expand Up @@ -283,19 +283,6 @@ describe('when getting resource', () => {
expect(spyPrepareLogStream).toBeCalledTimes(1);
expect(spyPublishLogEvent).toHaveBeenCalled();
expect(mockPublishMessage).toHaveBeenCalled();
mockPublishMessage.mock.calls.forEach((value: any[]) => {
const message = value[0] as string;
if (message && message.startsWith('EVENT DATA')) {
expect(message).toMatch(/bearerToken: '<REDACTED>'/);
expect(message).toMatch(
/providerCredentials: {\s+accessKeyId: '<REDACTED>',\s+secretAccessKey: '<REDACTED>',\s+sessionToken: '<REDACTED>'\s+}/
);
expect(message).toMatch(
/callerCredentials: {\s+accessKeyId: '<REDACTED>',\s+secretAccessKey: '<REDACTED>',\s+sessionToken: '<REDACTED>'\s+}/
);
expect(message).toMatch(/stack\/sample-stack\/<REDACTED>/);
}
});
});

test('entrypoint with callback context', async () => {
Expand Down