RedActor

March 27, 2026 ยท View on GitHub

Anonymize code before sharing or using AI.

Automatically detect and remove sensitive data from your code, logs, and prompts โ€” locally, with zero setup.

๐Ÿš€ Why RedActor

Developers constantly copy/paste code into:

  • AI tools (Copilot, ChatGPT)
  • GitHub issues / PRs
  • StackOverflow / Slack

๐Ÿ‘‰ This often leaks:

  • API keys
  • internal URLs
  • emails
  • IPs

RedActor prevents that โ€” instantly.

โšก What it does

RedActor automatically anonymizes:

  • Emails โ†’ user@email.com
  • URLs โ†’ https://example.com
  • IP addresses โ†’ 0.0.0.0
  • AWS keys โ†’ SECRET_1
  • Your custom patterns โ†’ fully configurable

Runs fully local. No data leaves your machine.

๐Ÿง  Example

Input

const email = "dev@company.com";
const api = "https://intranet.local";
const ip = "10.0.0.12";
const aws = "AKIA1234567890ABCDEF";

Output

const email = "user@email.com";
const api = "https://example.com";
const ip = "0.0.0.0";
const aws = "SECRET_1";

๐Ÿ”ง Custom patterns (power feature)

Define your own anonymization rules using regex.

Replace internal IDs

{
  "/user_[0-9]+/g": "user_XXX"
}

Example:
const id = "user_12345"; โ†’ const id = "user_XXX";

Mask company domains

{
  "/https:\\/\\/.*\\.internal/g": "https://example.com"
}

Example:
const api = "https://payments.internal"; โ†’ const api = "https://example.com";

Replace tokens

{
  "/token_[a-zA-Z0-9]+/g": "TOKEN"
}

Example:
const token = "token_abC123XYZ"; โ†’ const token = "TOKEN";

๐Ÿ‘‰ Adapt RedActor to your company rules or any custom format.

๐Ÿงฉ VSCode Extension

Use RedActor directly in VSCode:

  • Command: Anonymize Code
  • Works instantly on your file
  • Opens anonymized version side-by-side

๐Ÿ“ฆ Installation

Monorepo (local dev)

pnpm install
pnpm build

Core package

pnpm add @gianfa/redactor-core

โš™๏ธ Usage

import { anonymize } from "@gianfa/redactor-core";

const result = anonymize(code);

console.log(result.code);
console.log(result.findings);
console.log(result.map);

๐Ÿ–ฅ CLI

node packages/core/dist/cli.js ./input.txt
  • anonymized code โ†’ stdout
  • findings โ†’ stderr

๐Ÿ”ง Use custom rules from JSON

node packages/core/dist/cli.js ./input.txt ./anonymizations.json

or

ANONYMIZE_JSON=./anonymizations.json node packages/core/dist/cli.js ./input.txt

๐ŸŽฏ Use cases

  • Safe AI usage (no leaks)
  • Sharing code publicly
  • Cleaning logs before debugging
  • Protecting internal data

๐Ÿข For teams

Using AI with real code?

You might be leaking sensitive data across your organization.

โ†’ Contact for a team-ready solution (policies, CI integration, custom rules)

๐Ÿ“š Examples

See docs/examples

๐Ÿ’ก Keywords (SEO)

anonymize code, remove secrets, redact code, AI privacy, sanitize logs, protect API keys