Skip to main content

A simple Django app to mask sensitive data in forms.

Project description

Data Masker is a simple Django app to do data masking. It masks sensitive data by name of form fields and is highly configurable. Currently CharField and EmailField are supported.

Quick start

  1. Add data_masker to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = [
        ...
        'data_masker',
    ]
  2. In template, pass the form which contains sensitive data to mask_form tag before any rendering tags.

Example template

{# Load the tag library #}
{% load data_masker %}

{# Display a form #}
<form action="/url/to/submit/" method="post" class="form">
  {% csrf_token %}
  {# Mask the form #}
  {% mask_form form as masked_form %}
  {{ masked_form }}

  {# It also works well with django-bootstrap #}
  {% comment %}
  {% bootstrap_form masked_form %}
  {% endcomment %}

  <button type="submit">Submit</button>
</form>

Settings

django-data-masker has some pre-configured settings which can be modified by adding variables with DATA_MASKER_ prefix in your settings.py and customizing the values you want.

Variable

Usage

Default

DATA_MASKER_CLEAR_HEADING

Number of heading characters to leave untouched

2

DATA_MASKER_CLEAR_TAILING

Number of tailing characters to leave untouched

2

DATA_MASKER_MASK_FULL_EMAIL

Mask full email address including domainname part

False

DATA_MASKER_FIELD_LIST

List of field name to mask

[‘account_name’, ‘account_number’, ‘email’]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-data-masker-1.1.1.tar.gz (4.3 kB view details)

Uploaded Source

File details

Details for the file django-data-masker-1.1.1.tar.gz.

File metadata

  • Download URL: django-data-masker-1.1.1.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.5.2

File hashes

Hashes for django-data-masker-1.1.1.tar.gz
Algorithm Hash digest
SHA256 64a23ff67a7934ed94cf355ed03f1a9debdbca8d5b163ccca4d300d1b0d77c68
MD5 4c0827c5096f7ad3c5a01191a77f31a6
BLAKE2b-256 5a434a9727ee4d32b0436d7710a4d81905c42da79dadbe1bac689b884c7f9ab5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page