n8n-nodes-redactor 2.0.0

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 n8n-nodes-redactor might be problematic. Click here for more details.

Files changed (37) hide show
  1. package/LICENSE +42 -0
  2. package/README.dev.md +134 -0
  3. package/README.md +376 -0
  4. package/README.npm.md +376 -0
  5. package/dist/nodes/PiiRedactor/PiiRedactor.node.d.ts +5 -0
  6. package/dist/nodes/PiiRedactor/PiiRedactor.node.js +872 -0
  7. package/dist/nodes/PiiRedactor/__tests__/engine.test.d.ts +1 -0
  8. package/dist/nodes/PiiRedactor/__tests__/engine.test.js +524 -0
  9. package/dist/nodes/PiiRedactor/__tests__/operations.test.d.ts +1 -0
  10. package/dist/nodes/PiiRedactor/__tests__/operations.test.js +316 -0
  11. package/dist/nodes/PiiRedactor/__tests__/patterns-global.test.d.ts +1 -0
  12. package/dist/nodes/PiiRedactor/__tests__/patterns-global.test.js +427 -0
  13. package/dist/nodes/PiiRedactor/__tests__/patterns.test.d.ts +1 -0
  14. package/dist/nodes/PiiRedactor/__tests__/patterns.test.js +481 -0
  15. package/dist/nodes/PiiRedactor/__tests__/phase1.test.d.ts +1 -0
  16. package/dist/nodes/PiiRedactor/__tests__/phase1.test.js +343 -0
  17. package/dist/nodes/PiiRedactor/__tests__/security.test.d.ts +1 -0
  18. package/dist/nodes/PiiRedactor/__tests__/security.test.js +178 -0
  19. package/dist/nodes/PiiRedactor/__tests__/semantic.test.d.ts +1 -0
  20. package/dist/nodes/PiiRedactor/__tests__/semantic.test.js +319 -0
  21. package/dist/nodes/PiiRedactor/__tests__/vault.test.d.ts +1 -0
  22. package/dist/nodes/PiiRedactor/__tests__/vault.test.js +247 -0
  23. package/dist/nodes/PiiRedactor/context.d.ts +57 -0
  24. package/dist/nodes/PiiRedactor/context.js +260 -0
  25. package/dist/nodes/PiiRedactor/engine.d.ts +17 -0
  26. package/dist/nodes/PiiRedactor/engine.js +813 -0
  27. package/dist/nodes/PiiRedactor/names.d.ts +25 -0
  28. package/dist/nodes/PiiRedactor/names.js +188 -0
  29. package/dist/nodes/PiiRedactor/patterns.d.ts +17 -0
  30. package/dist/nodes/PiiRedactor/patterns.js +1741 -0
  31. package/dist/nodes/PiiRedactor/redact.png +0 -0
  32. package/dist/nodes/PiiRedactor/redact.svg +3 -0
  33. package/dist/nodes/PiiRedactor/types.d.ts +78 -0
  34. package/dist/nodes/PiiRedactor/types.js +3 -0
  35. package/dist/nodes/PiiRedactor/vault.d.ts +60 -0
  36. package/dist/nodes/PiiRedactor/vault.js +299 -0
  37. package/package.json +87 -0
