ZuploZuplo
LoginSign Up
  • Documentation
  • API Reference
Introduction
Getting Started
    Develop using the Portal
      1 - Setup Your Gateway2 - Rate Limiting3 - API Key Auth4 - Deploy5 - Dynamic Rate LimitingMCP - Quick start
    Develop Locally
      1 - Setup Your Gateway2 - Rate Limiting3 - API Key Auth
Concepts
Development
Policies
    Policy Catalog
    Authentication
    Authorization
    Security & Validation
      Rate Limiting PolicyComplex Rate Limiting PolicyAudit Logs PolicyRequest Validation PolicyWeb Bot Auth PolicyBot Detection PolicyPrompt Injection Detection PolicyRequire Origin PolicyRequest Size Limit PolicySecret Masking PolicyStripe Webhook Auth PolicyAkamai AI Firewall Policy
    Metrics, Billing & Quotas
    Testing
    Request Modification
    Response Modification
    Upstream Authentication
    Archival
    GraphQL
    Other
    Guides
Handlers
API Keys
MCP Server
MCP Gateway
AI Gateway
Developer Portal
Monetization
Deploying & Source Control
Observability
Networking & Infrastructure
Account Management
Programming API
Build with AI
Zuplo CLI
Migration Guides
Platform LimitsSecuritySupportTrust & ComplianceChangelog
powered by Zudoku
Security & Validation

Secret Masking Policy

The Secret Masking policy searches for and masks common secrets and replaces them with a placeholder. Secrets that are automatically masked include:

  • Zuplo API keys
  • GitHub Tokens and Personal Access Tokens
  • Private key blocks
  • And more!

See the policy documentation for a full description of secrets that are masked via this policy.

This is especially useful as an outbound policy for MCP servers, APIs that interface with user generated content, or AI consumers.

Configuration

The configuration shows how to configure the policy in the 'policies.json' document.

config/policies.json
{ "name": "my-secret-masking-outbound-policy", "policyType": "secret-masking-outbound", "handler": { "export": "SecretMaskingOutboundPolicy", "module": "$import(@zuplo/runtime)", "options": { "additionalPatterns": [], "mask": "[REDACTED]" } } }

Policy Configuration

  • name <string> - The name of your policy instance. This is used as a reference in your routes.
  • policyType <string> - The identifier of the policy. This is used by the Zuplo UI. Value should be secret-masking-outbound.
  • handler.export <string> - The name of the exported type. Value should be SecretMaskingOutboundPolicy.
  • handler.module <string> - The module containing the policy. Value should be $import(@zuplo/runtime).
  • handler.options <object> - The options for this policy. See Policy Options below.

Policy Options

The options for this policy are specified below. All properties are optional unless specifically marked as required.

  • mask <string> - The string to replace detected secrets with. Defaults to "[REDACTED]".
  • additionalPatterns <string[]> - Extra regex patterns for secrets to mask.

Using the Policy

This policy masks sensitive secrets in outgoing requests to prevent exposure to downstream consumers. This is especially useful for AI agents and MCP clients (where LLMs should not consume potentially sensitive user generated information or poisoned agents are attempting to leak information they have access to).

Configuration

  • mask: The mask to use when redacting information. Default: [REDACTED]
  • additionalPatterns: Additional Regex patterns to mask secrets with (make sure to correctly escape "meta escape" characters: i.e., \b should be escaped \\b to avoid a JSON parsing error. Otherwise, you may see build errors).

Usage

Apply this policy to outbound requests in your route configuration:

Code
{ "policies": [ { "name": "secret-masking-policy", "policyType": "secret-masking-outbound", "handler": { "export": "SecretMaskingOutboundPolicy", "module": "$import(@zuplo/runtime)", "options": { "mask": "<SECRET MASKED>", "additionalPatterns": ["\\b(\\w+)=\\w+\\b"] } } } ] }

Masked secrets

  • Zuplo API keys (i.e. zpka_xxx)
  • GitHub Tokens and Personal Access Tokens (i.e. ghp_xxx)
  • Private key blocks (i.e. BEGIN PRIVATE KEY and END PRIVATE KEY)

Read more about how policies work

Edit this page
Last modified on May 29, 2026
Request Size Limit PolicyStripe Webhook Auth Policy
On this page
  • Configuration
    • Policy Configuration
    • Policy Options
  • Using the Policy
  • Configuration
  • Usage
JSON
JSON