ThiagoBarradas / jsonmasking

Replace fields in json, replacing by something, don't care if property is in depth objects. Very useful to replace passwords credit card number, etc.
MIT License
174 stars 47 forks source link

[Feature] Add validation on dictionary value #10

Closed kzanetty closed 4 months ago

kzanetty commented 4 months ago

shame-on-you-sad

Status

READY

Whats?

Add validation to ensure that the value is not null. If it is, the field should be completely masked.

Why?

Currently, if null is passed as the value, JsonMasking is aborted and AspNet.Serilog returns the object unchanged, exposing all data. This results in logs containing open card data and other sensitive information.

How?

This can be resolved by adding a simple validation. If the delegate is null, it should completely mask the data instead of aborting the JsonMasking.

Attachments (if appropriate)

image

image

Definition of Done:

codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 100.00%. Comparing base (d8831e2) to head (c0e90cd).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #10 +/- ## =========================================== + Coverage 93.84% 100.00% +6.15% =========================================== Files 1 1 Lines 65 65 Branches 19 20 +1 =========================================== + Hits 61 65 +4 + Misses 3 0 -3 + Partials 1 0 -1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.