SecretShield for VS Code
The Security Layer Between Developers and AI.
SecretShield detects and masks secrets — API keys, tokens, passwords, private keys, database
credentials — locally, before you paste code or prompts into an AI assistant.
Install
Search for StackAPI.secretshield-vscode in the Extensions view, or run:
code --install-extension StackAPI.secretshield-vscode
Secure Copy
- Select a function, or nothing to take the whole file.
- Run SecretShield: Secure Copy (
Ctrl+Alt+Shift+C / Cmd+Alt+Shift+C, or the editor context menu).
- Review the redacted preview and confirm.
- Only the redacted text is placed on the clipboard. Paste it into your assistant.
const API_KEY = "sk_live_…"; → const API_KEY = "sk_live_********";
const password = "…"; → const password = "********";
postgres://admin:…@db/app → postgres://********:********@db/app
Commands
| Command |
What it does |
| SecretShield: Secure Copy |
Copy the selection or file with secrets masked |
| SecretShield: Secure Prompt (Redact Clipboard) |
Redact the prompt currently on the clipboard |
| SecretShield: Redact Selection |
Replace secrets in the selection (undoable) |
| SecretShield: Preview Redaction |
Open a read-only redacted preview |
| SecretShield: Scan Current File / Scan Selection |
Show diagnostics for possible secrets |
| SecretShield: Scan Workspace |
Scan the project in a background worker (cancellable) |
| SecretShield: Show Security Report |
Markdown report without any secret values |
| SecretShield: Manage Rules |
Enable/disable rules, add or remove custom RE2 rules |
Privacy
- Everything runs locally. SecretShield makes no network requests and collects no telemetry.
- Diagnostics, previews, notifications and reports never show original values.
- The clipboard is only read or written when you run Secure Copy or Secure Prompt.
- Nothing is stored on disk; previews live in memory and disappear when closed.
Workspace Trust
In untrusted workspaces SecretShield runs in limited mode: only built-in rules and your user
settings are used. Workspace-level rules, disabled rules and .secretshieldignore files from the
repository are ignored, so a cloned project cannot silence detection or inject slow patterns.
Settings
| Setting |
Default |
Description |
secretShield.enabled |
true |
Enable diagnostics |
secretShield.scanOnSave / scanOnOpen |
true / false |
Automatic scans |
secretShield.maskingStrategy |
partial |
partial keeps public vendor prefixes only, full, or token |
secretShield.showPreview |
true |
Preview and confirm before copying or replacing |
secretShield.entropyDetection |
true |
Detect random-looking strings |
secretShield.minConfidence |
40 |
Ignore weaker findings |
secretShield.useIgnoreFile |
true |
Honour .secretshieldignore (trusted workspaces only) |
secretShield.maxFileSizeKB |
2048 |
Larger files are reported as not scanned |
secretShield.disabledRules |
[] |
Rule ids to disable |
secretShield.customRules |
[] |
Custom rules (RE2 patterns, linear time) |
secretShield.localOnly |
true |
Always on: processing is local |
Masks have a fixed length, so they never reveal how long a secret is. Unlike a fixed
preservePrefix, SecretShield only keeps prefixes that are public by design (sk_live_, ghp_,
AKIA…), never the first characters of a password.
Limitations
Detection is heuristic: SecretShield reduces the risk of accidental disclosure but cannot guarantee
that every secret is found. A VS Code extension cannot intercept copy/paste in other applications,
which is why Secure Copy is an explicit command. If a secret was already shared, masking it
afterwards does not revoke it: rotate the secret.
License: Apache-2.0