Code Monkey home page Code Monkey logo

json-masker's Issues

whitelisting

Problem

Despite json-masker library is pretty good with masking sensitive data in general case, it masks too much in some situations. For example, we have to hide sensitive data in an array of patch instructions.
Thus,

[

{"op": "replace", "path": "customer/customerIdentity/firstName", "value": "the_new_customer_name"},

{"op": "replace", "path": "customer/customerIdentifier/sourceMarket", "value": "GB"}

]

will be transformed to something like:

[
    {"op": "xxxxxxx", "path": "xxxxxxxxxx/xxxxxxx/xxxXxx", "value": "XxxxxxxXxxx*"},
    {"op": "xxxxxxx", "path": "xxxxxxxxxx/xxxxxxx/xxxXxxx", "value": "XxxxxxxXxxx*"}
]

We are 100% sure that "op" and "path" fields never contain sensitive info, but the values of those fields could be useful for debug purpose. The solution might be whitelisting of exact fields.

Possible solutions

  1. by array of keys
    For example, we can say that ['op', 'path'] values should never be masked no matter where we find these keys in json structure. This solution is the simplest but as a drawback, there is a chance to unmask something that we didn't want to. However, from my point of view, the probability of such problem is very low.
  2. by exact keys (full path in json)
    This is the most secure variant, but it also has a drawback. It could be hard to cover the case from the problem description as it is not clear, how to deal with arrays.
  3. by regexp
    This is the most flexible solution, but we still can accidentally unmask something unwanted. Moreover, it could cause the performance issue which is bad for lightweight logging related library.
  4. mix of all previous
    Could contain all the problems from all solutions and have a too complex configuration.

I propose to start with the first variant, at least to begin with. @shumsky what do you think?

Allow Blacklisting also

Is there any way to allow blacklisting instead of whitelisting, so we will mention the fields name to be masked and remaining fields will not be masked.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.