Serilog.Enrichers.Sensitive icon indicating copy to clipboard operation
Serilog.Enrichers.Sensitive copied to clipboard

Feature request - add customMaskingOperator option to items in maskProperties list.

Open mistyn8 opened this issue 1 year ago • 2 comments

Thought it would be a good idea, to say

options.MaskProperties.Add("_Password", PasswordMaskingOperator);

That way we can have the same extensiblity to say leave first and last char exposed?

Or maybe extending on the mask, rather than just a simple replace have some options? options.MaskProperties.Add("_Password", new maskoptions {showFirst:2, showLast:2, preservelenght:true)});

(I admit taking inspiration from https://github.com/destructurama/attributed/blob/dev/src/Destructurama.Attributed/Attributed/LogMaskedAttribute.cs)

mistyn8 avatar Mar 28 '23 14:03 mistyn8

100% agree

IMCubator-CI avatar Jan 02 '24 15:01 IMCubator-CI

I've taken a stab at this, have a look at WhenMaskingWithOptions.cs for how this will work.

There is a problem that this currently breaks the JSON configuration capabilities so this might change.

sandermvanvliet avatar Jan 07 '24 20:01 sandermvanvliet