-
Notifications
You must be signed in to change notification settings - Fork 115
Description
According to EEF security guidance one of the best ways to protect sensitive data, such as security-related (tokens, passwords) or PII from accidental leakage is to wrap it in a closure. Other ways such as flagging the whole process as sensitive or post-processing stacktraces have significant downsides, limited effect and seem less optimal.
What if Mint allowed to pass some fields, such as headers, path (URLs may also contain sensitive info when we have to deal with 3rd party services outside of our control), etc in closures ? The closure could return {redacted, raw} pair (just an example, other wrappers could be used, but the raw value must be enclosed). Then
- Mint would use the raw value only when sending the request to the socket
- downstream libraries (Finch, Req and others) would obviously need to become aware of this feature, and use it accordingly
- logging/telemetry libraries would also need to adapt to it, and use redacted value everywhere where they previously used the raw value
What I also like about this approach is that all involved libraries don't need to know what kind of value it is and how to redact it. The caller provides both versions so no additional abstractions are needed.