piiguardrails

Enterprise PII Guardrails connector for n8n: Enterprise-grade PII masking, restoration, and compliance guardrails for AI/LLM workflows

Package Information

Released: this month
Downloads: 0 weeklyΒ /Β 0 monthly
Latest Version: 0.2.2
Author: piiguardrails.com

Documentation

Enterprise PII Guardrails Node for n8n

npm version Node.js version n8n community node License: MIT Zero Data Retention Compliance Standards

Zero-leakage data privacy, deterministic PII masking, cryptographic token restoration, and statutory compliance guardrails for AI/LLM workflows in n8n.
Developed and maintained by piiguardrails.com.


πŸ“‘ Table of Contents


πŸ”’ Overview & Architecture

The Enterprise PII Guardrails connector acts as a deterministic privacy firewall between your sensitive business systems (CRMs, databases, email triggers, webhooks) and third-party Large Language Models (OpenAI, Anthropic Claude, Google Gemini, Mistral, Ollama).

Instead of exposing customer identities, financial instruments, and medical records to external AI providers, this node automatically intercepts, redacts, and cryptographically isolates sensitive entities before they leave your perimeter, and flawlessly restores them into the LLM's generated response.

[Incoming Trigger / CRM / Webhook]
       β”‚
       β–Ό (Contains sensitive PII: Alice Smith, SSN, Credit Card, Medical ID)
[πŸ›‘οΈ PII Guardrails: Mask]
       β”‚
       β”œβ”€β”€β–Ί Generates cryptographically isolated token mapping in memory
       β–Ό (Sanitized text with deterministic tokens: [HUMAN_NAME_1], [CREDIT_CARD_1])
[πŸ€– AI / LLM Agent (OpenAI / Claude / Gemini / Ollama)]
       β”‚
       β–Ό (Model processes reasoning safely using sanitized placeholder tokens)
[πŸ”“ PII Guardrails: Unmask]
       β”‚
       β”œβ”€β”€β–Ί Recombines mapping dictionary to restore real customer data
       β–Ό (Reconstructed output with 100% data fidelity)
[Slack / Email / CRM / Database Delivery]

🚨 The Problem We Solve

When building automated AI workflows in n8n, organizations encounter severe regulatory and legal hurdles:

Challenge Without PII Guardrails With Enterprise PII Guardrails
Regulatory Compliance Violates HIPAA Β§164.514, GDPR Art 4/9/32, PCI-DSS v4.0 Req 3, and India DPDP Act 2023. 100% Compliant: Sensitive entities never leave your infrastructure.
Data Retention by LLM Vendors Customer names, SSNs, and health records get stored in vendor training/eval logs. Zero Exposure: LLM vendors only receive opaque tokens like [HUMAN_NAME_1].
Destructive Redaction Traditional redactors replace PII with [REDACTED], destroying the LLM's context and ability to reply personally. Deterministic Pseudonymization: Consistent tokens preserve grammatical agreement and context.
Bi-Directional Restoration Generic scrubbers cannot restore the original data into the model's generated answer. Lossless Token Restoration: Automated unmasking matches original values flawlessly.

⚑ Key Operations

1. Mask (Sanitize Prompt)

Scans input text or structured JSON payloads, detects all sensitive entities, replaces them with deterministic placeholders, and outputs the sanitized payload alongside an isolated token mapping.

Sample Input

Hello Support, my name is Alice Smith (email: alice.smith@healthcare.corp, cell: 415-555-2671).
Please process insurance claim for Patient ID MRN-998234 using Visa card 4111-2222-3333-4444.

Output Payload Structure

{
  "masked_text": "Hello Support, my name is [HUMAN_NAME_1] (email: [EMAIL_ADDRESS_1], cell: [PHONE_NUMBER_1]). Please process insurance claim for Patient ID [MEDICAL_RECORD_NUMBER_1] using Visa card [CREDIT_CARD_NUMBER_1].",
  "mapping": {
    "[HUMAN_NAME_1]": "Alice Smith",
    "[EMAIL_ADDRESS_1]": "alice.smith@healthcare.corp",
    "[PHONE_NUMBER_1]": "415-555-2671",
    "[MEDICAL_RECORD_NUMBER_1]": "MRN-998234",
    "[CREDIT_CARD_NUMBER_1]": "4111-2222-3333-4444"
  },
  "interception_counts": {
    "HUMAN_NAME": 1,
    "EMAIL_ADDRESS": 1,
    "PHONE_NUMBER": 1,
    "MEDICAL_RECORD_NUMBER": 1,
    "CREDIT_CARD_NUMBER": 1
  },
  "entity_count": 5
}

2. Unmask (Restore Output)

Accepts the generated response from an upstream AI/LLM node containing placeholder tokens, matches them against the preserved mapping dictionary, and reconstructs the final text with original data intact.

