Coder Social home page Coder Social logo

rap2hpoutre / mongodb-anonymizer Goto Github PK

View Code? Open in Web Editor NEW
11.0 2.0 3.0 69 KB

Anonymize MongoDB database with a NodeJS CLI

Home Page: https://raph.site

License: MIT License

JavaScript 4.95% Batchfile 0.50% TypeScript 94.55%
nodejs javascript mongodb anonymization database hacktoberfest mongo

mongodb-anonymizer's Introduction

mongodb-anonymizer

MongoDB anonymzer tool. Export your MongoDB database anonymized from source to target. Replace all sensitive data thanks to faker.

oclif Version License

Usage

Run this command by giving a source URI and target URI (no need to install first thanks to npx):

npx mongodb-anonymizer \
  --uri=mongodb://localhost:27017/source \
  --targetUri=mongodb://localhost:27017/anonymized

โ˜๏ธ Be careful, since target collections will be removed.

Specify list of fields to anonymize

Use --list option with a comma separated list of column name:

npx mongodb-anonymizer  \
  --uri=mongodb://localhost:27017/source \
  --targetUri=mongodb://localhost:27017/anonymized
  --list=email,firstName,lastName,phone

Specifying another list via --list replace the default automatically anonymized values:

email,name,description,address,city,country,phone,comment,birthdate

You can also specify replacements for a specific collection:

users.email,products.price

Customize replacements

You can also choose which faker function you want to use to replace data (default is faker.random.word):

npx mongodb-anonymizer  \
  --uri=mongodb://localhost:27017/source \
  --targetUri=mongodb://localhost:27017/anonymized
  --list=firstName:faker.name.firstName,lastName:faker.name.lastName

๐Ÿ‘‰ You don't need to specify faker function since the command will try to find correct function via column name.

You can use plain text too for static replacements:

npx mongodb-anonymizer  \
  --uri=mongodb://localhost:27017/source \
  --targetUri=mongodb://localhost:27017/anonymized
  --list=textcol:hello,jsoncol:{},intcol:12

mongodb-anonymizer's People

Contributors

rap2hpoutre avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

mongodb-anonymizer's Issues

Handle sub-items

Only top level items are anonymized. In my case, I have
employee.firstName in the accountManagers collection.

These are not recognized. We would need a recursive function to drill down and find fields that match the list of field names.

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.