|
1 | 1 | --- |
2 | 2 | title: "Data Handling" |
3 | | -sidebar_order: 5 |
| 3 | +sidebar_order: 3 |
4 | 4 | --- |
5 | 5 |
|
6 | 6 | Data handling is the standardized context in how we want SDKs help users filter data. |
7 | 7 |
|
8 | 8 | ## Sensitive Data |
9 | 9 |
|
10 | | -In older SDKs you might sometimes see elaborate constructs to allow the user to strip away sensitive data. Newer SDKs no longer have this feature as it turned out to be too hard to maintain per-SDK. Instead, only two simple config options are left: |
| 10 | +SDKs should not include PII or other sensitive data in the payload by default. |
| 11 | +When building an SDK we can come across to some API that can give useful information to debug a problem. |
| 12 | +In the event that API returns data considered PII, we guard that behind a flag called _Send Default PII_. |
| 13 | +This is an option in the SDK called [_send-default-pii_](https://docs.sentry.io/platforms/python/configuration/options/#send-default-pii) |
| 14 | +and is **disabled by default**. That means that data that is naturally sensitive is not sent by default. |
11 | 15 |
|
12 | | -- [_send-default-pii_](https://docs.sentry.io/error-reporting/configuration/#send-default-pii) is **disabled by default**, meaning that data that is naturally sensitive is not sent by default. That means, for example: |
| 16 | +Some examples of data guarded by this flag: |
13 | 17 |
|
14 | | - - When attaching HTTP requests to events, "raw" bodies (bodies which cannot be parsed as JSON or formdata) are removed, and known sensitive headers such as `Authorization` or `Cookies` are removed too. |
| 18 | + - When attaching HTTP requests to events |
| 19 | + - Request Body: "raw" bodies (bodies which cannot be parsed as JSON or formdata) are removed |
| 20 | + - HTTP Headers: known sensitive headers such as `Authorization` or `Cookies` are removed too. |
| 21 | + - *Note* that if a user explicitly sets a request on the scope, nothing is stripped from that request. The above rules only apply to integrations that come with the SDK. |
| 22 | + - User-specific information (e.g. the current user ID according to the used web-framework) is not sent at all. |
| 23 | + - On desktop applications |
| 24 | + - The username logged in the device is not included. This is often a person's name. |
| 25 | + - The machine name is not included, for example `Bruno's laptop` |
| 26 | + - SDKs don't set `{{auto}}` as `user.ip`. This instructs the server to keep the connection's IP address.* |
15 | 27 |
|
16 | | - - User-specific information (e.g. the current user ID according to the used webframework) is not sent at all. |
| 28 | +* Specifically about IP address, it's important to note that it's standard to log IP address of incoming connecting in services on the Internet. |
| 29 | +This not only allows security tools and operations to understand abuse coming from a single IP, like spam bots and other issues. |
| 30 | +But also developers to understand if issues in their application are being triggered by a single malicious source. |
17 | 31 |
|
18 | | - - Note that if a user explicitly sets a request on the scope, nothing is stripped from that request. The above rules only apply to integrations that come with the SDK. |
| 32 | +Sentry server is always aware of the connecting IP address and can use it for logging in some platforms. Namely JavaScript and iOS/macOS/tvOS. |
| 33 | +All other platforms require the event to include `user.ip={{auto}}` which happens if `sendDefaultPii` is set to true. |
19 | 34 |
|
20 | | -- [_before-send_](https://docs.sentry.io/error-reporting/configuration/#before-send) can be used to register a callback with custom logic to remove sensitive data. |
| 35 | +Before sending events to Sentry, the SDKs should invokes callbacks. That allows users to remove any sensitive data client-side. |
| 36 | + |
| 37 | +- [`before-send` and `event-processors`](https://develop.sentry.dev/sdk/unified-api/#static-api) can be used to register a callback with custom logic to remove sensitive data. |
| 38 | + |
| 39 | +### Application State |
| 40 | + |
| 41 | +App state can be critical to help developers reproduce bugs. For that reason, SDKs often collect app state and append to events through auto instrumentation. |
| 42 | + |
| 43 | +When attaching data that could potentially include sensitive data or PII, it's important to: |
| 44 | + |
| 45 | +- Add a note on the docs to notify developers. |
| 46 | +- [Mark that part of the protocol on Relay](https://github.com/getsentry/relay/pull/1383) as such. This allows [data scrubbing](https://docs.sentry.io/product/relay/) to run on those fields. |
| 47 | + |
| 48 | +Some examples of auto instrumentation that could attach sensitive data: |
| 49 | + |
| 50 | +- A SQL integration that includes the query. If a user doesn't use parameterized queries, and appends sensitive data to it, the SDK could include that in the event payload. |
| 51 | +- Desktop apps including window title. |
| 52 | +- A Web framework routing instrumentation attaching route `to` and `from`. |
21 | 53 |
|
22 | 54 | ## Variable Size |
23 | 55 |
|
|
0 commit comments