Skip to main content

A HashiCorp Vault operator that allows anonymization and de-anonymization using Microsoft Presidio.

Project description

Presidio Vault Operator

A library that allows to integrate presidio with HashiCorp Vault for anonymization and deanonymization.

Getting started

Installation

Install the Vault Operator using pip:

pip install presidio-vault

Using the Vault Operator

Once the library is installed you can start using it in conjunction with presidio analyzer(Make sure you pip install the analyzer as well) as follows:

from presidio_analyzer.analyzer_engine import AnalyzerEngine
from presidio_vault.vault import Vault

text = "My phone number is 212-555-5555"
analyzer_results = AnalyzerEngine().analyze(text=text, language="en")

vaulturl="http://127.0.0.1:8200"
vaultkey="orders"
vaulttoken="" # optional token

vault = Vault(vaulturl, vaultkey, vaulttoken)
anonymizer_results = vault.anonymize(text, analyzer_results)
print(anonymizer_results)

deanonymizer_results = vault.deanonymize(anonymizer_results.text, anonymizer_results.items)
print(deanonymizer_results)

For an example of how it is used, have a look at the pii-detector-and-anonymizer.

Contributing

Local development setup

Run ./setup.sh to install all dependencies. This will install direnv and nix then simply run direnv allow to install all build dependencies.

Alternatively, make sure you have python 3.8 or greater and poetry setup on your machine.

To get started, run the following:

poetry install --no-interaction --no-root
poetry run pytest

Troubleshooting local setup

There is a chance that direnv allow will not load the environment correctly and silently fail. This is observable when you attempt to run poetry install, as you will get a command not found error in the shell. To fix this, you need to run the nix commands directly. Run the following:

nix --extra-experimental-features 'nix-command flakes' develop

This command will spawn a new shell which has the nix dependencies loaded. You will need to run commands from this prompt.

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

presidio_vault-0.1.0.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

presidio_vault-0.1.0-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file presidio_vault-0.1.0.tar.gz.

File metadata

  • Download URL: presidio_vault-0.1.0.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for presidio_vault-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6eb2a974be4ee87fe04265937a1633a7d42574bdda56f85c5ce338a543531303
MD5 94397221dddc9cd9f7d666ff10082d66
BLAKE2b-256 b8f7470548e5bac70191fc4b000029f202a9f4c6266d066910be35bac6023ef1

See more details on using hashes here.

File details

Details for the file presidio_vault-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for presidio_vault-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1ebcd8797ad93dd9dde1f00ccf4df8c8e10d7ba670c573c3c9421755b783c9a2
MD5 e4000ddb3314d4bd7e6617fcacdbb90e
BLAKE2b-256 624dae6a3cfb22ba88af8e0e4b1e393c15d1d0f4c7564143e2b6d47a29658ee3

See more details on using hashes here.

Supported by

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