Giter VIP home page Giter VIP logo

data-sanitizer's Introduction

DataSanitizer

TL;DR: DataSanitizer - A lightweight, user-friendly Python tool that transforms sensitive database content into fake, coherent data to maintain privacy and compliance during development and testing.

DataSanitizer is a powerful and customizable Python script designed to desensitize sensitive data in databases, providing a secure and compliant solution for developers and testers. By replacing real data with realistic, yet fake information, DataSanitizer maintains the integrity of database relationships and logic while protecting the privacy of the original data. This ensures that developers can work with desensitized data, minimizing the risk of accidental data leaks and maintaining compliance with data protection regulations. DataSanitizer is highly configurable, allowing users to define which data columns need to be altered and the type of fake data to be generated for each column. With an easy-to-use interface and flexible options, DataSanitizer streamlines the process of data desensitization, enhancing the overall security and compliance of your development and testing workflows.

Prerequisites

  • Python 3.9 or higher
  • Pip (Python Package Installer)

Dependencies

Install the required dependencies by running:

python -m venv .venv
source .venv/bin/activate
pip install -U pip
pip install -r requirements.txt

Configuration

  1. Create a .env file in the project's root directory, containing your database credentials:
DB_USER=your_database_user
DB_PASSWORD=your_database_password
DB_HOST=your_database_host
DB_NAME=your_database_name
  1. Configure the config.json file to specify the tables and columns to be desensitized, along with the data types for generating fake data. Here's an example:
{
    "output_format": "csv",
    "tables": [
        {
            "name": "customers",
            "columns": [
                { "name": "customerName", "type": "company" },
                { "name": "contactLastName", "type": "last_name" },
                { "name": "contactFirstName", "type": "first_name" },
                { "name": "phone", "type": "phone" },
                { "name": "addressLine1", "type": "address" },
                { "name": "addressLine2", "type": "blank" },
                { "name": "city", "type": "city" },
                { "name": "state", "type": "state" },
                { "name": "postalCode", "type": "postal_code" },
                { "name": "country", "type": "country" },
                { "name": "creditLimit", "type": "float" }
            ]
        },
        {
            "name": "payments",
            "columns": [
                { "name": "paymentDate", "type": "date" },
                { "name": "checkNumber", "type": "check" },
                { "name": "amount", "type": "float" }
            ]
        }
    ]
}

Usage

Run the script with the following command:

python desensitize.py

The desensitized data will be saved as CSV or SQL files (depending on your choice in the script) in a folder named after the database.

PS.: it is important to control the access to the config.json file which has the power to unmask data. In other words, only the data admin or the sys admin should be the one able to change the config.json file.

Contributing

Contributions are welcome! Please feel free to submit a pull request or open an issue for any improvements or bug fixes.

License

This project is released under the MIT License.

data-sanitizer's People

Contributors

bmro avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

data-sanitizer's Issues

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.