title: How to Redact Internal Directives, Bearer JWTs, and PII Variables from GraphQL Schemas & Query Logs in Local Browser RAM
published: true
tags: graphql, security, webdev, infosec
canonical_url: https://xvibelabs.com/tools/073-graphql-schema-inspector/
When debugging complex GraphQL APIs—whether across federated subgraphs, Hasura permissions, or Apollo client traces—engineers regularly export .graphql Schema Definition Language (SDL) files, __schema introspection JSON payloads, and operation variables dumps.
However, attaching raw GraphQL artifacts to vendor support tickets, GitHub issues, or external QA threads introduces four critical leak vectors:
-
Internal RBAC & Federation Directives: Custom directives like
@auth(role: ADMIN),@internal(upstream: "http://10.24.8.19:8080"), or federation@linkURLs expose your internal microservice topology. -
Admin Headers & Session JWTs: Exported GraphQL trace logs often retain
Authorization: Bearer <JWT>,x-hasura-admin-secret, or session cookies. -
Plaintext PII in Operation Variables: A failed
CreatePaymentIntentorUpdateCustomerProfilemutation dump almost always carries real customer emails, billing addresses, card tokens, or SSNs inside thevariablesJSON object. - Cloud Formatter Egress Risk: Pasting proprietary schemas or production query logs into server-side online formatters transmits your API blueprint to an unknown third party.
Structure-Preserving In-Browser GraphQL Sanitization
To solve this without requiring a $49/seat/month cloud workspace, we built GraphQL Schema & Query Token Redactor (073-graphql-schema-inspector), which executes 100% inside local browser RAM.
// Deterministic 3-Tier GraphQL Variable & Directive Scrubbing
const sanitizeGraphqlPayload = (rawPayload, intensityPct = 70) => {
return rawPayload
.replace(/(Bearer\s+)[A-Za-z0-9\-_]+\.[A-Za-z0-9\-_]+\.[A-Za-z0-9\-_]+/gi, '$1[REDACTED_GQL_JWT]')
.replace(/((?:x-hasura-admin-secret|x-api-key|cardToken)"\s*:\s*")([^"]+)(")/gi, '$1[REDACTED_GQL_SECRET]$3')
.replace(/@(?:internal|auth|private)\([^)]*\)/gi, '@directive([REDACTED_META])');
};
Key Capabilities
-
3-Tier Redaction Depth Slider (35% / 70% / 95%): Switch seamlessly between partial prefix masking for internal debugging (
35%), standard token & PII scrubbing (70%), and strict Safe-Harbor directive & endpoint stripping (95%). - Instant Free 70% Plaintext Export: Copy or download the first 70% of sanitized GraphQL records immediately for free—no login wall.
-
Air-Gapped PRO Workstation: Need unlimited multi-file batch sanitization for large
__schemaintrospection dumps? Unlock the standalone offline HTML5 workstation (€3.99 24h Pass or $19 lifetime buyout).
Try the interactive sandbox right in your browser: https://xvibelabs.com/tools/073-graphql-schema-inspector/
👉 Open GraphQL Schema & Query Token Redactor Live Sandbox
🔗 Related Local-First Utilities in the XVibe Suite
If your team handles sensitive diagnostic payloads across multiple layers of the stack, explore our companion zero-cloud browser tools:
- HAR Log Network Token Redactor — Sanitize HTTP Archive (HAR) network logs, session cookies, Bearer tokens, API keys, and POST body credentials
- Stripe Webhook Payload Scrubber — Sanitize Stripe Webhook event JSON payloads, customer billing details, card fingerprints, IBANs, and client_se
- Postman Collection Token Redactor — Sanitize Postman Collection v2.1 JSON exports, environment variable files, OAuth2 Bearer JWT tokens, and x-api
- Opentelemetry Trace Redactor — Sanitize and redact sensitive PII span attributes, HTTP Authorization bearer tokens, SQL bind parameters, and
Top comments (0)