package/LICENSE ADDED
@@ -0,0 +1,42 @@
1
+ Fair Use Code License (FUCL)
2
+
3
+ Copyright (c) 2026 Mirza Iqbal / next8n (https://next8n.com). All rights reserved.
4
+
5
+ This software is published as an n8n community node for the benefit of the n8n
6
+ ecosystem and teams building AI workflows that need to handle customer data
7
+ responsibly. However, the intellectual property, source code, and all associated
8
+ rights are owned exclusively by the copyright holder.
9
+
10
+ PERMITTED:
11
+
12
+ - Install and use this software for your own internal workflows and
13
+ business automation.
14
+
15
+ PROHIBITED WITHOUT EXPLICIT WRITTEN CONSENT:
16
+
17
+ - Copying, forking, or reproducing the source code in any form
18
+ - Commercial redistribution, resale, sublicensing, or white-labeling
19
+ - Creating derivative works or competing products based on this code
20
+ - Public redistribution of modified or unmodified versions
21
+ - Using the Software as part of a commercial service offering
22
+ - Removing or altering copyright notices or attribution
23
+
24
+ ATTRIBUTION:
25
+
26
+ This software was developed and is actively maintained by next8n
27
+ (https://next8n.com). Attribution must be preserved in all copies.
28
+
29
+ DISCLAIMER:
30
+
31
+ THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
32
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
34
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
35
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
36
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
37
+ SOFTWARE.
38
+
39
+ We built it. We maintain it. We own the rights to the code.
40
+
41
+ For commercial licensing, partnership, or custom development:
42
+ https://services.next8n.com
package/README.dev.md ADDED
@@ -0,0 +1,134 @@
1
+ <p align="center">
2
+ <img src="https://unpkg.com/n8n-nodes-redactor@1.0.2/dist/nodes/PiiRedactor/redact.png" alt="PII Redactor" width="80" />
3
+ </p>
4
+
5
+ <h1 align="center">n8n-nodes-redactor</h1>
6
+
7
+ <p align="center">
8
+ <strong>Local PII detection and reversible redaction engine for n8n workflows</strong><br/>
9
+ 30+ PII patterns &bull; 4 redaction modes &bull; Persistent vault &bull; Field targeting &bull; Audit trail<br/>
10
+ <em>Intellectual property of <a href="https://next8n.com">next8n</a></em>
11
+ </p>
12
+
13
+ <p align="center">
14
+ <a href="https://www.npmjs.com/package/n8n-nodes-redactor"><img src="https://img.shields.io/npm/v/n8n-nodes-redactor?style=flat-square&color=CB3837" alt="npm" /></a>
15
+ <img src="https://img.shields.io/badge/tests-127_passed-brightgreen?style=flat-square" alt="tests" />
16
+ <img src="https://img.shields.io/badge/license-FUCL-orange?style=flat-square" alt="license" />
17
+ <img src="https://img.shields.io/badge/TypeScript-strict-3178C6?style=flat-square" alt="TypeScript" />
18
+ </p>
19
+
20
+ ---
21
+
22
+ ## Architecture
23
+
24
+ ```
25
+ src/nodes/PiiRedactor/
26
+ ├── PiiRedactor.node.ts # n8n node — UI properties, operations, wiring
27
+ ├── engine.ts # Redaction/restore engine — recursive JSON walk, field targeting
28
+ ├── patterns.ts # 30+ PII regex patterns with validators (Luhn, IBAN, NHS)
29
+ ├── vault.ts # Storage backends — MemoryVault + FileVault with TTL
30
+ ├── types.ts # Shared TypeScript interfaces
31
+ └── __tests__/
32
+ ├── patterns.test.ts # 62 tests — every pattern, positive + negative cases
33
+ ├── vault.test.ts # 22 tests — memory, file, TTL, corruption, factory
34
+ └── engine.test.ts # 43 tests — redaction, restore, modes, dedup, edge cases
35
+ ```
36
+
37
+ ## Module Breakdown
38
+
39
+ ### `patterns.ts` — PII Detection
40
+
41
+ | Category | Patterns | Validation |
42
+ |----------|----------|------------|
43
+ | Contact | Email, Phone (intl), Phone (UK) | — |
44
+ | Identity | Person names (title-prefix heuristic), SSN, Passports (US/EU), Driver License, German National ID, NHS, EIN | NHS mod-11 checksum |
45
+ | Financial | Credit Card, IBAN, BIC/SWIFT, EU VAT (27 states), UK Bank Account | Luhn (CC), ISO 13616 (IBAN) |
46
+ | Network | IPv4, IPv6, MAC, URL | IPv4 range validation |
47
+ | Location | US ZIP, UK Postcode, DE Postcode, GPS Coordinates | GPS precision filter |
48
+ | Temporal | Dates (slash/dash/dot/ISO), DOB with label | — |
49
+ | Medical | MRN (prefix-based) | — |
50
+ | Crypto | Bitcoin (Legacy + Bech32), Ethereum | — |
51
+
52
+ ### `vault.ts` — Token Storage
53
+
54
+ Two backends implementing `IVault` interface:
55
+
56
+ - **`MemoryVault`** — `Map<string, VaultSession>`, fast, ephemeral
57
+ - **`FileVault`** — JSON files in `~/.n8n/pii-vault/`, SHA-256 hashed filenames, survives restarts
58
+
59
+ Both support: TTL auto-expiry, session CRUD, `findByOriginal()` for deduplication, `cleanup()` for garbage collection.
60
+
61
+ ### `engine.ts` — Redaction Engine
62
+
63
+ - Recursive JSON walker — handles nested objects, arrays, mixed types
64
+ - Field path matching with wildcards (`user.email`, `*.phone`, `items[*].name`)
65
+ - 4 modes: `token` (reversible), `mask` (smart partial), `hash` (SHA-256), `redact` (full removal)
66
+ - Deduplication — same PII value → same token across all fields
67
+ - Audit report builder — hits by category, by pattern, per field, per item
68
+
69
+ ### `PiiRedactor.node.ts` — n8n Integration
70
+
71
+ 6 operations, dual output (Data + Report):
72
+
73
+ | Operation | Purpose | Output 1 | Output 2 |
74
+ |-----------|---------|----------|----------|
75
+ | Redact | Replace PII with tokens | Redacted data | Audit report (optional) |
76
+ | Restore | Swap tokens back to originals | Restored data | - |
77
+ | Detect | Scan without modifying | Original data | Detection report |
78
+ | Verify | Confirm no PII leaked | PASS/FAIL | - |
79
+ | Purge | Delete vault sessions (GDPR Art.17) | Confirmation | - |
80
+ | Stats | Monitor vault health | Session list | - |
81
+
82
+ Production flow: `Detect > Redact > [LLM] > Verify > Restore > Purge`
83
+
84
+ ## Build
85
+
86
+ ```bash
87
+ npm install
88
+ npm run build # tsc → dist/
89
+ npm run dev # tsc --watch
90
+ npm test # jest, 127 tests
91
+ ```
92
+
93
+ ## Test Coverage
94
+
95
+ ```
96
+ Test Suites: 3 passed, 3 total
97
+ Tests: 127 passed, 127 total
98
+
99
+ patterns.test.ts — 62 tests (every PII type, positive + negative, validators)
100
+ vault.test.ts — 22 tests (memory, file, TTL, corruption, factory)
101
+ engine.test.ts — 43 tests (redact, restore, modes, dedup, fields, edge cases)
102
+ ```
103
+
104
+ Edge cases covered: long strings (10K chars), 100-item batch, Unicode, re-redaction prevention, Luhn false positive rejection, IBAN checksum rejection, corrupt vault files, expired TTL, missing sessions, null values, empty objects, LLM token rephrasing.
105
+
106
+ ## Publish Flow
107
+
108
+ Uses the same pattern as `n8n-nodes-xentral`:
109
+
110
+ ```bash
111
+ npm run prepublishOnly # Swaps README.npm.md → README.md, builds
112
+ npm publish # Publishes to npm with user-facing README
113
+ npm run postpublish # Restores technical README
114
+ ```
115
+
116
+ ---
117
+
118
+ ## License
119
+
120
+ **Fair Use Code License (FUCL)**
121
+
122
+ Copyright (c) 2026 Mirza Iqbal / [next8n](https://next8n.com). All rights reserved.
123
+
124
+ **All intellectual property, source code, and associated rights are owned exclusively by the copyright holder.**
125
+
126
+ **Permitted:** Install and use for internal workflows and business automation.
127
+
128
+ **Prohibited without explicit written consent:** Copying, forking, reproducing, redistributing, reselling, sublicensing, white-labeling, creating derivative works, using as part of a commercial service offering, removing copyright notices.
129
+
130
+ This software is provided "as is", without warranty of any kind.
131
+
132
+ **Missing a use case?** If there is a specific scenario not covered by the built-in 210+ patterns, reach out. We will be happy to enhance the node so everyone benefits.
133
+
134
+ For commercial licensing, partnership, custom patterns, or feature requests: [services.next8n.com](https://services.next8n.com)
package/README.md ADDED
@@ -0,0 +1,376 @@
1
+ <p align="center">
2
+ <img src="https://unpkg.com/n8n-nodes-redactor@1.0.2/dist/nodes/PiiRedactor/redact.png" alt="Redactor" width="80" />
3
+ </p>
4
+
5
+ <h1 align="center">n8n-nodes-redactor</h1>
6
+
7
+ <p align="center">
8
+ <strong>Stop sending your customer data to OpenAI, Claude, and Gemini unprotected.</strong><br/>
9
+ Built, maintained, and owned by <a href="https://next8n.com">next8n</a>
10
+ </p>
11
+
12
+ <p align="center">
13
+ <a href="https://www.npmjs.com/package/n8n-nodes-redactor"><img src="https://img.shields.io/npm/v/n8n-nodes-redactor?style=for-the-badge&color=CB3837&label=npm" alt="npm version" /></a>
14
+ <a href="https://www.npmjs.com/package/n8n-nodes-redactor"><img src="https://img.shields.io/npm/dt/n8n-nodes-redactor?style=for-the-badge&color=blue&label=downloads" alt="npm downloads" /></a>
15
+ <a href="#license"><img src="https://img.shields.io/badge/license-FUCL-orange?style=for-the-badge" alt="License" /></a>
16
+ <img src="https://img.shields.io/badge/PII_Types-200+-success?style=for-the-badge" alt="125+ PII Types" />
17
+ <img src="https://img.shields.io/badge/Tests-299_Passed-brightgreen?style=for-the-badge" alt="229 Tests Passed" />
18
+ <img src="https://img.shields.io/badge/Categories-11-success?style=for-the-badge" alt="11 Categories" />
19
+ <img src="https://img.shields.io/badge/Countries-25+-success?style=for-the-badge" alt="25+ Countries" />
20
+ <img src="https://img.shields.io/badge/Vault-Reversible-7B61FF?style=for-the-badge" alt="Reversible Vault" />
21
+ <img src="https://img.shields.io/badge/GDPR-Ready-00C4B4?style=for-the-badge" alt="GDPR Ready" />
22
+ <img src="https://img.shields.io/badge/HIPAA-Ready-00C4B4?style=for-the-badge" alt="HIPAA Ready" />
23
+ <img src="https://img.shields.io/badge/100%25-Local_Processing-10A37F?style=for-the-badge" alt="100% Local" />
24
+ <img src="https://img.shields.io/badge/n8n-Community_Node-FF6D5A?style=for-the-badge" alt="n8n Community Node" />
25
+ <img src="https://img.shields.io/badge/AI_Agent-Compatible-10A37F?style=for-the-badge" alt="AI Agent Compatible" />
26
+ <img src="https://img.shields.io/badge/TypeScript-Strict-3178C6?style=for-the-badge&logo=typescript&logoColor=white" alt="TypeScript" />
27
+ <img src="https://img.shields.io/badge/Maintained-Active-brightgreen?style=for-the-badge" alt="Actively Maintained" />
28
+ </p>
29
+
30
+ ---
31
+
32
+ ## Your customer data is leaving your server right now.
33
+
34
+ Every time your n8n workflow sends a customer email, phone number, address, IBAN, or credit card to OpenAI or Claude - **that data is gone**. You don't control it anymore. Your customer didn't consent to it. And under GDPR, **you're liable**.
35
+
36
+ You know this is a problem. Your clients know it too. But rebuilding every workflow to strip PII manually? That's weeks of work nobody has time for.
37
+
38
+ **This node fixes it in 2 minutes.**
39
+
40
+ Drop it between your data source and your LLM node. It automatically detects and replaces 200+ types of sensitive data with safe tokens. The LLM processes the clean data. Then the node swaps the original values back in. Your customer data never leaves your server.
41
+
42
+ No cloud service. No API keys. No third-party dependency. Everything runs locally on your machine.
43
+
44
+ <p align="center">
45
+ <a href="https://services.next8n.com"><img src="https://img.shields.io/badge/Need_Help_Setting_Up%3F-Book_a_Free_Call-FF6D5A?style=for-the-badge&logoColor=white" alt="Book a consultation" /></a>
46
+ </p>
47
+
48
+ ---
49
+
50
+ ## How it works
51
+
52
+ ```
53
+ [Your Data] --> [PII Redactor: REDACT] --> [OpenAI / Claude / Gemini] --> [PII Redactor: RESTORE] --> [Clean Output]
54
+ ```
55
+
56
+ **Before the LLM sees it:**
57
+ ```json
58
+ {
59
+ "message": "Mrs. Sarah Johnson (sarah@bigcorp.com) reported a billing issue. SSN: 987-65-4321"
60
+ }
61
+ ```
62
+
63
+ **What the LLM actually receives:**
64
+ ```json
65
+ {
66
+ "message": "[PERSON_0] ([EMAIL_1]) reported a billing issue. SSN: [SSN_2]"
67
+ }
68
+ ```
69
+
70
+ **After the LLM responds, the node restores everything automatically:**
71
+ ```json
72
+ {
73
+ "reply": "I've resolved the billing issue for Mrs. Sarah Johnson. A confirmation has been sent to sarah@bigcorp.com."
74
+ }
75
+ ```
76
+
77
+ The LLM never saw the real data. Your customer never knew the difference.
78
+
79
+ ---
80
+
81
+ ## What it detects (125+ sensitive data types across 11 categories)
82
+
83
+ ### Contact Information
84
+ | Type | Examples |
85
+ |------|----------|
86
+ | Email | `john@company.com`, `user+tag@sub.domain.co.uk` |
87
+ | Phone | `(555) 123-4567`, `+49 30 1234-5678` |
88
+ | UK Phone | `020 7946 0958`, `+44 7911 123456` |
89
+ | Person Names | `Mr. John Smith`, `Dr. Anna Wilson`, `Frau Weber`, `Señor García` |
90
+
91
+ ### Financial Data
92
+ | Type | Validation |
93
+ |------|------------|
94
+ | Credit Cards | Luhn algorithm verified - rejects random 16-digit numbers |
95
+ | IBAN | ISO 13616 checksum verified - rejects invalid checksums |
96
+ | BIC/SWIFT | `DEUTDEFF`, `DEUTDEFF500` |
97
+ | EU VAT Numbers | All 27 EU member states covered |
98
+ | UK Bank Accounts | Sort code + account number |
99
+
100
+ ### Government IDs
101
+ | Type | Coverage |
102
+ |------|----------|
103
+ | US SSN | `123-45-6789` |
104
+ | US/EU Passports | `C12345678`, `AB1234567` |
105
+ | UK NHS Numbers | With mod-11 checksum validation |
106
+ | German National ID | 10-character format |
107
+ | US EIN | `12-3456789` |
108
+ | US Driver License | Common format |
109
+
110
+ ### Network & Digital
111
+ | Type | Examples |
112
+ |------|----------|
113
+ | IPv4 / IPv6 | `192.168.1.1`, full IPv6 |
114
+ | MAC Addresses | `00:1A:2B:3C:4D:5E` |
115
+ | URLs | Any `http://` or `https://` URL |
116
+ | Bitcoin Addresses | Legacy (`1...`) and Bech32 (`bc1...`) |
117
+ | Ethereum Addresses | `0x742d35Cc...` |
118
+
119
+ ### Location & Dates
120
+ | Type | Examples |
121
+ |------|----------|
122
+ | US ZIP Codes | `90210`, `90210-1234` |
123
+ | UK Postcodes | `SW1A 1AA`, `EC1A1BB` |
124
+ | GPS Coordinates | `51.5074, -0.1278` |
125
+ | Dates | `15/03/1990`, `2024-03-15`, `15.03.1990` |
126
+ | Dates of Birth | `DOB: 15/03/1990` |
127
+
128
+ ### Medical & Compliance
129
+ | Type | Examples |
130
+ |------|----------|
131
+ | Medical Record Numbers | `MRN: 12345678`, `MRN#987654` |
132
+
133
+ ### Government IDs (25+ countries)
134
+ | Country | Types |
135
+ |---------|-------|
136
+ | USA | SSN, ITIN, EIN, Driver License (contextual), Passport |
137
+ | Canada | SIN (Luhn validated) |
138
+ | UK | NINO, NHS (mod-11 checksum), Passport |
139
+ | Germany | Personalausweis, Steuer-ID, Sozialversicherungsnummer, Reisepass, Handelsregister (HRB) |
140
+ | Austria | Sozialversicherungsnummer (date validated) |
141
+ | Switzerland | AHV/AVS number |
142
+ | France | NIR (social security) |
143
+ | Italy | Codice Fiscale, Carta d'Identita |
144
+ | Spain | DNI, NIE, NIF |
145
+ | Netherlands | BSN (11-check validated) |
146
+ | Belgium | Rijksregisternummer |
147
+ | Poland | PESEL (checksum validated) |
148
+ | Sweden | Personnummer |
149
+ | Norway | Fodselsnummer |
150
+ | Denmark | CPR-nummer |
151
+ | Finland | Henkilotunnus (HETU) |
152
+ | Portugal | NIF (checksum validated) |
153
+ | Ireland | PPS Number |
154
+ | Australia | TFN (checksum validated), Medicare |
155
+ | New Zealand | IRD Number |
156
+ | Japan | My Number |
157
+ | South Korea | RRN |
158
+ | Singapore | NRIC/FIN |
159
+ | India | Aadhaar, PAN |
160
+ | Brazil | CPF |
161
+
162
+ ### Enterprise and Infrastructure
163
+ | Type | Examples |
164
+ |------|----------|
165
+ | Internal Hostnames | `server-web-01.internal`, `db-prod.corp.local`, `nas.lan` |
166
+ | Windows UNC Paths | `\\fileserver\shared\docs` |
167
+ | LDAP Distinguished Names | `CN=John,OU=Users,DC=corp,DC=local` |
168
+ | Active Directory Users | `CORP\jsmith` |
169
+ | Private IPs (RFC 1918) | `10.0.1.50`, `172.16.0.1`, `192.168.1.1` |
170
+ | Database Connection Strings | JDBC, MongoDB, PostgreSQL, MySQL, Redis, MSSQL |
171
+ | API Keys | AWS (`AKIA...`), GCP (`AIza...`), Stripe, OpenAI, GitHub, Slack |
172
+ | Auth Tokens | Bearer tokens, JWT tokens |
173
+ | Cryptographic Material | PEM private keys, SSH public keys |
174
+ | Secrets in Config | `password=`, `api_key=`, `secret=`, `token=` patterns |
175
+ | Azure Keys | Storage keys, SAS tokens |
176
+ | Slack Webhooks | `hooks.slack.com/services/...` |
177
+
178
+ ### Vehicle
179
+ | Type | Examples |
180
+ |------|----------|
181
+ | VIN | `1HGBH41JXMN109186` (17-character) |
182
+ | License Plates | German (`M AB 1234`), UK (`AB12 CDE`), French (`AB-123-CD`) |
183
+
184
+ ### Biometric and Digital Identity
185
+ | Type | Examples |
186
+ |------|----------|
187
+ | UUID/GUID | `550e8400-e29b-41d4-a716-446655440000` |
188
+ | Social Media Handles | `@username` |
189
+ | IMEI | Device identifiers |
190
+ | ICCID | SIM card numbers |
191
+
192
+ ### Custom Business Identifiers
193
+ Add your own patterns for anything specific to your business:
194
+ | Example | Regex |
195
+ |---------|-------|
196
+ | Order IDs | `ORD-\d{6}` |
197
+ | SKU Codes | `SKU-[A-Z0-9]{8}` |
198
+ | Ticket Numbers | `TICKET-\d+` |
199
+
200
+ ---
201
+
202
+ ## 6 Operations: When to use what
203
+
204
+ | Operation | When to use it | What it does | Example workflow |
205
+ |-----------|---------------|-------------|-----------------|
206
+ | **Redact** | Before sending data to an LLM, API, or third-party service | Detects and replaces all sensitive data with safe tokens. Stores originals in vault for later restoration. | `[Data Source] > Redact > [OpenAI] > Restore > [Output]` |
207
+ | **Restore** | After the LLM or service has processed the tokenized data | Swaps all tokens back to original values using the vault. Your output has real data again. | Place after your LLM node, before the final output. |
208
+ | **Detect** | Compliance audits, data assessment, before deciding to redact | Scans all data for sensitive information and returns a full report. Does NOT modify the data. Use this to understand what PII exists. | `[Data Source] > Detect > [If PII found] > Redact` |
209
+ | **Verify** | After redaction, to confirm nothing leaked through | Re-scans redacted output to check if any PII slipped past. Returns PASS or FAIL with details of any leaks. Defense-in-depth. | `[Data Source] > Redact > [LLM] > Verify > [Alert if FAIL]` |
210
+ | **Purge** | GDPR right to erasure, cleanup, end of workflow | Deletes vault sessions from memory or disk. Ensures no PII mapping data remains after processing. Required for GDPR Article 17 compliance. | `[End of workflow] > Purge` |
211
+ | **Stats** | Debugging, monitoring, admin | Shows all active vault sessions with entry counts and creation times. Use to monitor vault health and check for stale sessions. | Run manually to inspect vault state. |
212
+
213
+ **Recommended workflow for production:**
214
+ ```
215
+ [Data Source] > Detect (assess) > Redact (protect) > [LLM] > Verify (confirm) > Restore (recover) > [Output] > Purge (cleanup)
216
+ ```
217
+
218
+ ---
219
+
220
+ ## 4 ways to redact
221
+
222
+ Choose the right mode for your use case:
223
+
224
+ | Mode | Output | Reversible? | Best for |
225
+ |------|--------|-------------|----------|
226
+ | **Token** | `[EMAIL_0]` | Yes - vault restores originals | LLM workflows (recommended) |
227
+ | **Mask** | `j***@e***.com` | No | Logs, dashboards, support tickets |
228
+ | **Hash** | `[EMAIL:a3f2b8c91d4e]` | No | Analytics, deduplication |
229
+ | **Redact** | `[REDACTED]` | No | Maximum privacy, audit trails |
230
+
231
+ ---
232
+
233
+ ## Smart features that matter
234
+
235
+ ### Deduplication
236
+ When the same email appears in 5 fields, it gets the same token (`[EMAIL_0]`) everywhere. The LLM understands it's the same person. Relationships in your data are preserved.
237
+
238
+ ### Field Targeting
239
+ Don't want to scan internal IDs or metadata? Use allowlist or denylist mode:
240
+ - **Allowlist:** Only scan `user.email`, `*.phone`, `contacts[*].name`
241
+ - **Denylist:** Skip `internalId`, `metadata.*`, `debug`
242
+
243
+ ### Persistent Vault
244
+ Choose between in-memory (fast, lost on restart) or file-based vault (survives n8n restarts). File vault stores mappings in `~/.n8n/pii-vault/`. Sessions auto-expire based on TTL.
245
+
246
+ ### Session TTL
247
+ Vault sessions auto-expire after 60 minutes by default. No unbounded memory growth. Configurable per workflow.
248
+
249
+ ### Audit Report
250
+ Enable the second output to get a full compliance trail:
251
+ ```json
252
+ {
253
+ "totalHits": 7,
254
+ "hitsByCategory": { "contact": 3, "identity": 2, "financial": 2 },
255
+ "hitsByPattern": { "EMAIL": 2, "PHONE": 1, "SSN": 1, "CREDIT_CARD": 1, "PERSON": 2 },
256
+ "hits": [...]
257
+ }
258
+ ```
259
+
260
+ ### Validation - Not Just Regex
261
+ Credit card numbers are **Luhn-checked**. IBANs are **checksum-verified** (ISO 13616). NHS numbers pass **mod-11 validation**. This means fewer false positives and less over-redaction that kills your LLM output quality.
262
+
263
+ ---
264
+
265
+ ## Installation
266
+
267
+ ### From n8n (Recommended)
268
+ 1. Go to **Settings > Community Nodes**
269
+ 2. Enter `n8n-nodes-redactor`
270
+ 3. Click **Install**
271
+ 4. Done. The "Redactor" node appears in your node palette.
272
+
273
+ ### Manual
274
+ ```bash
275
+ cd ~/.n8n/nodes
276
+ npm install n8n-nodes-redactor
277
+ # Restart n8n
278
+ ```
279
+
280
+ ---
281
+
282
+ ## Quick Start (2 minutes)
283
+
284
+ 1. **Install** the node
285
+ 2. **Add "Redactor"** to your workflow, set operation to **Redact**
286
+ 3. **Connect it** before your OpenAI/Claude/Gemini node
287
+ 4. **Add another "Redactor"** after the LLM node, set operation to **Restore**
288
+ 5. Both nodes share the same Session ID (defaults to execution ID - works automatically)
289
+ 6. **Run your workflow.** Customer data stays on your server.
290
+
291
+ That's it. No configuration needed for the default case.
292
+
293
+ ---
294
+
295
+ ## Who this is for
296
+
297
+ - **n8n consultants** building AI workflows for clients who ask "is our data safe?"
298
+ - **Agencies** delivering GDPR-compliant automation for EU clients
299
+ - **Companies** processing customer support tickets, emails, or documents through LLMs
300
+ - **Healthcare** organizations that need HIPAA compliance before sending data to AI
301
+ - **Anyone** who lies awake thinking about what happens when customer data hits an external API
302
+
303
+ ---
304
+
305
+ ## We build GDPR-compliant AI workflows. For a living.
306
+
307
+ We've delivered n8n + AI automation for clients across **e-commerce**, **healthcare**, **financial services**, and **consulting**. The GDPR question around client data hitting external APIs keeps coming up. We built this node because we needed it for real client projects.
308
+
309
+ **This node exists because we solve this problem every day.**
310
+
311
+ If you need help setting up PII-safe AI workflows, custom redaction rules, or end-to-end GDPR-compliant automation - we've done it before and would be happy to do it for you.
312
+
313
+ <p align="center">
314
+ <a href="https://services.next8n.com"><img src="https://img.shields.io/badge/Book_a_Free_Consultation-services.next8n.com-FF6D5A?style=for-the-badge&logoColor=white" alt="Book a consultation" /></a>
315
+ </p>
316
+
317
+ <p align="center">
318
+ <a href="https://next8n.com"><strong>next8n.com</strong></a> &nbsp;|&nbsp; <a href="https://services.next8n.com"><strong>Schedule a call</strong></a>
319
+ </p>
320
+
321
+ ---
322
+
323
+ ## Missing a use case? We'll build it for you.
324
+
325
+ This node covers 210+ data types across 22 privacy regulations. But every business has unique data: internal codes, proprietary identifiers, industry-specific formats.
326
+
327
+ **You can add your own patterns directly in the node UI** using the Custom Patterns section. Define any regex, give it a label, and the engine will detect and redact it alongside the built-in patterns.
328
+
329
+ If there is a specific use case that is not covered here and you want us to cover it so that everyone can benefit from it, or if you want a customized implementation built on top of this node, **reach out to us and we will be happy to enhance it accordingly.**
330
+
331
+ <p align="center">
332
+ <a href="https://services.next8n.com"><img src="https://img.shields.io/badge/Request_a_Custom_Pattern_or_Feature-services.next8n.com-7B61FF?style=for-the-badge&logoColor=white" alt="Request a feature" /></a>
333
+ </p>
334
+
335
+ ---
336
+
337
+ ## Also by next8n
338
+
339
+ <p align="center">
340
+ <a href="https://www.npmjs.com/package/n8n-nodes-xentral"><img src="https://img.shields.io/badge/n8n--nodes--xentral-30_Resources_|_163_Operations_|_58_Webhooks-00C4B4?style=for-the-badge" alt="n8n-nodes-xentral" /></a>
341
+ </p>
342
+
343
+ **[n8n-nodes-xentral](https://www.npmjs.com/package/n8n-nodes-xentral)** - The most comprehensive n8n community node for Xentral ERP. 30 resources, 163 operations, 58 webhook events. Full API audit verified. If you're automating Xentral workflows, this is the node you need.
344
+
345
+ ---
346
+
347
+ ## License
348
+
349
+ **Fair Use Code License (FUCL)**
350
+
351
+ Copyright (c) 2026 Mirza Iqbal / [next8n](https://next8n.com). All rights reserved.
352
+
353
+ This node is published as an n8n community node for the benefit of the n8n ecosystem and the teams building AI workflows that need to handle customer data responsibly. However, the intellectual property, source code, and all associated rights are owned exclusively by the copyright holder.
354
+
355
+ **Permitted:**
356
+ - Install and use this node for your own internal workflows and business automation
357
+
358
+ **Prohibited without explicit written consent:**
359
+ - Copying, forking, or reproducing the source code in any form
360
+ - Commercial redistribution, resale, sublicensing, or white-labeling
361
+ - Creating derivative works or competing products based on this code
362
+ - Public redistribution of modified or unmodified versions
363
+ - Using the Software as part of a commercial service offering
364
+ - Removing or altering copyright notices or attribution
365
+
366
+ **Attribution:** This node was developed and is actively maintained by [next8n](https://next8n.com). Attribution must be preserved in all copies.
367
+
368
+ This software is provided "as is", without warranty of any kind, express or implied.
369
+
370
+ **We built it. We maintain it. We own the rights to the code.**
371
+
372
+ **Legal notice:** This is an original, independently authored work. The entire source code is the intellectual property of the copyright holder. No third-party proprietary code is included. All PII detection runs locally using pattern matching and validation algorithms authored by next8n.
373
+
374
+ Interested in collaborating or contributing? We're open to partnerships. Let's talk.
375
+
376
+ For commercial licensing, partnership, or custom development: [services.next8n.com](https://services.next8n.com)