jupyter / jupyter_events

Configurable event system for Jupyter applications and extensions.
https://jupyter-events.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
12 stars 21 forks source link

Add "redactors" API to enable easy redacting of (possibly sensitive) data #13

Open Zsailer opened 2 years ago

Zsailer commented 2 years ago

Building on https://github.com/jupyter/jupyter_events/pull/12, this adds a set of helpful "modifiers" that are specifically designed to redact data from events. These objects are configurable and easy to extend.

An immediate use-case for these redactors is to redact sensitive data. As Jupyter applications begin to emit events, it's critical that we provide easy configuration to handle sensitive data under different deployment requirements. This API becomes the foundation for these applications or deployers to easily redact sensitive data in ways that suit their requirements.

The API is quite simple. To redact events, either configure or extend one of the provided Redactor classes. Redactors can act on whole schemas, individual properties within schemas, or all properties that match a certain (regex) pattern. They can be appended to the EventLogger through the .add_modifier API and chained with other modifiers to mutate events.

Over time, we can offer different types of Redactors as the need arises. In this PR, I've provided a MaskRedactor (just replaced redacted values with a configurable string) and a RemovalRedactor (deletes key/values from a schema).

Todo: