Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature to prevent accidental logging of sensitive fields? #993

Open
wunderwuzzi23 opened this issue Aug 25, 2021 · 3 comments
Open

Feature to prevent accidental logging of sensitive fields? #993

wunderwuzzi23 opened this issue Aug 25, 2021 · 3 comments
Labels

Comments

@wunderwuzzi23
Copy link

When using .Any I sometimes noticed reviewing/writing code that large structs are logged for debugging purposes but they might contain sensitive fields (that shouldn't be logged).

Was wondering if fields augmented with a sensitive or donotlog tag could be obfuscated with maybe *** or omitted when logging.

When logging individual fields its more likely that the developer notices a field is a token or a password and does not log it, but when using .Any it happens sometimes.

@dray92
Copy link

dray92 commented Aug 25, 2021

On a related note, does it make the most sense to have something like this live in the encoder impls {source}?

@juampynr
Copy link
Contributor

My understanding is that Zap is a structured logging library. Therefore, .Any() should be used as little as possible, which reduces the possibility of logging sensitive data.

@mway
Copy link
Member

mway commented Jun 27, 2022

It's probably not reasonable for Zap to support any "contextual" understanding of the data in fields that will be logged. Instead, callers should do any scrubbing prior to adding that data to a Field.

It's possible that we could add "field preprocessors" that invoke a UDF prior to encoding (which would still require users to define that scrubbing logic themselves), but we don't have any plans for this at the moment. I'll keep this open to track.

@mway mway added the proposal label Jun 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

4 participants