Bastion Security
Security extension for Web3 and crypto development
Bastion Security helps developers prevent plaintext secret leaks and risky dependency usage directly in Visual Studio Code. It scans for private keys, seed phrases, token-like credentials, and suspicious supply-chain dependency patterns before they become incidents.
Why Bastion Security
- Local-first secret scanning for Web3 and crypto codebases.
- Private key and seed phrase detection with Problems panel diagnostics.
- Supply chain dependency checks across manifests and lockfiles.
- AI-generated code risk checks for potential credential exfiltration patterns.
- Clipboard consistency reminders for sensitive address workflows.
Features
Private Key And Secret Pattern Protection
- Reviews the active file for private-key-like strings, seed-phrase-like text, and high-entropy encoded values.
- Highlights findings in the editor and Problems panel.
- Uses configurable thresholds so teams can tune sensitivity for their codebase.
AI Code Review Assistant
- Reviews generated editor changes when enabled.
- Warns when generated code appears to combine sensitive values with network calls.
- Uses the editor language model API only when available and enabled by the user.
Clipboard Consistency Reminder
- Keeps a temporary in-memory copy of recently copied text.
- Warns when pasted text differs from the copied text being tracked.
- Useful when reviewing wallet addresses or other sensitive values before pasting.
Active Defensive Protocols
Advanced Credential Interception (Secrets Sentinel)
- Anti-Compromise Pattern Interception: Detects and blocks known secret-like patterns, encoded key material, and high-risk credential formats at edit time.
- Sensitive Text Lockout Behavior: Prevents risky credential content from being treated as normal low-risk text during active development workflows.
- Firewall Warden Diagnostics: Raises high-severity diagnostics in both the editor and the Problems panel so issues are visible and actionable immediately.
Configuration And Manifest Interception (Supply Chain Attack Firewall)
Bastion applies strict manifest and dependency checks to reduce supply chain compromise risk. The guard monitors dependency and configuration changes for indicators commonly linked to credential theft and data exfiltration campaigns.
- Crypto Stealer Blocklist Defense: Compares package names and related metadata against known malicious and high-risk dependency intelligence.
- Anti-Exfiltration Interception: Flags typosquatting and dependency-confusion style patterns that are frequently used to target sensitive development environments.
- Critical Blocking Alerts: Emits high-priority diagnostics when malicious or strongly suspicious manifest behavior is detected.
Commands
| Command |
Description |
Bastion Security: Scan Current File |
Manually review the active file. |
Bastion Security: Toggle Review Assistant |
Enable or disable generated-code review. |
Bastion Security: Open Review Log |
Open the review output channel. |
Bastion Security: Open Project File Log |
Open the project file review output channel. |
Bastion Security: Clear Clipboard Buffer |
Clear the temporary clipboard buffer. |
Bastion Security: Audit Dependencies for Known CVEs |
Run npm audit / composer audit / pip-audit on the workspace and show results in Problems. |
Settings
| Setting |
Default |
Description |
bastionSecurity.enable |
true |
Enable editor diagnostics. |
bastionSecurity.enableAiGuard |
true |
Enable generated-code review. |
bastionSecurity.enableSupplyChainGuard |
true |
Enable project file checks. |
bastionSecurity.enableClipboardGuard |
true |
Enable clipboard consistency reminders. |
bastionSecurity.debugClipboardGuard |
false |
Enable verbose local clipboard output. |
bastionSecurity.hexTextThreshold |
3.85 |
Minimum entropy threshold for plaintext EVM/hex key diagnostics. |
bastionSecurity.base58TextThreshold |
4.3 |
Minimum entropy threshold for Solana base58 key diagnostics. |
bastionSecurity.secretConfidence |
high |
high shows only validated secrets and 64-hex with a key-name signal; all also shows shape-only hex (tx/block hashes, bytes32) as Information. |
bastionSecurity.supplyChainScope |
direct |
direct checks only package.json / Cargo.toml; all also checks transitive lockfile entries (noisier). |
Reducing False Positives
A 64-character hex value is byte-identical whether it is a private key, a transaction/block hash, a keccak256 output, or a Solidity bytes32 — no length or entropy test can tell them apart. Bastion therefore only raises a high-confidence (red) finding on hex that carries a private-key signal (e.g. assigned to privateKey, pk, secret, mnemonic, or process.env.*). Transaction-hash assignments, hash-named variables, and call arguments like getTransactionReceipt("0x…") are not flagged, and the Hardhat/Anvil/Foundry default accounts are allowlisted.
To silence a specific finding, add an inline directive (edit-stable, unlike click-to-ignore):
const value = "0x…"; // bastion-ignore-line
const value = "0x…"; // bastion-ignore EVM_KEY
// bastion-ignore-next-line
const value = "0x…";
A bare directive suppresses any finding on that line; adding one or more kinds (e.g. EVM_KEY, SOLANA_KEY) limits it to those kinds.
Supply-chain matching is version-aware
The denylist distinguishes two kinds of entry:
package-name — malicious at all versions (fully-malicious packages / typosquats).
package-name@1.2.3 — a specific compromised release of an otherwise-legitimate package.
A version-pinned entry only flags that exact installed version, so one bad release no longer false-flags every user of a popular package. Resolved versions come from lockfiles, so version-pinned matching applies when supplyChainScope is set to all.
Known-CVE Audit (npm / Composer / Python)
The bundled denylist covers malicious packages (backdoors, typosquats). Known
CVEs in legitimate packages are a separate problem, so rather than ship a
stale vulnerability database, Bastion runs the ecosystem's own always-current
auditor and shows the results in the Problems panel:
- PHP —
composer audit
- Node —
npm audit
- Python —
pip-audit (if installed)
Run it with the Bastion Security: Audit Dependencies for Known CVEs command,
or set bastionSecurity.auditOnOpen to run it automatically when a workspace
opens. The auditors need their tool on PATH and network access to the advisory
sources; missing tools are skipped with a note in the "Bastion Audit (CVE)" log.
Updating the Denylist
Rebuild the bundled denylist from public sources (DataDog dataset + GitHub Advisory Database malware feed):
npm run update-denylist
No API key is required. Setting an optional GITHUB_TOKEN raises the GitHub API rate limit from 60/hr to 5000/hr and is recommended for a complete build:
$env:GITHUB_TOKEN="ghp_your_token"; npm run update-denylist
This writes malicious-packages-{npm,pypi,crates}.txt and the legacy malicious-packages.txt (read by the extension). After updating, run npm run compile and repackage.
Data Handling
- Checks run in the extension host.
- Review data is bundled with the extension.
- The extension does not perform automatic runtime data updates.
- Generated-code review uses the editor language model API only when available and enabled by the user.
Support
For issues or feature requests, open an issue on the project repository.
License
MIT