pii-airlock 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pii-airlock might be problematic. Click here for more details.
- pii_airlock-0.2.0/.github/ISSUE_TEMPLATE/bug_report.yml +52 -0
- pii_airlock-0.2.0/.github/ISSUE_TEMPLATE/config.yml +8 -0
- pii_airlock-0.2.0/.github/ISSUE_TEMPLATE/feature_request.yml +27 -0
- pii_airlock-0.2.0/.github/dependabot.yml +14 -0
- pii_airlock-0.2.0/.github/pull_request_template.md +16 -0
- pii_airlock-0.2.0/.github/workflows/ci.yml +41 -0
- pii_airlock-0.2.0/.github/workflows/publish.yml +47 -0
- pii_airlock-0.2.0/.gitignore +19 -0
- pii_airlock-0.2.0/AGENTS.md +136 -0
- pii_airlock-0.2.0/CHANGELOG.md +70 -0
- pii_airlock-0.2.0/CODE_OF_CONDUCT.md +57 -0
- pii_airlock-0.2.0/CONTRIBUTING.md +53 -0
- pii_airlock-0.2.0/LICENSE +21 -0
- pii_airlock-0.2.0/PKG-INFO +358 -0
- pii_airlock-0.2.0/README.md +309 -0
- pii_airlock-0.2.0/SECURITY.md +45 -0
- pii_airlock-0.2.0/hooks/__init__.py +1 -0
- pii_airlock-0.2.0/hooks/_common.py +117 -0
- pii_airlock-0.2.0/hooks/pre_tool_use.py +11 -0
- pii_airlock-0.2.0/hooks/user_prompt_submit.py +11 -0
- pii_airlock-0.2.0/pii_scrub/__init__.py +3 -0
- pii_airlock-0.2.0/pii_scrub/cli.py +246 -0
- pii_airlock-0.2.0/pii_scrub/config.default.yaml +28 -0
- pii_airlock-0.2.0/pii_scrub/config.py +59 -0
- pii_airlock-0.2.0/pii_scrub/engine.py +109 -0
- pii_airlock-0.2.0/pii_scrub/formats/__init__.py +55 -0
- pii_airlock-0.2.0/pii_scrub/formats/base.py +42 -0
- pii_airlock-0.2.0/pii_scrub/formats/csv_json.py +50 -0
- pii_airlock-0.2.0/pii_scrub/formats/docx.py +57 -0
- pii_airlock-0.2.0/pii_scrub/formats/pdf.py +29 -0
- pii_airlock-0.2.0/pii_scrub/formats/text.py +15 -0
- pii_airlock-0.2.0/pii_scrub/hookinstall.py +72 -0
- pii_airlock-0.2.0/pii_scrub/mapping.py +94 -0
- pii_airlock-0.2.0/pii_scrub/payload.py +307 -0
- pii_airlock-0.2.0/pii_scrub/proxy.py +231 -0
- pii_airlock-0.2.0/pyproject.toml +68 -0
- pii_airlock-0.2.0/tests/__init__.py +0 -0
- pii_airlock-0.2.0/tests/test_engine.py +78 -0
- pii_airlock-0.2.0/tests/test_formats.py +44 -0
- pii_airlock-0.2.0/tests/test_hook.py +72 -0
- pii_airlock-0.2.0/tests/test_hookinstall.py +53 -0
- pii_airlock-0.2.0/tests/test_mapping.py +45 -0
- pii_airlock-0.2.0/tests/test_payload.py +145 -0
- pii_airlock-0.2.0/tests/test_proxy.py +180 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
name: Bug report
|
|
2
|
+
description: Something doesn't work as documented
|
|
3
|
+
labels: [bug]
|
|
4
|
+
body:
|
|
5
|
+
- type: markdown
|
|
6
|
+
attributes:
|
|
7
|
+
value: |
|
|
8
|
+
Thanks for the report! For **security vulnerabilities**, do not file a
|
|
9
|
+
public issue — see [SECURITY.md](../../SECURITY.md).
|
|
10
|
+
**Never paste real PII or a mapping file.** Use fake data in examples.
|
|
11
|
+
- type: input
|
|
12
|
+
id: version
|
|
13
|
+
attributes:
|
|
14
|
+
label: pii-airlock version
|
|
15
|
+
placeholder: "e.g. 0.2.0 (pii-airlock --version)"
|
|
16
|
+
validations:
|
|
17
|
+
required: true
|
|
18
|
+
- type: dropdown
|
|
19
|
+
id: os
|
|
20
|
+
attributes:
|
|
21
|
+
label: Operating system
|
|
22
|
+
options: [macOS, Linux, Windows, Other]
|
|
23
|
+
validations:
|
|
24
|
+
required: true
|
|
25
|
+
- type: input
|
|
26
|
+
id: python
|
|
27
|
+
attributes:
|
|
28
|
+
label: Python version
|
|
29
|
+
placeholder: "e.g. 3.12.4"
|
|
30
|
+
validations:
|
|
31
|
+
required: true
|
|
32
|
+
- type: dropdown
|
|
33
|
+
id: workflow
|
|
34
|
+
attributes:
|
|
35
|
+
label: Which workflow?
|
|
36
|
+
options: [CLI pipe, Gateway (proxy), Claude Code hooks, Other]
|
|
37
|
+
validations:
|
|
38
|
+
required: true
|
|
39
|
+
- type: textarea
|
|
40
|
+
id: repro
|
|
41
|
+
attributes:
|
|
42
|
+
label: Steps to reproduce
|
|
43
|
+
description: Minimal commands or code. Use fake data only.
|
|
44
|
+
render: shell
|
|
45
|
+
validations:
|
|
46
|
+
required: true
|
|
47
|
+
- type: textarea
|
|
48
|
+
id: expected
|
|
49
|
+
attributes:
|
|
50
|
+
label: Expected vs actual behavior
|
|
51
|
+
validations:
|
|
52
|
+
required: true
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
blank_issues_enabled: false
|
|
2
|
+
contact_links:
|
|
3
|
+
- name: Security vulnerability
|
|
4
|
+
url: https://github.com/matinfo/pii-airlock/security/advisories/new
|
|
5
|
+
about: Report privately. Do not open a public issue for security problems.
|
|
6
|
+
- name: Question / discussion
|
|
7
|
+
url: https://github.com/matinfo/pii-airlock/discussions
|
|
8
|
+
about: Ask questions and share usage ideas.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
name: Feature request
|
|
2
|
+
description: Suggest an improvement (new provider, language, format, …)
|
|
3
|
+
labels: [enhancement]
|
|
4
|
+
body:
|
|
5
|
+
- type: textarea
|
|
6
|
+
id: problem
|
|
7
|
+
attributes:
|
|
8
|
+
label: What problem does this solve?
|
|
9
|
+
validations:
|
|
10
|
+
required: true
|
|
11
|
+
- type: textarea
|
|
12
|
+
id: proposal
|
|
13
|
+
attributes:
|
|
14
|
+
label: Proposed solution
|
|
15
|
+
validations:
|
|
16
|
+
required: true
|
|
17
|
+
- type: dropdown
|
|
18
|
+
id: area
|
|
19
|
+
attributes:
|
|
20
|
+
label: Area
|
|
21
|
+
options: [New provider adapter, New language, File format, Gateway, Hooks, CLI, Docs, Other]
|
|
22
|
+
validations:
|
|
23
|
+
required: true
|
|
24
|
+
- type: textarea
|
|
25
|
+
id: alternatives
|
|
26
|
+
attributes:
|
|
27
|
+
label: Alternatives considered
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
- package-ecosystem: pip
|
|
4
|
+
directory: "/"
|
|
5
|
+
schedule:
|
|
6
|
+
interval: weekly
|
|
7
|
+
open-pull-requests-limit: 5
|
|
8
|
+
groups:
|
|
9
|
+
python-deps:
|
|
10
|
+
patterns: ["*"]
|
|
11
|
+
- package-ecosystem: github-actions
|
|
12
|
+
directory: "/"
|
|
13
|
+
schedule:
|
|
14
|
+
interval: weekly
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<!-- Thanks for contributing! Keep PRs focused. Never include real PII. -->
|
|
2
|
+
|
|
3
|
+
## What & why
|
|
4
|
+
|
|
5
|
+
<!-- What does this change and what problem does it solve? -->
|
|
6
|
+
|
|
7
|
+
## How verified
|
|
8
|
+
|
|
9
|
+
- [ ] `ruff check .` passes
|
|
10
|
+
- [ ] `pytest -q` passes
|
|
11
|
+
- [ ] Added/updated tests for the change
|
|
12
|
+
- [ ] Updated docs (README / AGENTS.md / CHANGELOG) if user-facing
|
|
13
|
+
|
|
14
|
+
## Notes
|
|
15
|
+
|
|
16
|
+
<!-- Breaking changes, follow-ups, anything reviewers should know. -->
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
runs-on: ${{ matrix.os }}
|
|
11
|
+
strategy:
|
|
12
|
+
fail-fast: false
|
|
13
|
+
matrix:
|
|
14
|
+
# Full Python range on Linux; representative versions on macOS + Windows
|
|
15
|
+
# to prove cross-OS behaviour without a 15-job matrix.
|
|
16
|
+
os: [ubuntu-latest]
|
|
17
|
+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
|
|
18
|
+
include:
|
|
19
|
+
- os: macos-latest
|
|
20
|
+
python-version: "3.12"
|
|
21
|
+
- os: macos-latest
|
|
22
|
+
python-version: "3.13"
|
|
23
|
+
- os: windows-latest
|
|
24
|
+
python-version: "3.12"
|
|
25
|
+
- os: windows-latest
|
|
26
|
+
python-version: "3.13"
|
|
27
|
+
steps:
|
|
28
|
+
- uses: actions/checkout@v7
|
|
29
|
+
- uses: actions/setup-python@v6
|
|
30
|
+
with:
|
|
31
|
+
python-version: ${{ matrix.python-version }}
|
|
32
|
+
- name: Install (with dev extras)
|
|
33
|
+
run: |
|
|
34
|
+
python -m pip install --upgrade pip
|
|
35
|
+
pip install -e ".[dev]"
|
|
36
|
+
- name: Lint
|
|
37
|
+
run: ruff check .
|
|
38
|
+
- name: Test
|
|
39
|
+
# Unit tests stub out Presidio/spaCy, so no model download is needed.
|
|
40
|
+
# The proxy tests exercise the real ASGI stack with a mocked upstream.
|
|
41
|
+
run: pytest -q
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
# Publishes on a GitHub Release. Uses PyPI Trusted Publishing (OIDC) — no API
|
|
4
|
+
# token stored in the repo. One-time setup: create the project's trusted
|
|
5
|
+
# publisher on PyPI (https://docs.pypi.org/trusted-publishers/) pointing at this
|
|
6
|
+
# repo + workflow, and create a "pypi" environment in the repo settings.
|
|
7
|
+
|
|
8
|
+
on:
|
|
9
|
+
release:
|
|
10
|
+
types: [published]
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
build:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v7
|
|
20
|
+
- uses: actions/setup-python@v6
|
|
21
|
+
with:
|
|
22
|
+
python-version: "3.12"
|
|
23
|
+
- name: Build sdist + wheel
|
|
24
|
+
run: |
|
|
25
|
+
python -m pip install --upgrade pip build
|
|
26
|
+
python -m build
|
|
27
|
+
- name: Check metadata
|
|
28
|
+
run: |
|
|
29
|
+
python -m pip install twine
|
|
30
|
+
twine check dist/*
|
|
31
|
+
- uses: actions/upload-artifact@v7
|
|
32
|
+
with:
|
|
33
|
+
name: dist
|
|
34
|
+
path: dist/
|
|
35
|
+
|
|
36
|
+
publish:
|
|
37
|
+
needs: build
|
|
38
|
+
runs-on: ubuntu-latest
|
|
39
|
+
environment: pypi
|
|
40
|
+
permissions:
|
|
41
|
+
id-token: write # required for trusted publishing
|
|
42
|
+
steps:
|
|
43
|
+
- uses: actions/download-artifact@v8
|
|
44
|
+
with:
|
|
45
|
+
name: dist
|
|
46
|
+
path: dist/
|
|
47
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Mapping files contain REAL PII — never commit them.
|
|
2
|
+
*.pii-map.json
|
|
3
|
+
*.pii-map.*
|
|
4
|
+
|
|
5
|
+
# Python
|
|
6
|
+
__pycache__/
|
|
7
|
+
*.py[cod]
|
|
8
|
+
*.egg-info/
|
|
9
|
+
.eggs/
|
|
10
|
+
build/
|
|
11
|
+
dist/
|
|
12
|
+
.venv/
|
|
13
|
+
venv/
|
|
14
|
+
.pytest_cache/
|
|
15
|
+
.ruff_cache/
|
|
16
|
+
.mypy_cache/
|
|
17
|
+
|
|
18
|
+
# OS
|
|
19
|
+
.DS_Store
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# Integrating pii-airlock with AI coding agents
|
|
2
|
+
|
|
3
|
+
pii-airlock keeps real PII out of LLM traffic for the agents and clients you
|
|
4
|
+
already use. There are two integration styles:
|
|
5
|
+
|
|
6
|
+
- **Gateway** — point the client's *base URL* at the local proxy. Transparent,
|
|
7
|
+
bidirectional (scrubs the request, restores the response). Best for chat-style
|
|
8
|
+
and OpenAI/Anthropic/Gemini-compatible clients.
|
|
9
|
+
- **Hooks** — Claude Code's native guardrail events. Best for agentic, tool-using
|
|
10
|
+
sessions where rewriting the payload would interfere with the tool loop.
|
|
11
|
+
|
|
12
|
+
Start the gateway once:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pipx inject pii-airlock 'pii-airlock[proxy]'
|
|
16
|
+
pii-airlock proxy # http://127.0.0.1:8745 (127.0.0.1 only by default)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Setting an environment variable (all platforms)
|
|
22
|
+
|
|
23
|
+
Most clients read a base-URL environment variable. Set it in the shell that
|
|
24
|
+
launches the client:
|
|
25
|
+
|
|
26
|
+
| Shell / OS | Command |
|
|
27
|
+
|---|---|
|
|
28
|
+
| bash / zsh (macOS, Linux) | `export OPENAI_BASE_URL=http://127.0.0.1:8745/openai` |
|
|
29
|
+
| fish | `set -x OPENAI_BASE_URL http://127.0.0.1:8745/openai` |
|
|
30
|
+
| PowerShell (Windows) | `$env:OPENAI_BASE_URL = "http://127.0.0.1:8745/openai"` |
|
|
31
|
+
| cmd.exe (Windows) | `set OPENAI_BASE_URL=http://127.0.0.1:8745/openai` |
|
|
32
|
+
|
|
33
|
+
Swap the variable/route for the provider (`/anthropic`, `/gemini`) as below.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Per-agent setup
|
|
38
|
+
|
|
39
|
+
### Claude Code *(recommended: hooks)*
|
|
40
|
+
|
|
41
|
+
Claude Code is agentic — it moves files and runs commands. Use the **hooks** so
|
|
42
|
+
PII is surfaced without disturbing the tool loop:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pii-airlock install-hook # both events, project scope
|
|
46
|
+
pii-airlock install-hook --scope user
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
| Leak vector | Covered by |
|
|
50
|
+
|---|---|
|
|
51
|
+
| PII you type in a prompt | `UserPromptSubmit` |
|
|
52
|
+
| PII in a file Claude reads | `PreToolUse` |
|
|
53
|
+
| PII in a shell command Claude runs | `PreToolUse` |
|
|
54
|
+
|
|
55
|
+
> You *can* also route Claude Code's API traffic through the gateway with
|
|
56
|
+
> `ANTHROPIC_BASE_URL`, but tool-call arguments aren't restored, which can affect
|
|
57
|
+
> agentic runs. Prefer hooks for Claude Code; use the gateway for chat clients.
|
|
58
|
+
|
|
59
|
+
### Codex CLI / OpenAI SDK / OpenAI-compatible tools
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
export OPENAI_BASE_URL=http://127.0.0.1:8745/openai
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Works with the official OpenAI SDKs, the Codex CLI, `litellm` (`api_base=...`),
|
|
66
|
+
`vllm`/Ollama front-ends, and most "OpenAI-compatible" tools.
|
|
67
|
+
|
|
68
|
+
### Anthropic SDK
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
export ANTHROPIC_BASE_URL=http://127.0.0.1:8745/anthropic
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Cursor
|
|
75
|
+
|
|
76
|
+
Settings → **Models** → enable *Override OpenAI Base URL* and set it to:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
http://127.0.0.1:8745/openai
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
(Use a model served through an OpenAI-compatible endpoint.)
|
|
83
|
+
|
|
84
|
+
### Continue.dev (VS Code / JetBrains)
|
|
85
|
+
|
|
86
|
+
In `~/.continue/config.json`, set `apiBase` on the model:
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"models": [
|
|
91
|
+
{ "title": "via pii-airlock", "provider": "openai",
|
|
92
|
+
"model": "gpt-4o", "apiBase": "http://127.0.0.1:8745/openai" }
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Aider
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
export OPENAI_API_BASE=http://127.0.0.1:8745/openai
|
|
101
|
+
aider
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Google Gemini (google-genai SDK)
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
from google import genai
|
|
108
|
+
from google.genai.types import HttpOptions
|
|
109
|
+
|
|
110
|
+
client = genai.Client(
|
|
111
|
+
api_key="...",
|
|
112
|
+
http_options=HttpOptions(base_url="http://127.0.0.1:8745/gemini"),
|
|
113
|
+
)
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
> Gemini's non-SSE streaming is buffered then restored as one response. Pass
|
|
117
|
+
> `alt=sse` if your client supports it for live streaming.
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Adding a provider
|
|
122
|
+
|
|
123
|
+
Adding a provider is one small adapter — see
|
|
124
|
+
[`pii_scrub/payload.py`](pii_scrub/payload.py): implement `scrub_request`
|
|
125
|
+
(where user text lives) and `restore_response` (where model text lives), register
|
|
126
|
+
it, add tests. PRs welcome (see [CONTRIBUTING.md](CONTRIBUTING.md)).
|
|
127
|
+
|
|
128
|
+
## Verify it's working
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
pii-airlock proxy &
|
|
132
|
+
export OPENAI_BASE_URL=http://127.0.0.1:8745/openai
|
|
133
|
+
# Run your client with a fake email/name in the prompt, then check the provider
|
|
134
|
+
# dashboard / logs: you should see <EMAIL_ADDRESS_1>, not the real value, while
|
|
135
|
+
# your client still shows the real value in the answer.
|
|
136
|
+
```
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
- **Renamed to `pii-airlock`** (`pii-scrub` was unavailable on PyPI). The PyPI
|
|
12
|
+
package, the CLI command, and the GitHub repository are now `pii-airlock`;
|
|
13
|
+
config lives at `~/.config/pii-airlock/` and `./.pii-airlock.yaml`. Only the
|
|
14
|
+
internal Python import package stays `pii_scrub` (invisible to users).
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
- **Gateway robustness:** upstream connection/timeout failures now return a clean
|
|
18
|
+
`502` instead of a traceback; a missing spaCy model returns `503` and **never
|
|
19
|
+
forwards the request** (no PII leak on failure); the raw query string is
|
|
20
|
+
forwarded so multi-value params and Gemini's `?key=` are preserved exactly.
|
|
21
|
+
- **Packaging:** `config.default.yaml` is now shipped inside the package and the
|
|
22
|
+
built-in `Config` carries default model mappings. Previously a non-editable
|
|
23
|
+
install (PyPI / `pipx`) could load an empty model map and fail with "No spaCy
|
|
24
|
+
models configured". Now a fresh install works out of the box.
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
- Community layer: README badges, `AGENTS.md` (per-agent integration matrix),
|
|
28
|
+
`SECURITY.md`, `CONTRIBUTING.md`, `CODE_OF_CONDUCT.md`, `CHANGELOG.md`, issue/PR
|
|
29
|
+
templates, Dependabot, and a PyPI trusted-publishing release workflow.
|
|
30
|
+
|
|
31
|
+
## [0.2.0] - 2026-06-20
|
|
32
|
+
|
|
33
|
+
### Added
|
|
34
|
+
- **Universal gateway** (`pii-airlock proxy`): a local reverse proxy that scrubs
|
|
35
|
+
PII out of outbound requests and restores it in responses (including SSE
|
|
36
|
+
streams), for any provider. Base-URL shim — no TLS interception.
|
|
37
|
+
- **Payload adapters** (`pii_scrub/payload.py`): provider-agnostic core with
|
|
38
|
+
OpenAI-compatible, Anthropic, and Gemini adapters. Adding a provider is one
|
|
39
|
+
small adapter.
|
|
40
|
+
- `StreamRestorer` reassembles placeholder tokens split across stream chunks.
|
|
41
|
+
- `[proxy]` optional dependency group (httpx, starlette, uvicorn).
|
|
42
|
+
- `AGENTS.md` per-agent integration guide; SECURITY, CONTRIBUTING, CODE_OF_CONDUCT.
|
|
43
|
+
|
|
44
|
+
### Changed
|
|
45
|
+
- Detection is now serialized with a lock so the engine is safe to share across
|
|
46
|
+
threads (used by the gateway).
|
|
47
|
+
- Mapping files are created `0600` atomically via `os.open` (no world-readable
|
|
48
|
+
window on POSIX).
|
|
49
|
+
- README rewritten for accuracy: explicit guarantees & limitations; the false
|
|
50
|
+
"no data ever leaves your machine" blanket claim was removed (the gateway
|
|
51
|
+
forwards *scrubbed* traffic).
|
|
52
|
+
- CI now runs on Linux, macOS and Windows.
|
|
53
|
+
|
|
54
|
+
### Removed
|
|
55
|
+
- Unused `csv` extra (CSV/JSON handling uses the standard library).
|
|
56
|
+
|
|
57
|
+
## [0.1.0] - 2026-06-20
|
|
58
|
+
|
|
59
|
+
### Added
|
|
60
|
+
- Reversible CLI: `scrub`, `restore`, `detect`, `download-models`.
|
|
61
|
+
- Deterministic placeholder tokens (`<TYPE_N>`) with a reversible mapping store.
|
|
62
|
+
- Multilingual detection on Microsoft Presidio + spaCy (English + French defaults).
|
|
63
|
+
- Format handlers: plain text, CSV, JSON (stdlib), `.docx` and PDF (optional extras).
|
|
64
|
+
- Claude Code guardrail hooks: `PreToolUse` and `UserPromptSubmit`, plus
|
|
65
|
+
`install-hook`.
|
|
66
|
+
- Config override chain: bundled defaults → user → project → CLI flags.
|
|
67
|
+
|
|
68
|
+
[Unreleased]: https://github.com/matinfo/pii-airlock/compare/v0.2.0...HEAD
|
|
69
|
+
[0.2.0]: https://github.com/matinfo/pii-airlock/compare/v0.1.0...v0.2.0
|
|
70
|
+
[0.1.0]: https://github.com/matinfo/pii-airlock/releases/tag/v0.1.0
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
|
10
|
+
orientation.
|
|
11
|
+
|
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
13
|
+
diverse, inclusive, and healthy community.
|
|
14
|
+
|
|
15
|
+
## Our Standards
|
|
16
|
+
|
|
17
|
+
Examples of behavior that contributes to a positive environment:
|
|
18
|
+
|
|
19
|
+
- Demonstrating empathy and kindness toward other people
|
|
20
|
+
- Being respectful of differing opinions, viewpoints, and experiences
|
|
21
|
+
- Giving and gracefully accepting constructive feedback
|
|
22
|
+
- Accepting responsibility and apologizing to those affected by our mistakes
|
|
23
|
+
- Focusing on what is best for the overall community
|
|
24
|
+
|
|
25
|
+
Examples of unacceptable behavior:
|
|
26
|
+
|
|
27
|
+
- The use of sexualized language or imagery, and sexual attention or advances
|
|
28
|
+
- Trolling, insulting or derogatory comments, and personal or political attacks
|
|
29
|
+
- Public or private harassment
|
|
30
|
+
- Publishing others' private information without explicit permission
|
|
31
|
+
- Other conduct which could reasonably be considered inappropriate
|
|
32
|
+
|
|
33
|
+
## Enforcement Responsibilities
|
|
34
|
+
|
|
35
|
+
Community leaders are responsible for clarifying and enforcing our standards and
|
|
36
|
+
will take appropriate and fair corrective action in response to any behavior
|
|
37
|
+
they deem inappropriate, threatening, offensive, or harmful.
|
|
38
|
+
|
|
39
|
+
## Scope
|
|
40
|
+
|
|
41
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
|
42
|
+
an individual is officially representing the community in public spaces.
|
|
43
|
+
|
|
44
|
+
## Enforcement
|
|
45
|
+
|
|
46
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
47
|
+
reported to the maintainers at **m.meylan@gmail.com**. All complaints will be
|
|
48
|
+
reviewed and investigated promptly and fairly. Community leaders are obligated to
|
|
49
|
+
respect the privacy and security of the reporter of any incident.
|
|
50
|
+
|
|
51
|
+
## Attribution
|
|
52
|
+
|
|
53
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
54
|
+
version 2.1, available at
|
|
55
|
+
https://www.contributor-covenant.org/version/2/1/code_of_conduct.html.
|
|
56
|
+
|
|
57
|
+
[homepage]: https://www.contributor-covenant.org
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Contributing to pii-airlock
|
|
2
|
+
|
|
3
|
+
Thanks for helping make PII safer for AI workflows. Contributions of all kinds
|
|
4
|
+
are welcome: bug reports, docs, new language configs, and new provider adapters.
|
|
5
|
+
|
|
6
|
+
## Quick start
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
git clone https://github.com/matinfo/pii-airlock
|
|
10
|
+
cd pii-airlock
|
|
11
|
+
python -m venv .venv && . .venv/bin/activate # Windows: .venv\Scripts\activate
|
|
12
|
+
pip install -e ".[dev,all]"
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Before you open a PR
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
ruff check . # lint (also: ruff format .)
|
|
19
|
+
pytest -q # unit + integration tests, fully offline
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Both must pass. CI runs them on Linux (Python 3.10–3.14) and on macOS + Windows.
|
|
23
|
+
|
|
24
|
+
- Tests stub Presidio/spaCy, so they need no model download and no network.
|
|
25
|
+
- Keep new code lint-clean and add tests for new behavior.
|
|
26
|
+
- Match the surrounding style (type hints, `from __future__ import annotations`,
|
|
27
|
+
small focused modules).
|
|
28
|
+
|
|
29
|
+
## Good first contributions
|
|
30
|
+
|
|
31
|
+
- **Add a language.** spaCy ships models for many languages — see the README
|
|
32
|
+
"Adding a language". A docs PR listing a working `{lang: model}` pair is useful.
|
|
33
|
+
- **Add a provider adapter.** Implement a `PayloadAdapter` in
|
|
34
|
+
`pii_scrub/payload.py` (one class: where user text lives in the request, where
|
|
35
|
+
model text lives in the response) and register it. Add tests in
|
|
36
|
+
`tests/test_payload.py` mirroring the existing ones. See `AGENTS.md`.
|
|
37
|
+
- **Custom recognizers** to improve detection (e.g. locale-specific phone/ID
|
|
38
|
+
formats) via Presidio's recognizer registry.
|
|
39
|
+
|
|
40
|
+
## Commit & PR conventions
|
|
41
|
+
|
|
42
|
+
- Conventional-commit style subjects are appreciated (`feat:`, `fix:`, `docs:`…).
|
|
43
|
+
- Describe the user-facing change and how you verified it.
|
|
44
|
+
- One logical change per PR where practical.
|
|
45
|
+
|
|
46
|
+
## Reporting bugs / security
|
|
47
|
+
|
|
48
|
+
- Bugs: open an issue using the template.
|
|
49
|
+
- Security vulnerabilities: **do not** open a public issue — see
|
|
50
|
+
[SECURITY.md](SECURITY.md).
|
|
51
|
+
|
|
52
|
+
By contributing you agree your contributions are licensed under the project's
|
|
53
|
+
[MIT License](LICENSE).
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 pii-scrub contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|