• Stars
    star
    174
  • Rank 219,104 (Top 5 %)
  • Language
    C#
  • License
    MIT License
  • Created about 6 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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.

Build Status Quality Gate Status Coverage NuGet Downloads NuGet Version

Json Masking

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.

This library matching insensitive values with field namespaces. You can use wildcard * to allow any char in pattern;

Sample

var example = new 
{
	SomeValue = "Demo",
	Password = "SomePasswordHere",
	DepthObject = new 
	{
		Password = "SomePasswordHere2",
		Card = new 
		{
			Number = "555500022223333"
		}
	},
	CreditCardNumber = "5555000011112222",
	Card = new 
	{
		Number = "555500022223333"
	}
};

var exampleAsString = JsonConvert.Serialize(example); // value must be a json string to masked

// note that password is only replaced when is in root path
var blacklist = new string[] { "password", "card.number", "*.card.number" "creditcardnumber" };
var mask = "******";

var maskedExampleAsString = exampleAsString.MaskFields(blacklist, mask);

Console.WriteLine(maskedExampleAsString);

Output

{
	"SomeValue" : "Demo",
	"Password" : "******",
	"DepthObject" : {
		"Password" : "SomePasswordHere2",
		"Card" : {
			"Number" : "******"
		}
	},
	"CreditCardNumber" : "******",
	"Card" : {
		"Number" : "******"
	}
}

Install via NuGet

PM> Install-Package JsonMasking

How can I contribute?

Please, refer to CONTRIBUTING

Found something strange or need a new feature?

Open a new Issue following our issue template ISSUE_TEMPLATE

Changelog

See in nuget version history

Did you like it? Please, make a donate :)

if you liked this project, please make a contribution and help to keep this and other initiatives, send me some Satochis.

BTC Wallet: 1G535x1rYdMo9CNdTGK3eG6XJddBHdaqfX

1G535x1rYdMo9CNdTGK3eG6XJddBHdaqfX

More Repositories

1

serilog-sinks-newrelic-logs

A Serilog sink that writes events to the NewRelic Logs.
C#
31
star
2

restsharp-serilog-auto

Automatic log request and response from RestSharp using Serilog
C#
23
star
3

woocommerce-docker

Docker for build a test woocommerce image
PHP
18
star
4

azure-devops-pipelines-demo

Azure DevOps (Build Pipeline and Relelse Pipeline) Demo
16
star
5

mongo-crud-dotnet

MongoCRUD base for dotnet applications. Never been so fast to implement with mongo.
C#
15
star
6

rancher-vss-ext

Rancher Upgrader! - Upgrade, rollback and finish upgrade from Azure DevOps Pipelines
TypeScript
11
star
7

aspnet-scaffolding3

AspNET Core 3.1 Scaffolding with log, serializer, all structure to work good for me :D
C#
11
star
8

elasticsearch-docker

Running elasticsearch, logstash, kibana with docker for tests.
8
star
9

thiagobarradas

7
star
10

dotnet-webapi-with-appveyor-demo

Continuous Integrations, Continuous Delivery and Continuous Deployment with .NET WebApi and AppVeyor
C#
7
star
11

serilog-builder

Builder for my common log format for dotnet, using console, seq and splunk, besides other configs.
C#
7
star
12

multi-redis-docker

Docker compose to run many redis instances
6
star
13

queue-consumer

A simple consumer for Rabbit MQ sending a post with basic auth and all structure for retry and dead queue.
C#
6
star
14

restsharp-easy

Complement for RestSharp to create fast and easily API Clients (SDK) with Newtonsoft serialization and Serilog Log
C#
6
star
15

elasticsearch-bulkandsearch-dotnet

Elasticsearch Easy Bulk and Search for Dotnet
C#
6
star
16

simple-tunnel

Simple Tunnel for HTTP API tests
C#
5
star
17

mundipagg-dotnet

Client for new Mundipagg API!
C#
5
star
18

elasticsearch7-docker

Demo project with elasticsearch 7
5
star
19

periodic-batching

