npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

blur-sensitive-data

v1.2.0

Published

Remove any sensitive information instantly from your data

Downloads

246

Readme

A simple tool to remove all sensitive data from structures, so they can be used safely. Go from my credit card number is 4024-0071-4571-8614 to my credit card number is NOT_VISIBLE and much more!

Maintainability Test Coverage

Installing

Using npm:

$ npm install blur-sensitive-data

Using yarn:

$ yarn add blur-sensitive-data

How to use

const ob = require('blur-sensitive-data');

const obf = new ob.Obfuscator().blur("Credit Card Number 4024-0071-4571-8614");

//output: Credit Card Number NOT_VISIBLE_SECURITY_REASON

| STRUCTURES | DESCRIPTION | |------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | object | Obfuscation happens on any value at which the key is considered sensitive. +2k keys are parsed by default and you can add more values to obfuscate, the default fields are based on cabinjs sensitive list. | | string | The obfuscation happens in the patterns that are considered sensitive, the match is done by regex. By default we offer some patterns to obfuscate whether the sentence is formatted or not: Brazilian CPF, Brazilian CNPJ, Brazilian RG, Phone Number, Object Id, UUID and Credit Card Number, other values can be added. |

Objects

The library supports objects whether they are simple or deep, keyword scanning is done on the entire object, there is also a layer to remove circular dependency if it is present.

import Obfuscator from 'blur-sensitive-data';

const dirtyObjectData = {
    Api_key: 'test string api_key',
    test: 'test string teste',
    some: {
        password: 'test string password',
        test: {
            password: 'test string nested password',
            obfuscator: 'test string obfuscator'
        }
    }
}
const configObject = {
    additionalObjectKeys: ['obfuscator']
}

const obf = new Obfuscator(configObject);
const clearData = obf.blur(dirtyObjectData);

//Output:
//{
//    password: 'NOT_VISIBLE_SECURITY_REASON',
//    Api_key: 'NOT_VISIBLE_SECURITY_REASON',
//    test: 'test string teste',
//    some: {
//      password: 'NOT_VISIBLE_SECURITY_REASON',
//      test: {
//        password: 'NOT_VISIBLE_SECURITY_REASON',
//        obfuscator: 'NOT_VISIBLE_SECURITY_REASON'
//    }
//}
//}

Possible parameters for customizing objects obfuscator

| PARAM | TYPE | MANDATORY | DESCRIPTION | |----------------------|------------|-----------|------------------------------------------------| | replacerText | string | :x: | Text to make sensitive parameter substitution. | | additionalObjectKeys | string[] | :x: | Additional keys to obfuscate. |

String

The library supports type string, in this case the obfuscation is done by matching the searched pattern, whether it is presented only in the sentence or multiple times, and can be in several differents formats and/or intertwined with other texts.

import Obfuscator from 'blur-sensitive-data';

const dirtyStringData = 'this is a string with Credit Card Number 4024-0071-4571-8614, CPF 222.222.222-22 with obfuscator';
const configObject = {
    replacerText: 'NOT_VISIBLE',
    stringPatterns: [Obfuscator.EStringLookUpFields.CPF, Obfuscator.EStringLookUpFields.CREDIT_CARD],
    additionalStringPatterns: [/obfuscator/]
}

const obf = new Obfuscator(configObject);
const clearData = obf.blur(dirtyStringData);

//output: this is a string with Credit Card Number NOT_VISIBLE, CPF NOT_VISIBLE with NOT_VISIBLE

Possible parameters for customizing the strings obfuscator

| PARAM | TYPE | MANDATORY | DESCRIPTION | |--------------------------|-------------------------|------------|---------------------------------------------------------------------------------------------------------------| | replacerText | string | :x: | Text to make sensitive parameter substitution. | | stringPatterns | EStringLookUpFields[] | :x: | Sensitive default settings for substitution. If omitted, obfuscation will be done by default sensitive types. | | additionalStringPatterns | RegExp[] | :x: | Alternative patterns for obfuscating. |