Skip to content
This repository was archived by the owner on Aug 30, 2023. It is now read-only.

Conversation

@maciejwalkowiak
Copy link
Contributor

@maciejwalkowiak maciejwalkowiak commented Aug 28, 2020

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

Adds an option for users to decide if they want to send personal identifiable information (email, username, ip address) along with the events.

💡 Motivation and Context

Discussion initially started when working on Spring Boot integration - we want to give users option to decide if detailed user information is sent or not - similar to how it's done in Python integration: https://docs.sentry.io/error-reporting/configuration/?platform=python

📝 Checklist

  • I reviewed submitted code
  • I added tests to verify changes
  • All tests passing
  • No breaking changes

Breaking change: sending PII is turn off by default.

@maciejwalkowiak maciejwalkowiak changed the title Add PiiEventProcessor to filter out personal identifiable information… Add PiiEventProcessor to filter out personal identifiable information Aug 28, 2020
@Override
public SentryEvent process(SentryEvent event, @Nullable Object hint) {
if (!options.isSendDefaultPii()) {
final User user = event.getUser();
Copy link
Contributor

Choose a reason for hiding this comment

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

do we have any PII set (like IP) in event.request that we should strip off as well? maybe in event.request.headers if it has a fixed key.

Copy link
Contributor Author

@maciejwalkowiak maciejwalkowiak Aug 28, 2020

Choose a reason for hiding this comment

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

Good point. I also realised that we need to make sure that PiiEventProcessor is the last processor that runs, otherwise other processors added later can actually add PII.

I will add also removing:

  • X-FORWARDED-FOR header
  • Authorization header
  • cookies

Copy link
Contributor

Choose a reason for hiding this comment

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

good point, I noticed that too, that should be the last one, but I dont see how we can do that easily, any other processor added by the client manually will be added later, we can guarantee that its the last one in the SDK, but not the last one overall, I guess.
ideas are welcome of course.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I extracted PiiEventProcessor to separate field. Another option would be to have special type of list with method addBefore(processor, Class<T>) but I think in this case it would be overengineering.

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah liked the idea, I'm fine with it, maybe @bruno-garcia has opinions.

Copy link
Member

Choose a reason for hiding this comment

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

I'd prefer to avoid adding any pii to begin with.

Copy link
Contributor

@marandaneto marandaneto left a comment

Choose a reason for hiding this comment

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

looks good, left a few comments.
I'd uncheck No breaking changes on the PR template because users would need to swap the flag on App. init to send user data now and previously, this was sent by default, maybe the target branch should be 3.0.0 though.

A note for me would be to add an Android-friendly way of swapping this flag eg ManifestMetadataReader so people can configure that on the Manifest file like any other option.

Copy link
Member

@bruno-garcia bruno-garcia left a comment

Choose a reason for hiding this comment

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

Can we just not add abrocessor and simply not add pii?
Also folks are against processors that are not added as integrations.

@maciejwalkowiak
Copy link
Contributor Author

Can we just not add abrocessor and simply not add pii?
Also folks are against processors that are not added as integrations.

Lets take Spring integration as an example - do you mean to not have a flag on sentry options and the Spring Security filter that adds user data? This filter is not configured anyway, so the idea with a flag and processor was just a convenient way to make sure that no PII data is sent to sentry no matter what is configured on the application side.

Comment on lines +1012 to +1016
@NotNull
public EventProcessor getPiiEventProcessor() {
return piiEventProcessor;
}

Copy link
Member

Choose a reason for hiding this comment

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

I believe it's safer to keep this API out and simply have the options reference where needed to inspect for sendDefaultPii before adding any PII in the first place.

This will help with auditing the code for PII, avoid issues where we somehow don't run the processor accidentally (change of order or some other bug) and also forget to add a clean up logic for something we collect as PII without the guard

Copy link
Member

@bruno-garcia bruno-garcia left a comment

Choose a reason for hiding this comment

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

Could merge this PR with the boolean flag sendDefaultPii on Options and have the individual checks done at the call site which adds the PII?

@maciejwalkowiak
Copy link
Contributor Author

Superseded by #531.

@bruno-garcia bruno-garcia deleted the pii-processor branch August 31, 2020 22:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants