{"id":50533183,"url":"https://github.com/daedalus/pii-safe","last_synced_at":"2026-06-03T15:30:28.287Z","repository":{"id":355328078,"uuid":"1219268070","full_name":"daedalus/pii-safe","owner":"daedalus","description":"Redact PII from text","archived":false,"fork":false,"pushed_at":"2026-05-03T02:08:55.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-05-03T04:13:30.735Z","etag":null,"topics":["openai","personal-identifiable-information","pii","pii-redaction","pii-safety"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/daedalus.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-04-23T17:48:00.000Z","updated_at":"2026-05-03T02:08:59.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/daedalus/pii-safe","commit_stats":null,"previous_names":["daedalus/pii-safe"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/daedalus/pii-safe","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daedalus%2Fpii-safe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daedalus%2Fpii-safe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daedalus%2Fpii-safe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daedalus%2Fpii-safe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daedalus","download_url":"https://codeload.github.com/daedalus/pii-safe/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daedalus%2Fpii-safe/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33872297,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-03T02:00:06.370Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["openai","personal-identifiable-information","pii","pii-redaction","pii-safety"],"created_at":"2026-06-03T15:30:25.651Z","updated_at":"2026-06-03T15:30:28.279Z","avatar_url":"https://github.com/daedalus.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pii-safe — Redact PII from text\n\n[![PyPI](https://img.shields.io/pypi/v/pii-safe.svg)](https://pypi.org/project/pii-safe/)\n[![Python](https://img.shields.io/pypi/pyversions/pii-safe.svg)](https://pypi.org/project/pii-safe/)\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/daedalus/pii-safe)\n\nUses the [OpenAI Privacy Filter](https://openai.com/index/introducing-openai-privacy-filter/) model to detect and redact personally identifiable information (PII) from text.\n\n## Why hash-based redaction?\n\nPlain `[REDACTED]` placeholders lose all information about which PII values are the same. Using `hash(salt | pii_data)` instead:\n\n- **Consistent identifiers**: The same PII always maps to the same hash, enabling cross-document correlation (e.g., \"how many documents mention the same person?\")\n- **Reversible with salt**: With the salt, you can recompute hashes to identify original PII if needed\n- **Salt prevents rainbow table attacks**: Without a salt, hashes could be precomputed for common names/emails to reverse-identify PII from redacted text\n\n## Install\n\n```bash\npip install pii-safe\n```\n\n## Usage\n\n```python\nfrom pii_safe import redact_text\n\ntext = \"mi nombre es Dario Clavijo\"\nredacted = redact_text(text)\nprint(redacted)  # mi nombre es[REDACTED_\u003chash\u003e]\n```\n\n### Salt for hashing\n\nBy default, a random 64-character salt is generated at startup. You can specify a salt to ensure consistent hashing across runs:\n\n```python\nfrom pii_safe import redact_text, set_salt\n\n# Option 1: Pass salt to redact_text\nredacted = redact_text(\"mi nombre es Dario Clavijo\", salt=\"my_secret_salt\")\n\n# Option 2: Set salt globally\nset_salt(\"my_secret_salt\")\nredacted = redact_text(\"mi nombre es Dario Clavijo\")\n```\n\n### Using the Redacter class\n\n```python\nfrom pii_safe import Redacter\n\nredacter = Redacter(salt=\"my_secret_salt\")\nresult1 = redacter.redact(\"mi nombre es Dario Clavijo\")\nresult2 = redacter.redact(\"el es Dario Clavijo\")\n\n# Same PII gets consistent hash within this instance\nhash_map = redacter.get_hash_map()\nprint(hash_map)  # {' Dario Clavijo': '\u003chash\u003e'}\n```\n\n## CLI\n\n```bash\npii-safe input.txt\npii-safe input.txt -o output.txt\npii-safe input.txt --salt my_secret_salt\n```\n\n## Development\n\n```bash\ngit clone https://github.com/daedalus/pii-safe.git\ncd pii-safe\npip install -e \".[test]\"\n\n# run tests\npytest\n\n# format\nruff format src/ tests/\n\n# lint\nruff check src/ tests/\n\n# type check\nmypy src/\n```\n\n## API\n\n### `redact_text(text: str, salt: str | None = None) -\u003e str`\n\nRedacts PII from text using the openai/privacy-filter model.\n\n### `set_salt(salt: str) -\u003e None`\n\nSet the salt for hashing PII in the default redacter.\n\n### `class Redacter`\n\nContext manager for consistent PII-to-hash mapping across calls.\n\n- `__init__(salt: str | None = None)`: Initialize with optional salt\n- `redact(text: str) -\u003e str`: Redact PII from text\n- `get_hash_map() -\u003e dict[str, str]`: Get PII-to-hash mapping","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaedalus%2Fpii-safe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaedalus%2Fpii-safe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaedalus%2Fpii-safe/lists"}