Sample Input to Unmask

  • Generated Text from LLM:
    Dear [HUMAN_NAME_1], we have confirmed receipt of claim [MEDICAL_RECORD_NUMBER_1].
    A receipt has been dispatched to [EMAIL_ADDRESS_1], and the balance was charged to card [CREDIT_CARD_NUMBER_1].
    
  • Mapping Dictionary: Wired directly from the upstream Mask node ({{ $('PII Guardrails: Mask').item.json.mapping }}).

Output Payload Structure

{
  "unmasked_text": "Dear Alice Smith, we have confirmed receipt of claim MRN-998234. A receipt has been dispatched to alice.smith@healthcare.corp, and the balance was charged to card 4111-2222-3333-4444."
}

3. Scan / Audit (Detect Only)

Passively audits payloads for sensitive PII, compliance violations, and confidentiality leaks without mutating the content. Ideal for automated quality assurance, DLP (Data Loss Prevention) triggers, and security routing.

Output Payload Structure

{
  "has_pii": true,
  "entity_count": 3,
  "interception_counts": {
    "EMAIL_ADDRESS": 1,
    "PHONE_NUMBER": 1,
    "CREDIT_CARD_NUMBER": 1
  },
  "detected_entities": [
    "EMAIL_ADDRESS",
    "PHONE_NUMBER",
    "CREDIT_CARD_NUMBER"
  ],
  "findings": [
    { "type": "EMAIL_ADDRESS", "count": 1 },
    { "type": "PHONE_NUMBER", "count": 1 },
    { "type": "CREDIT_CARD_NUMBER", "count": 1 }
  ],
  "text": "Alice Smith (alice.smith@healthcare.corp, 415-555-2671) charged card 4111-2222-3333-4444."
}

πŸ“‹ Supported Entities & Compliance Catalog

Enterprise PII Guardrails features an enterprise-grade hybrid detection engine combining contextual machine learning NER, deterministic pattern recognition, Shannon entropy analysis, and statutory validation algorithms:

Category Entity Type Generated Token Statutory / Regulatory Mapping Validation Method
Personal Identity Full Names / Surnames [HUMAN_NAME_N] GDPR Art 4(1), CCPA/CPRA, HIPAA Safe Harbor Β§164.514 Multi-Token Contextual NER
Contact Data Email Addresses [EMAIL_ADDRESS_N] GDPR, CCPA, TCPA, DPDP Act 2023 RFC 5322 Compliant Regex
Telephony Phone & Mobile Numbers [PHONE_NUMBER_N] TCPA, HIPAA, GDPR, DPDP Act E.164 + Country-Specific Regex
National IDs US Social Security Number [US_SSN_N] HIPAA, GLBA, PCI-DSS Area/Group Format + SSN Validator
Financial Credit / Debit Cards [CREDIT_CARD_NUMBER_N] PCI-DSS v4.0 Req 3, GLBA Luhn Algorithm (MOD 10) Checksum
Financial International Bank Account (IBAN) [BANK_ACCOUNT_N] GLBA, SEPA, Financial Privacy Act ISO 13616 MOD 97 Validation
Healthcare Medical Record Number (MRN) [MEDICAL_RECORD_NUMBER_N] HIPAA Safe Harbor 18 Identifiers Clinical Identifier Rules
Healthcare Health Insurance Policy / NPI [HEALTH_PLAN_ID_N] HIPAA Compliance, HITECH Act CMS National Provider Format
Cybersecurity API Secrets & Private Keys [API_SECRET_KEY_N] SOC 2 Type II, ISO 27001 High-Entropy + Header Signatures
Network IPv4 & IPv6 Addresses [IP_ADDRESS_N] GDPR (Recital 30 Online Identifiers) Octet & Subnet Boundary Verification
Cryptocurrency Bitcoin / Ethereum Addresses [CRYPTO_WALLET_N] FinCEN, BSA Regulations Base58 / Keccak-256 Checksum

πŸ› οΈ Node Configuration & Parameter Reference

Node Parameters

Parameter Type Required Default Description
Operation options Yes mask Select operation: Mask (Sanitize Prompt), Unmask (Restore Output), or Scan / Audit (Detect Only).
Text to Process string Yes ={{ $json.text }} The input text expression or variable containing sensitive data to be sanitized or audited.
Token Mapping json Yes (Unmask only) ={{ $json.mapping }} JSON object containing placeholder-to-original mappings emitted by an upstream Mask node.

Credential Configuration (piiGuardrailsApi)

Field Type Required Placeholder / Default Description
Base URL string Yes http://localhost:8000 Target URL of your server instance. Use https://demo.piiguardrails.com for instant sandbox testing, or http://localhost:8000 (http://host.docker.internal:8000) for on-premise Docker.
API Key string (password) Yes (Empty) Your Enterprise API key or instant sandbox key (demo_...).

πŸš€ Quick Start: 60-Second Instant Sandbox

