Sanitized sensitive information from your database dumps
Project description
# django-sanitized-dump
Sanitized sensitive information from your database dumps 💩
# DB Sanitization
### Configuration
#### Example config
```yaml
config:
addons:
- "ai-senitizers"
- "some-other-lib"
strategy:
user:
first_name: "name.first_name"
last_name: "name.last_name"
education:
created: null
modified: null
id: null
field: "education.field"
school: "education.school"
started: "datetime.datetime"
credits: null
information: "string.loremipsum_preserved"
file_file: null
```
#### Example custom sanitizers
```python
# /sanitizers/name.py
def sanitize_first_name(value):
return faker.first_name()
def sanitize_last_name(value):
return faker.last_name()
# /sanitizers/education.py
def sanitize_field(value):""
return "Some field"
def sanitize_schoo(value):
return "My school"
```
#### Validating sanitizer return value
> Note: This should not be done in the initial implementation of the sanitizer but is up to the sanitizer funtions. This is just a nice to have but not of a high priority.
Check that the returned value is of the same type as the argument value passed to the sanitizer.
For instance, if a MySQL DATETIME value is passed to the sanitizer, a MySQL DATETIME value shoud be returned as well.
#### Configuration method resolution order
1. Custom sanitizers inside ./sanitizers
2. Addon sanitizers (`config.addons`)
3. Core sanitizers
### Django Management Commands
#### Sanitized Dump
`./manage.py sanitized_dump -c > dump.sql`
1. Warn about unhandled fields
2. Creates a database dump (`mysqldump`/`pgdump`)
3. Run sanitazier
#### Check Sanitize Dump
`./manage.py sanitized_dump -c`
1. Returns an error code if there are unhandled database fields
#### Init Sanitizer
`./manage.py init_sanitizer`
1. Create configuration from current database state
Sanitized sensitive information from your database dumps 💩
# DB Sanitization
### Configuration
#### Example config
```yaml
config:
addons:
- "ai-senitizers"
- "some-other-lib"
strategy:
user:
first_name: "name.first_name"
last_name: "name.last_name"
education:
created: null
modified: null
id: null
field: "education.field"
school: "education.school"
started: "datetime.datetime"
credits: null
information: "string.loremipsum_preserved"
file_file: null
```
#### Example custom sanitizers
```python
# /sanitizers/name.py
def sanitize_first_name(value):
return faker.first_name()
def sanitize_last_name(value):
return faker.last_name()
# /sanitizers/education.py
def sanitize_field(value):""
return "Some field"
def sanitize_schoo(value):
return "My school"
```
#### Validating sanitizer return value
> Note: This should not be done in the initial implementation of the sanitizer but is up to the sanitizer funtions. This is just a nice to have but not of a high priority.
Check that the returned value is of the same type as the argument value passed to the sanitizer.
For instance, if a MySQL DATETIME value is passed to the sanitizer, a MySQL DATETIME value shoud be returned as well.
#### Configuration method resolution order
1. Custom sanitizers inside ./sanitizers
2. Addon sanitizers (`config.addons`)
3. Core sanitizers
### Django Management Commands
#### Sanitized Dump
`./manage.py sanitized_dump -c > dump.sql`
1. Warn about unhandled fields
2. Creates a database dump (`mysqldump`/`pgdump`)
3. Run sanitazier
#### Check Sanitize Dump
`./manage.py sanitized_dump -c`
1. Returns an error code if there are unhandled database fields
#### Init Sanitizer
`./manage.py init_sanitizer`
1. Create configuration from current database state
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for django-sanitized-dump-0.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8368e7b9299f089446978e53c0863a2e3d7c0e52bb8fed13e1e8b95505c58c2c |
|
MD5 | e2650f79f0cee4d50d29dcec7e0ed142 |
|
BLAKE2b-256 | 3e1fe7cd0bfc72c644946cb0c45ef6558440de6c18aed0ba11cca3790b347012 |
Close
Hashes for django_sanitized_dump-0.2.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87fb8dd8d58b8768fced83fb54059fca83810d23975f53a25aef8fe225193c6a |
|
MD5 | b5294dc0d4eca7e624b0b3fc9b44c7a7 |
|
BLAKE2b-256 | f09a7f22750f8b46890528cc6e98948298363a6a360bc24f553f5d780130a4f1 |