Skip to content

Commit 8495011

Browse files
committed
polish(shared): Remove more filtering logic
1 parent 981c599 commit 8495011

4 files changed

Lines changed: 1 addition & 31 deletions

File tree

libs/shared/sentry-nest/src/lib/reporting.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { ExecutionContext, HttpException } from '@nestjs/common';
33
import { GqlContextType, GqlExecutionContext } from '@nestjs/graphql';
44
import { ApolloServerErrorCode } from '@apollo/server/errors';
55

6-
import { CommonPiiActions, SqsMessageFilter } from '@fxa/shared/sentry-utils';
76
import { GraphQLError } from 'graphql';
87
import { Message } from '@aws-sdk/client-sqs';
98
import { Request } from 'express';
@@ -13,11 +12,6 @@ export interface ExtraContext {
1312
fieldData: Record<string, string>;
1413
}
1514

16-
const sqsMessageFilter = new SqsMessageFilter([
17-
CommonPiiActions.emailValues,
18-
CommonPiiActions.tokenValues,
19-
]);
20-
2115
/**
2216
* Capture a SQS Error to Sentry with additional context.
2317
*
@@ -27,7 +21,6 @@ const sqsMessageFilter = new SqsMessageFilter([
2721
export function captureSqsError(err: Error, message?: Message): void {
2822
Sentry.withScope((scope) => {
2923
if (message?.Body) {
30-
message = sqsMessageFilter.filter(message);
3124
scope.setContext('SQS Message', message as Record<string, unknown>);
3225
}
3326
Sentry.captureException(err);

packages/fxa-auth-server/lib/sentry.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ const {
1313
formatMetadataValidationErrorMessage,
1414
reportValidationError,
1515
} = require('fxa-shared/sentry/report-validation-error');
16-
// Matches uid, session, oauth and other common tokens which we would
17-
// prefer not to include in Sentry reports.
18-
const TOKENREGEX = /[a-fA-F0-9]{32,}/gi;
19-
const FILTERED = '[Filtered]';
2016

2117
function reportSentryMessage(message, captureContext) {
2218
Sentry.withScope((scope) => {
@@ -100,9 +96,7 @@ function reportSentryError(err, request) {
10096
const attempt = cause.attempt;
10197
if (attempt) {
10298
causeContext.method = attempt.method;
103-
causeContext.path = attempt.path
104-
? attempt.path.replace(TOKENREGEX, FILTERED)
105-
: null;
99+
causeContext.path = attempt.path;
106100
}
107101
scope.setContext('cause', causeContext);
108102
}

packages/fxa-shared/nestjs/sentry/reporting.spec.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
11
/* This Source Code Form is subject to the terms of the Mozilla Public
22
* License, v. 2.0. If a copy of the MPL was not distributed with this
33
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4-
import * as uuid from 'uuid';
54

65
import { isAuthServerError } from './reporting';
76

8-
const FILTERED = '[Filtered]';
9-
10-
function getUid() {
11-
return uuid.v4().replace(/-/g, '');
12-
}
13-
147
describe('detects auth server error', () => {
158
it('flags when code and errno are present', () => {
169
const result = isAuthServerError({

packages/fxa-shared/nestjs/sentry/reporting.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,9 @@ import { ApolloServerErrorCode } from '@apollo/server/errors';
66
import { GraphQLError } from 'graphql';
77
import { GqlContextType, GqlExecutionContext } from '@nestjs/graphql';
88
import * as Sentry from '@sentry/node';
9-
import { ErrorEvent } from '@sentry/core';
109
import { Message } from '@aws-sdk/client-sqs';
1110
import { Request } from 'express';
1211

13-
import { CommonPiiActions } from '../../sentry/pii-filter-actions';
14-
import { SqsMessageFilter } from '../../sentry/pii-filters';
15-
16-
const sqsMessageFilter = new SqsMessageFilter([
17-
CommonPiiActions.emailValues,
18-
CommonPiiActions.tokenValues,
19-
]);
20-
2112
export interface ExtraContext {
2213
name: string;
2314
fieldData: Record<string, string>;
@@ -74,7 +65,6 @@ export function isOriginallyHttpError(
7465
export function captureSqsError(err: Error, message?: Message): void {
7566
Sentry.withScope((scope) => {
7667
if (message?.Body) {
77-
message = sqsMessageFilter.filter(message);
7868
scope.setContext('SQS Message', message as Record<string, unknown>);
7969
}
8070
Sentry.captureException(err);

0 commit comments

Comments
 (0)