Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
Improve PII detection for IPv6, international phones, and formatted credit cards
Saif97c94c660188
diff --git a/backend/src/lib/pii/index.ts b/backend/src/lib/pii/index.tsindex 4f80c6834c..2bc2d11729 100644--- a/backend/src/lib/pii/index.ts+++ b/backend/src/lib/pii/index.ts@@ -11,14 +11,17 @@ export enum PiiEntityType {// Precompiled RE2 patterns for PII detectionconst PII_PATTERNS: Record<PiiEntityType, RE2> = {[PiiEntityType.EMAIL]: new RE2("[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}", "g"),- [PiiEntityType.PHONE]: new RE2("\\b(?:\\+?1[-.]?)?\\(?[0-9]{3}\\)?[-.\\s]?[0-9]{3}[-.\\s]?[0-9]{4}\\b", "g"),+ [PiiEntityType.PHONE]: new RE2(+ "\\+[1-9]\\d{0,2}[-.\\s]?(?:\\(?\\d{1,5}\\)?[-.\\s]?){1,6}\\d{2,5}\\b|(?:\\+?1[-.]?)?\\(?\\b[0-9]{3}\\)?[-.\\s]?[0-9]{3}[-.\\s]?[0-9]{4}\\b",+ "g"+ ),[PiiEntityType.SSN]: new RE2("\\b[0-9]{3}[-\\s]?[0-9]{2}[-\\s]?[0-9]{4}\\b", "g"),[PiiEntityType.CREDIT_CARD]: new RE2(- "\\b(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|3[47][0-9]{13}|6(?:011|5[0-9]{2})[0-9]{12})\\b",+ "\\b(?:4[0-9]{3}[-\\s]?[0-9]{4}[-\\s]?[0-9]{4}[-\\s]?[0-9]{4}|4[0-9]{12}|5[1-5][0-9]{2}[-\\s]?[0-9]{4}[-\\s]?[0-9]{4}[-\\s]?[0-9]{4}|3[47][0-9]{2}[-\\s]?[0-9]{6}[-\\s]?[0-9]{5}|6(?:011[-\\s]?[0-9]{4}|5[0-9]{2}[-\\s]?[0-9]{4})[-\\s]?[0-9]{4}[-\\s]?[0-9]{4})\\b","g"),[PiiEntityType.IP_ADDRESS]: new RE2(- "\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b",+ "(?:(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)|(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|(?:[0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|(?:[0-9a-fA-F]{1,4}:){1,5}(?::[0-9a-fA-F]{1,4}){1,2}|(?:[0-9a-fA-F]{1,4}:){1,4}(?::[0-9a-fA-F]{1,4}){1,3}|(?:[0-9a-fA-F]{1,4}:){1,3}(?::[0-9a-fA-F]{1,4}){1,4}|(?:[0-9a-fA-F]{1,4}:){1,2}(?::[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:(?::[0-9a-fA-F]{1,4}){1,6}|(?:[0-9a-fA-F]{1,4}:){1,7}:|:(?::[0-9a-fA-F]{1,4}){1,7}|::(?:[fF]{4}:)?(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)","g")};diff --git a/docs/documentation/platform/agent-sentinel/activity-logs.mdx b/docs/documentation/platform/agent-sentinel/activity-logs.mdxindex de9ed4e14c..80bd55c059 100644--- a/docs/documentation/platform/agent-sentinel/activity-logs.mdx+++ b/docs/documentation/platform/agent-sentinel/activity-logs.mdx@@ -82,7 +82,7 @@ Every tool invocation through an MCP endpoint creates a log entry containing:- **Phone numbers** → `[REDACTED_PHONE]`- **Social Security Numbers** → `[REDACTED_SSN]`- **Credit card numbers** → `[REDACTED_CREDIT_CARD]`- - **IP addresses** → `[REDACTED_IP]`+ - **IP addresses (IPv4 and IPv6)** → `[REDACTED_IP]`You can configure PII filtering separately for requests and responses, and select which PII types to detect. See [MCP Endpoints - PII Filtering](/documentation/platform/agent-sentinel/mcp-endpoints#pii-filtering) for configuration details.</Accordion>diff --git a/docs/documentation/platform/agent-sentinel/mcp-endpoints.mdx b/docs/documentation/platform/agent-sentinel/mcp-endpoints.mdxindex 9c44cd40f5..2e4ef27a28 100644--- a/docs/documentation/platform/agent-sentinel/mcp-endpoints.mdx+++ b/docs/documentation/platform/agent-sentinel/mcp-endpoints.mdx@@ -150,7 +150,7 @@ MCP Endpoints support automatic PII (Personally Identifiable Information) filter| Phone | Phone numbers (US format) | `[REDACTED_PHONE]` || SSN | Social Security Numbers | `[REDACTED_SSN]` || Credit Card | Credit card numbers | `[REDACTED_CREDIT_CARD]` |-| IP Address | IPv4 addresses | `[REDACTED_IP]` |+| IP Address | IPv4 and IPv6 addresses | `[REDACTED_IP]` |### Configuring PII Filters@@ -191,10 +191,10 @@ MCP Endpoints support automatic PII (Personally Identifiable Information) filterYes, you can enable PII filtering independently for requests (data sent to MCP servers) and responses (data returned to AI clients). This gives you granular control over where redaction is applied.</Accordion><Accordion title="What PII types are supported?">- Infisical currently supports detection and redaction of: email addresses, phone numbers (US format), Social Security Numbers, credit card numbers, and IPv4 addresses.+ Infisical currently supports detection and redaction of: email addresses, phone numbers (US format), Social Security Numbers, credit card numbers, and IP addresses (both IPv4 and IPv6).</Accordion><Accordion title="Can I select different PII types for requests and responses?">- Not currently. The selected PII types apply to both request and response filtering. If you need different filtering rules, consider creating separate endpoints.+ No. The selected PII types apply to both request and response filtering. If you need different filtering rules, consider creating separate endpoints.</Accordion><Accordion title="Can I connect the same MCP server to multiple endpoints?">Yes, you can connect an MCP server to as many endpoints as needed. Each endpoint can have different tools enabled, allowing you to create different access profiles.diff --git a/frontend/src/pages/ai/MCPEndpointDetailPage/components/PiiFilterConfigModal.tsx b/frontend/src/pages/ai/MCPEndpointDetailPage/components/PiiFilterConfigModal.tsxindex 8bb2912a83..a83677a6e8 100644--- a/frontend/src/pages/ai/MCPEndpointDetailPage/components/PiiFilterConfigModal.tsx+++ b/frontend/src/pages/ai/MCPEndpointDetailPage/components/PiiFilterConfigModal.tsx@@ -96,7 +96,7 @@ export const PiiFilterConfigModal = ({ isOpen, onOpenChange, endpoint }: Props)<div><p className="text-sm font-medium text-mineshaft-200">Filter Responses</p><p className="text-xs text-bunker-400">- Redact PII from responses returned to users+ Redact PII from responses returned to clients</p></div><Switch