Library with generic periodic batching for dotnet applications.
C#
5
star
20

class-structure-json

Describe your class structure as json
C#
5
star
21

stone-banking-jwt

Creates Jwt Authentication Token and Consent URL by RSA key pair
C#
5
star
22

runscope-vss-ext

Extension for Azure Pipelines to run integration tests with Runscope
JavaScript
5
star
23

webapi-models

Models to facilitate implementation and handling successful and error responses in web api.
C#
5
star
24

wordpress-docker

Docker for build a test wordpress image
PHP
4
star
25

rancher-docker

Container Management / Orchestration with Rancher - Demo
4
star
26

logstash-beats-demo

Elastic Stack with Nginx, Logstash and Beats demo
4
star
27

simple-auth-api

A simple auth API with dotnet core and mongodb
C#
4
star
28

logstash-filter-rediss

Redis (with SSL) Logstash Filter Plugin
Ruby
4
star
29

aspnet-serilog

AspNet Core Serilog component for help you log all request/response and exceptions.
C#
4
star
30

solid-open-closed-sample

SOLID Open-Closed Principle Sample
C#
4
star
31

opencart-docker

Docker for build a test opencart 3 image
PHP
4
star
32

ipinfo-api-client

IpInfo API client, a SDK for use IpInfo.Api
C#
4
star
33

nhibernate-netcore-demo

NHibernate with NETCore demo
C#
4
star
34

simple-auth-api-client

API Client for SimpleAuthAPI
C#
3
star
35

magento-docker

Docker for build a test magento image
Dockerfile
3
star
36

packutils

Some utilities for dotnet - String, json, signature, enum, hash, etc
C#
3
star
37

ipinfo-api

Proxy API some ip info service
C#
3
star
38

dotnet-core-webapi-with-docker-demo

ASP.NET Core Web API Demo with Docker, Nancy and Kestrel.
C#
3
star
39

nancy-scaffolding

Nancy Scaffolding with log, serializer, all structure to work good for me :D
C#
3
star
40

magento2-docker

Docker for build a test magento2 image
Shell
3
star
41

rancher-upgrader

Rancher Upgrader (for Rancher 1.6) - Upgrade, rollback and finish;
C#
3
star
42

queue-move

Simple Queue move that stops when finish :)
C#
2
star
43

json-field-selector

Library to allows select fields from json
C#
2
star
44

rabbit-alert

Rabbit Alert for Slack and Pushover - Checking queue counts
C#
2
star
45

pagedlist-netcore

Paged list for dotnet core applications
C#
2
star
46

uautil

User-Agent utility - Extract details from user-agent header
C#
2
star
47

nancy-serilog

Nancy Serilog component for help you log all request/response and exceptions.
C#
2
star
48

magento2-pagarme

PHP
2
star
49

serilog-sinks-influxdb

Serilog Sinks for InfluxDB
C#
2
star
50

environment-api

Basic API with "Get Environment" feature to use in demo projects
C#
2
star
51

rancher-drone-nginx

Docker CI & management with Drone + Rancher
2
star
52

blog42

Tudo o que você precisará quando o universo acabar é de uma toalha.
JavaScript
2
star
53

mongo-stateful-with-docker

Up a docker container with Mongo service keeping your data - Linux container running in Windows
2
star
54

postman-helper

JavaScript
2
star
55

deploy-notification-vss-ext

JavaScript
1
star
56

aspnet-scaffolding

AspNet Core Scaffolding with log, serializer, all structure to work good for me :D
C#
1
star
57

salary-calc

C#
1
star
58

type-extensions

type-extensions - demo for nuget package with multi-targeting;
C#
1
star
59

poloniex-api-client

Poloniex API client for dotnet standard 2.0
1
star
60

polrouteds-oracle-db-docker

C#
1
star
61

stone-prepay-apiclient

C#
1
star
62

azure-mq-demo

Azure MQ - Basic Demo
C#
1
star
63

sqlclient-parsetoobject

Easy SqlClient parse to object for .NET Core
C#
1
star