Test Enterprise PII Guardrails immediately in n8n without installing a local server:

  1. Get Sandbox Key:
  2. Configure Credentials in n8n:
    • In n8n, navigate to Credentials βž” New Credential βž” search for Enterprise PII Guardrails API.
    • Set Base URL: https://demo.piiguardrails.com
    • Set API Key: Paste your copied sandbox key (demo_...)
    • Click Save.
  3. Execute Test:
    • Add the PII Guardrails node to any workflow, select Mask, enter sample text containing names and emails, and hit Test step.

🏒 Production On-Premises & Private Cloud Deployment

For air-gapped, sovereign, or private corporate VPC deployments (HIPAA/GDPR on-premise compliance):

Run via Docker

docker run -d \
  --name pii-guardrails \
  -p 8000:8000 \
  -e ACCEPT_LICENSE=true \
  -v pii_data:/app/data \
  --restart unless-stopped \
  piiguardrails/enterprise-pii-guardrail:latest

Docker Compose

services:
  pii-guardrails:
    image: piiguardrails/enterprise-pii-guardrail:latest
    container_name: pii-guardrails
    restart: unless-stopped
    ports:
      - "8000:8000"
    environment:
      - ACCEPT_LICENSE=true
    volumes:
      - pii_data:/app/data
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
      interval: 10s
      timeout: 5s
      retries: 3

volumes:
  pii_data:

[!TIP]
Containerized n8n Networking Note:
If n8n runs inside Docker on the same host machine as the Guardrails server, do not use http://localhost:8000 (which targets n8n's own container). Instead, set Base URL to:

  • Docker Desktop (Mac / Windows): http://host.docker.internal:8000
  • Podman (Linux / Windows): http://host.containers.internal:8000
  • Docker Compose: http://pii-guardrails:8000 (using service name on shared network).

πŸ“¦ Pre-Built Workflow Templates & One-Click Import

We provide ready-to-run workflow templates that demonstrate an end-to-end PII-safe LLM pipeline:

How to Import into n8n:

  • Option A (Instant Paste): Open workflows/Local_PII_Safe_LLM_Pipeline.json, copy the entire JSON, click anywhere on your n8n workflow canvas, and press Ctrl + V (Cmd + V on Mac).
  • Option B (Import from URL): In your n8n canvas top-right menu (...), select Import from URL, paste the raw GitHub URL above, and click Import.

πŸ”§ Installation Guide

Method 1: Via n8n Community Nodes Settings (Recommended)

  1. In your self-hosted n8n instance, click Settings (gear icon in left sidebar).
  2. Select Community Nodes in the menu.
  3. Click Install a community node.
  4. In the package field, enter:
    n8n-nodes-piiguardrails
    
  5. Check the box agreeing to community terms and click Install.

Method 2: Via Container CLI

For containerized n8n deployments:

# Docker:
docker exec -u node -it <n8n-container-name> npm install n8n-nodes-piiguardrails

# Podman:
podman exec -u node -it <n8n-container-name> npm install n8n-nodes-piiguardrails

Restart the container after installation to refresh the node registry.


πŸ” Troubleshooting & Diagnostic FAQ

1. Request failed with status code 403

  • Cause: Missing, invalid, or expired API Key in credentials.
  • Resolution: If using the hosted sandbox, verify your key starts with demo_ and was copied fresh from https://demo.piiguardrails.com. If using on-premise, verify the key was generated in your Studio dashboard (http://localhost:8000/ui/).

2. connect ECONNREFUSED 127.0.0.1:8000

  • Cause: n8n is running inside a container and attempting to connect to its own container loopback rather than the host machine.
  • Resolution: Change Base URL in credentials from http://localhost:8000 to http://host.docker.internal:8000 (Docker) or http://host.containers.internal:8000 (Podman).

3. Tokens are not being restored during Unmask

  • Cause: The Token Mapping parameter in the Unmask node is not referencing the mapping emitted by the Mask node.
  • Resolution: In the Unmask node, ensure Token Mapping is set to expression:
    ={{ $('PII Guardrails: Mask').item.json.mapping }}
    

πŸ›‘οΈ Security & Zero Data Retention Guarantees

Enterprise PII Guardrails is architected under strict Zero-Trust principles:

  • Zero Telemetry: The server and connector emit zero telemetry, analytics, or external phone-home requests.
  • In-Memory Streaming: All redaction and token mappings are computed in volatile memory. No customer payloads or prompt texts are logged or written to persistent disk during /mask and /unmask operations.
  • Deterministic Token Isolation: Redacted tokens are generated using isolated session contexts, guaranteeing mathematical non-reversibility by third parties without the in-memory mapping dictionary.

πŸ“œ Intellectual Property & Licensing

Copyright (c) 2026 piiguardrails.com. All Rights Reserved.

This n8n community node package is open-source software licensed under the terms of the MIT License.

Note: Connecting to an Enterprise PII Guardrails server instance requires an active license or community key. See https://piiguardrails.com/license for server licensing details.

Discussion