Anonymizer
Library to clean up Ansible tasks from any Personally Identifiable Information (PII)
Free software: Apache Software License 2.0
Anonymized fields
Credit Card number
email address
IP address
MAC address
US SSN
US phone number
YAML comment
password value, when the field name is identified as being sensitive
user name from home directory path
Usage
The library can be used to remove the PII from a multi level structure:
from ansible_anonymizer.anonymizer import anonymize_struct
example = [{"name": "foo bar", "email": "my-email@address.com"}]
anonymize_struct(example)
# [{'name': 'foo bar', 'email': 'noah2@example.com'}]
But you can also anonymize a block of text:
from ansible_anonymizer.anonymizer import anonymize_text_block
some_text = """
- name: a task
a_module:
secret: foobar
"""
anonymize_text_block(some_text)
# '\n- name: a task\n a_module:\n secret: "{{ secret }}"\n'
You can also use the ansible-anonymizer command:
ansible-anonymizer my-secret-file
Customize the anonymized strings
By default, the variables are anonymized with a string based on the name of the field. You can customize it with the value_template parameter:
from ansible_anonymizer.anonymizer import anonymize_struct
from string import Template
original = {"password": "$RvEDSRW#R"}
value_template = Template("_${variable_name}_")
anonymize_struct(original, value_template=value_template)
# {'password': '_password_'}
Limitations
anonymize_text_block() relies on its own text parser which only support a subset of YAML features. Because of this, it may not be able to identify some PII. When possible, use anonymize_struct which accepts a Python structure instead.
The Anonymizer is not a silver bullet and it’s still possible to see PII going through the filters.
Metadata
Release files for ansible-anonymizer 1.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| ansible-anonymizer-1.5.0.tar.gz | 23.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ansible_anonymizer-1.5.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 37.6 kB
Release files / ansible-anonymizer-1.5.0.tar.gz
| Download URL | ansible-anonymizer-1.5.0.tar.gz |
|---|---|
| Size | 23.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6c2f3aacb17d755195e15540baba75ef4110f34145c4cbd20f74516c14ba6729
|
|
BLAKE2b-256 checksum How to use checksums |
69f6391d66d11d16eb98cd34b82bce62ee9afd2ea4b73f1b4734d1d78eb225b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Release files / ansible_anonymizer-1.5.0-py3-none-any.whl
| Download URL | ansible_anonymizer-1.5.0-py3-none-any.whl |
|---|---|
| Size | 13.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
756501ee757d8efcb16340260952b7726a413521b006f30d0706b5bec807d74c
|
|
BLAKE2b-256 checksum How to use checksums |
56911b7e0dd4ae4f7579f607e5fd71d226cb9faaf5298f8dbdc5b5641d8476fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Security for ansible-anonymizer 1.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.