Skip to content

Commit 6a5f45c

Browse files
committed
feat(python): Add event_scrubber docs
1 parent 82d9d84 commit 6a5f45c

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
If <PlatformIdentifier name="send-default-pii" /> is set to `False`, the default scrubber implementation will run automatically and filter anything in the [`denylist`](TODO-neel) from [potentially sensitive interfaces](/platforms/python/data-collected/) in the event payload.
2+
3+
```python
4+
import sentry_sdk
5+
from sentry_sdk.scrubber import EventScrubber
6+
7+
sentry_sdk.init(
8+
# ...
9+
send_default_pii=False,
10+
event_scrubber=EventScrubber(), # this is set by default
11+
)
12+
```
13+
14+
You can also pass in a custom `denylist` to the `EventScrubber` class and filter additional fields that you want.
15+
16+
```python
17+
from sentry_sdk.scrubber import EventScrubber, DEFAULT_DENYLIST
18+
19+
# custom denylist
20+
denylist = DEFAULT_DENYLIST + ["my_sensitive_var"]
21+
22+
sentry_sdk.init(
23+
# ...
24+
send_default_pii=False,
25+
event_scrubber=EventScrubber(denylist=denylist),
26+
)
27+
```

src/platforms/common/configuration/options.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,12 @@ If you enable this option, be sure to manually remove what you don't want to sen
240240

241241
</ConfigKey>
242242

243+
<ConfigKey name="event-scrubber" supported={["python"]}>
244+
245+
If <PlatformIdentifier name="send-default-pii" /> is set to `False`, scrubs the event payload for sensitive information from a `denylist`. See how to [configure the scrubber here](../../data-management/sensitive-data/#event-scrubber).
246+
247+
</ConfigKey>
248+
243249
<ConfigKey name="server-name" supported={["python", "node", "ruby", "php", "java", "dart", "dotnet"]} notSupported={["android"]}>
244250

245251
This option can be used to supply a "server name." When provided, the name of the server is sent along and persisted in the event. For many integrations, the server name actually corresponds to the device hostname, even in situations where the machine is not actually a server.

src/platforms/common/data-management/sensitive-data/index.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,18 @@ If you _do not_ wish to use the default PII behavior, you can also choose to ide
4949

5050
## Scrubbing Data
5151

52+
<PlatformSection supported={["python"]}>
53+
54+
### `event_scrubber`
55+
56+
You can use the <PlatformIdentifier name="event-scrubber" /> configuration parameter to simplify removing sensitive data from your event payload.
57+
58+
<PlatformContent includePath="configuration/event-scrubber" />
59+
60+
</PlatformSection>
61+
62+
### `before_send`
63+
5264
SDKs provide a <PlatformIdentifier name="before-send" /> hook, which is invoked before an error or message event is sent and can be used to modify event data to remove sensitive information. Some SDKs also provide a <PlatformIdentifier name="before-send-transaction" /> hook which does the same thing for transactions. We recommend using <PlatformIdentifier name="before-send" /> and <PlatformIdentifier name="before-send-transaction" /> in the SDKs to **scrub any data before it is sent**, to ensure that sensitive data never leaves the local environment.
5365

5466
<PlatformContent includePath="configuration/before-send" />

0 commit comments

Comments
 (0)