0.9.6 • Published 3 years ago

nebulize v0.9.6

Weekly downloads
2
License
MIT
Repository
github
Last release
3 years ago

Nebulize

Nebulize Security-Sensitive Information

About

Nebulize is a small JavaScript library, providing the capability to nebulize security-sensitive information in data by anonymization (replacing with random-based UUID version 4), pseudonymization (replacing with hash-based UUID version 5), blacking (replacing with # characters) or substitution (replacing with custom characters). This nebulization approach is especially intended to support applications in their filtering of log messages from sensitive information in order to be compliant to the EU General Data Protection Regulation (GDPR).

Installation

$ npm install nebulize

Usage

const Nebulize = require("nebulize")
const expect   = require("chai").expect

let ds = new Nebulize()
ds.filter("**", "foo", "bar")
expect(ds.nebulize("foo")).to.be.equal("bar")

let data = {
    foo: "foo", bar: 42, baz: true,
    quux: [ "foo", 42, true ],
    username: "example",
    password: "secret"
}

Application Programming Interface (API)

  • new Nebulize(): Nebulize: Create a new Nebulize context.

  • Nebulize#filter(pathMatch: string|function, dataMatch: RegExp|string|number|boolean|function, dataReplace: string|number|boolean|function): Nebulize: Add a filter to the context, based on tree parameters:

    • pathMatch: either a Unix glob pattern string or a callback function of signature (path: string) => boolean. The callback function receives the path from the root of the data object (as passed to method nebulize()) to the current nebulized leaf object as a dot-separated path and has to return true when the dataMatch and dataReplace should be applied.

    • dataMatch: FIXME

    • dataReplace: FIXME

  • Nebulize#nebulize(data: any): any: Nebulize arbitrary data based on filters in context. The data is recursively traversed and all filters applied to all leaf data.

License

Copyright (c) 2018-2021 Dr. Ralf S. Engelschall (http://engelschall.com/)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.