This is a simple package to process JSON files/input and redact values for keys that are deemed "sensitive"
Built as a technical assessment.
- Clone the repo from github:
-
ssh:
git clone git@github.com:KaitCrawford/JSON-Redactor.git -
https:
git clone https://github.com/KaitCrawford/JSON-Redactor.git
-
Navigate into the repo directory:
cd JSON-Redactor -
Create a virtual environment (using your prefered version of python >= 3.9):
python3.10 -m venv ve -
Activate the virtual environment:
source ve/bin/activate -
Install the package:
pip install .
To mask values for email and msisdn keys in a json file:
json_redactor --keys email,msisdn path/to/input/file.json
To provide input via stdin:
cat path/to/file.json | json_redactor --keys email,msisdn
To provide keys from a file (the keys must be on the first line in a comma separated list)
json_redactor --key-file path/to/keys.txt path/to/input/file.json
To hash values using with a deterministic SHA-256 hash:
json_redactor --keys email,msisdn --hash path/to/input/file.json