-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix(pii): Add more conditionals around sending data #16143
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
base: develop
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -209,7 +209,7 @@ function wrapRequestHandler<T extends RouteHandler = RouteHandler>( | |
normalizedRequest: { | ||
url: request.url, | ||
method: request.method, | ||
headers: request.headers.toJSON(), | ||
headers: request.headers.toJSON(), // fixme: headers are passed 1:1 | ||
query_string: parsedUrl?.search, | ||
} satisfies RequestEventData, | ||
}); | ||
|
@@ -232,7 +232,7 @@ function wrapRequestHandler<T extends RouteHandler = RouteHandler>( | |
if (response?.status) { | ||
setHttpStatus(span, response.status); | ||
isolationScope.setContext('response', { | ||
headers: response.headers.toJSON(), | ||
headers: response.headers.toJSON(), // fixme: headers are passed 1:1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For all the header-related data, we need to decide on whether we want to keep sending them all, filter them by excluding e.g. authorization headers or not send them all when no PII should be sent. |
||
status_code: response.status, | ||
}); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -205,6 +205,7 @@ function endSpan(span: Span, handlerData: HandlerDataFetch): void { | |
if (handlerData.response) { | ||
setHttpStatus(span, handlerData.response.status); | ||
|
||
// fixme: only send if `sendDefaultPii`? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think content length is something we could send There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you mean w/o sendDefaultPii === true? agreed! |
||
const contentLength = handlerData.response?.headers && handlerData.response.headers.get('content-length'); | ||
|
||
if (contentLength) { | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -45,6 +45,7 @@ const _requestDataIntegration = ((options: RequestDataIntegrationOptions = {}) = | |||||||||||||||
|
||||||||||||||||
const includeWithDefaultPiiApplied: RequestDataIncludeOptions = { | ||||||||||||||||
...include, | ||||||||||||||||
// todo: also exclude cookies and headers if sendDefaultPii is false | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is actually something we should do - the question is if we do this in a minor or major? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the Http Client integration for browser, we only include the cookie data if this is explicitly enabled: sentry-javascript/packages/browser/src/integrations/httpclient.ts Lines 140 to 146 in 63476fa
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed, we should do it but my gut feeling is to do it in a major (see review comment) |
||||||||||||||||
ip: include.ip ?? client.getOptions().sendDefaultPii, | ||||||||||||||||
}; | ||||||||||||||||
|
||||||||||||||||
|
@@ -74,6 +75,7 @@ function addNormalizedRequestDataToEvent( | |||||||||||||||
additionalData: { ipAddress?: string }, | ||||||||||||||||
include: RequestDataIncludeOptions, | ||||||||||||||||
): void { | ||||||||||||||||
// fixme: only add when `sendDefaultPii` is enabled? | ||||||||||||||||
event.request = { | ||||||||||||||||
...event.request, | ||||||||||||||||
...extractNormalizedRequestData(req, include), | ||||||||||||||||
|
@@ -121,6 +123,7 @@ function extractNormalizedRequestData( | |||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
if (include.cookies) { | ||||||||||||||||
// fixme: cookies enabled by default? | ||||||||||||||||
const cookies = normalizedRequest.cookies || (headers?.cookie ? parseCookie(headers.cookie) : undefined); | ||||||||||||||||
requestData.cookies = cookies || {}; | ||||||||||||||||
} | ||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,6 +59,7 @@ export function getDefaultIntegrations(options: Options): Integration[] { | |
linkedErrorsIntegration(), | ||
winterCGFetchIntegration(), | ||
consoleIntegration(), | ||
// fixme: integration can be included - but integration should not add IP address etc | ||
...(options.sendDefaultPii ? [requestDataIntegration()] : []), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah I agree that we should handle this within the integration instead of the top-level decision here. |
||
]; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this, we'll just need to add
maxRequestBodySize
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is only used in conjunction with Replay and the feature being enabled but I might be missing a case