Masking properties with Full Name
Opened this issue · 4 comments
Is it possible to use MaskingProperties
with full name. I mean with namespace like Project1.Class1.Property1
.
like
var logger = new LoggerConfiguration()
.Enrich.WithSensitiveDataMasking(options => options.MaskProperties.Add("Project1.Class1.Property1"))
.WriteTo.Console()
.CreateLogger();
We have different classes with same property names.
We would like to mask properties in curtain classes.
Thank for any advice.
Let me see if I understand what you’re trying to accomplish before I offer a suggestion 🙂
From what you’re writing you have a number of classes like this (other properties omitted):
class NamespaceOne.ClassOne {
public string Thing { get; }
}
class NamespaceTwo.ClassTwo {
public string Thing { get; }
}
class NamespaceThree.ClassThree {
public string Thing { get; }
}
and what you want to achieve is that (for example) you only want the property Thing
for ClassThree
to be masked but for ClassOne
and ClassTwo
no masking of that property should happen.
Is that correct?
correct
would you provide any advices?
I've experimented a bit and it turns out this is not possible to achieve unfortunately due to the fact that when the masking runs we don't have the necessary type information anymore to make any kind of masking decision.
An alternative would be to use sensitive areas in the places where you do want to mask the given property. That might give you enough control to work with for your scenario.