Back to Tools

Code Prompt Shield

Client-side only18 languages

Mask API keys, secrets, variables, and PII before sharing code with ChatGPT, Claude, Copilot, or Gemini. Fully reversible. Nothing leaves your browser.

Sensitive config detected

This looks like a .env or config file containing secrets. Enable "Secrets" masking and click Mask before sending to any AI.

Source code

15 lines · 414 chars

Restore from AI response

Paste the AI-generated code (with masked tokens). Click Restore to replace all placeholders back to your original identifiers.

No mapping loaded. Mask code above first, or .

All masking, scanning, and restoration runs entirely in your browser. Your code and mapping never leave your device.No server. No logs. No tracking of your code.

What Is Code Prompt Shield?

Code Prompt Shield masks sensitive values in your source code before you paste it into an AI tool. Every time a developer shares code with ChatGPT, Claude, or GitHub Copilot, secrets leak: API keys hardcoded in environment setup, JWT tokens in test fixtures, database URLs in config files, OAuth credentials left in commented code. Even if you think you removed them, pattern matching can pick up values you missed.

Code Prompt Shield automatically detects and replaces secrets, variable names, function names, and PII with generic placeholders — SECRET_ABCD, VAR_EFGH — before anything leaves your browser. You get useful AI help with logic and structure; the AI never sees your real credentials or proprietary identifiers. After the AI responds, paste the output back and restore everything in one click.

How it works

Shield Code in Seconds

01

Paste your code

Paste any source code — JavaScript, Python, SQL, TypeScript, Go, or other supported languages. Select the language for accurate identifier detection.

02

Auto-detect secrets

The tool scans for API keys, JWT tokens, database URLs, OAuth tokens, private keys, IP addresses, emails, and phone numbers — no configuration needed.

03

Mask with placeholders

Click Mask. Secrets become SECRET_XXXX, variables become VAR_XXXX, functions become VAR_XXXX. The mapping is deterministic and stored locally.

04

Copy safe version & restore

Copy the masked code and send it to AI. Paste the AI response into the Restore section and apply the mapping to get your real identifiers back.

What Code Prompt Shield Detects

Secret typeExamples detected
API keysSTRIPE_SECRET, OPENAI_API_KEY, AWS access keys
JWT tokenseyJhbGciOi… bearer tokens in headers
Passwordspassword=, passwd=, pwd= assignments
Database URLspostgres://, mysql://, mongodb+srv:// connection strings
Private keys-----BEGIN RSA PRIVATE KEY-----
OAuth tokensclient_secret=, access_token=, refresh_token=
Webhook secretswebhook_secret, HMAC signing keys
IP addressesIPv4 literals in string values
Use cases

When Developers Use Code Shield

🔍

AI Code Review

Share code with AI for review without leaking secrets, proprietary function names, or internal variable conventions.

🐛

Bug Reports

Paste failing code into AI for debugging. Secrets and identifiers are masked so you can share context safely.

💬

Stack Overflow Posts

Prepare code to post publicly. Mask credentials and PII before copying so no sensitive values appear in public forums.

📄

Documentation

Generate code docs with AI help. Mask real identifiers in examples before sending so documentation examples use safe placeholders.

👥

Pair Programming

Use AI as a pair programmer on proprietary code. Mask variables and function names to protect your architecture while getting logic help.

🌐

Open Source Contributions

Extract logic from private codebases for open source. Mask private identifiers before sharing snippets externally.

FAQ

FAQ

1Is the masking reversible?
Yes. Masking is deterministic — the same original token always produces the same placeholder. The mapping is shown in-page and can be downloaded as a JSON or .maskmap file. Paste the AI's response and click Restore to get your real identifiers back.
2What patterns are detected for secrets?
The tool detects API key assignments (api_key=, secret=, token=, password=), JWT token format (eyJ…), AWS access key prefixes (AKIA…), database connection strings (postgres://, mysql://, mongodb://), RSA/EC private key headers, and common OAuth patterns. Emails, phone numbers, and IP addresses are flagged as PII.
3What about false positives — will it mask code I need visible?
Secret detection targets known patterns, so most code logic is unaffected when only "Secrets" is enabled. Enable "Identifiers" to also mask variable and function names — that is a broader mask, useful when you want to hide your entire naming convention from AI. You can toggle each category independently.
4Can my team share mappings?
Yes. Download the mapping as a .json or .maskmap file and share it with teammates. Anyone with the mapping file can restore AI-generated code to your real identifier names — enabling workflows where one person masks, AI assists, and another restores.
5How do I compare original and masked code?
After masking, use the Original / Masked tab in the output panel to toggle between the two views. This lets you confirm which identifiers were replaced before you send the masked version to AI.
6What types of secrets does it detect?
It detects API keys, JWT tokens (eyJ...), AWS keys (AKIA...), database connection strings, RSA/EC private key headers, OAuth tokens, webhook secrets, IP addresses, email addresses, and phone numbers.
7Will code still work after masking?
The masked code is for sharing with AI only, not for execution. When you restore the AI response using the mapping, real identifiers are substituted back and the code will work correctly.
8How do I use masked code with an AI?
Copy the masked code and paste it into ChatGPT, Claude, or Copilot. The AI responds using placeholder names. Paste the AI response into the Restore section with the mapping to get back your real identifiers.
9What programming languages are supported?
18 languages: JavaScript, TypeScript, Python, Java, Go, SQL, JSON, C#, PHP, Rust, Ruby, Swift, Kotlin, Bash/Shell, YAML, TOML, C/C++, and XML/HTML.
10Does it store my code?
No. All processing runs in your browser. Your code, secrets, and mapping never leave your device. No data is sent to any server — verify by checking DevTools Network tab.
11How is it different from GitLeaks?
GitLeaks scans Git repositories for committed secrets. Code Prompt Shield is a browser-based masking tool for use before sharing code with AI. They are complementary tools for different stages.
12Can it mask API keys in strings?
Yes. The secret detector scans string literals for patterns matching API keys and tokens. String values like "sk-proj-XXXX" or "AKIA..." are detected and masked with a SECRET_XXXX placeholder.
13What is prompt injection?
Prompt injection is an attack where malicious content attempts to hijack an AI's instructions. Code Prompt Shield's comment stripping and masking reduces this risk when sharing code with AI.
Learn more

Developer Guides

Feedback for code_prompt_shield

Tell us what's working, what's broken, or what you wish we built next — it directly shapes our roadmap.

You make the difference

Good feedback is gold — a rough edge you hit today could be smoother for everyone tomorrow.

  • Feature ideas often jump the queue when lots of you ask.
  • Bug reports with steps get fixed faster — paste URLs or examples if you can.
  • Name and email are optional; we won't use them for anything except replying if needed.

Stay Updated

Get the latest tool updates, new features, and developer tips delivered to your inbox.

What you'll get
  • Product updates & new tools
  • JSON, API & developer tips
  • Unsubscribe anytime — no hassle

Get in touch

Feature ideas, bugs, or a quick thanks — we read every message.