Skip to main content
https://img.shields.io/pypi/v/django-db-obfuscator.svg https://img.shields.io/travis/oesah/django-db-obfuscator.svg Documentation Status Updates

Django app to obfuscate text data. Originally develop by Dipcode Software.

Compatibility

Tested with python 3.6, 3.7, 3.8 and Django 1.11 & 2.2: Travis CI

How to install

To install the app run:

$ pip install django-db-obfuscater

or add it to the list of requirements of your project.

Then add ‘obfuscator’ to your INSTALLED_APPS.

INSTALLED_APPS = [
    ...
    'obfuscator',
]

Example usage

On you django project settings, configure the model names and field names to be obfuscated:

OBFUSCATOR = {
    'FIELDS': {
        'app_label.ModelClass1': ['field1', 'field2', 'field3'],
        'app_label.ModelClass2': ['field1'],
        // ...
    }
}

Run the management command to start obfuscation:

$ python manage.py obfuscate

You can run the management command passing as arguments: a model class path and a list of fields to obfuscate (thus will ignore FIELDS setting):

$ python manage.py obfuscate --model=app_label.ModelClass1 --fields=field1, field2, field3

Settings reference

OBFUSCATOR_CLASS

Default: obfuscator.utils.ObfuscatorUtils

Path to class where obfuscator methods are defined. By default, the class define tow obfuscator methods: * text - Obfuscate simple text data, respecting max-length field parameter; * email - Obfuscate email data. Only text before @ is obfuscated, respecting max-length field parameter.

This class also define an obfuscate method. This method use fields mapping (see FIELDS_MAPPING setting) to route the field type with the obfuscate method.

You can redefine this class by subclassing the default class and changing this setting to point to your class.

FIELDS_MAPPING

Default:

OBFUSCATOR = {
    'FIELDS_MAPPING': {
        models.CharField: 'text',
        models.TextField: 'text',
        models.EmailField: 'email',
        models.IntegerField: 'number',
        models.URLField: 'text',
        // ...
    }
}

Map django model field types with obfuscator methods.

FIELDS

Default: {}

Fields to be obfuscated and respective model class path. Must be a dict with keys as python dot notation to path where the models are declared and the values must be declared as lists of model fields.

If no value defined, the management command will do nothing.

Example:

OBFUSCATOR = {
    'FIELDS': {
        'contenttypes.ContentType': ['model', 'label'],
        // ...
    }
}

License

MIT license, see the LICENSE file. You can use obfuscator in open source projects and commercial products.

TODO

  • add logic to handle superusers, if needed

Metadata

Release files for django-db-obfuscator 0.5.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-db-obfuscator 0.5.3
File Size Uploaded
django-db-obfuscator-0.5.3.tar.gz 12.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-db-obfuscator 0.5.3
File Interpreter ABI Platform
django_db_obfuscator-0.5.3-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 23.6 kB

Release files / django-db-obfuscator-0.5.3.tar.gz

Download URL django-db-obfuscator-0.5.3.tar.gz
Size 12.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c8fdb9b684cd61bdd88bf19429db0f6722733ab612a655c8066912eb9cba5d1f
BLAKE2b-256 checksum
How to use checksums
364c68fb3e6ec514757537296760c8503652ac682b249da3898d59f9c27ba0bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.7

Release files / django_db_obfuscator-0.5.3-py2.py3-none-any.whl

Download URL django_db_obfuscator-0.5.3-py2.py3-none-any.whl
Size 10.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
2ebe51e832325bb77bfcf8fc2f17064cfeb0273e2c1c88443db93a06bdbde9ad
BLAKE2b-256 checksum
How to use checksums
9ba127dbfe1c1fb15ee50b01bb7bb538eed869d51ffcb376b8f6eba43b282bc5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.7

Release history Release notifications | RSS feed

This release

0.5.3 This release

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.6

2 release files

0.1.3

2 release files

0.1.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page