
Secure Env
- Updated January 12, 2026
- bjornallvin/cc-plugins
Secure-Env is a security plugin that protects sensitive .env files from accidental access by Claude Code while still permitting access to .env.example files. It reduces the risk of leaking secrets during agent sessions. Best for keeping credentials out of an agent's reach.
Key points
- Blocks .env access
- Allows .env.example
- Secret-leak prevention
Secure Env by the numbers
- Data as of Jul 7, 2026 (Skillselion catalog sync)
/plugin marketplace add bjornallvin/cc-plugins/plugin install secure-env@cc-pluginsAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Last updated | January 12, 2026 |
|---|---|
| Repository | bjornallvin/cc-plugins ↗ |
What it does
Protect sensitive .env files from accidental access by Claude Code while still allowing .env.example access.
README.md
Claude Code Plugins
A collection of plugins and utilities for Claude Code.
Plugins
claude-settings
A plugin for managing and merging Claude Code settings across user, project, and local configuration files.
Key Features:
- View all settings files and see which one is active
- Merge settings from overridden files into the active configuration
- Handle conflicts gracefully with clear reporting
- Create automatic backups before making changes
notifications
A plugin for managing audio and popup notifications when Claude is waiting for input or completes tasks.
Key Features:
- Audio notifications for different events
- System popup notifications on macOS and Linux
- Easy management with check, install, and remove commands
- Customizable audio files
secure-env
A security plugin that helps protect sensitive .env files from accidental access by Claude Code while still allowing access to .env.example files.
Features
- Permission Management: Apply secure deny rules for .env and .env.local files
- Permission Checking: Verify current Claude Code permissions for .env files
Installation
Copy the secure-env directory to your Claude Code plugins location:
/plugin marketplace add bjornallvin/cc-plugins
/plugin install secure-env@cc-plugins
Commands
/secure-env.check
Check the current Claude Code permissions for .env files without attempting to read them.
This command analyzes:
- User settings (
~/.claude/settings.json) - Project settings (
./.claude/settings.json) - Local project settings (
./.claude/settings.local.json)
It shows which settings are active and provides warnings if project settings override user-level protections.
/secure-env.apply
Apply secure .env permission deny rules to the current project's Claude settings.
This command:
- Adds deny rules for
.envand.env.localfiles - Adds allow rules for
.env.examplefiles - Applies to both
.claude/settings.jsonand.claude/settings.local.json - Preserves all existing project settings (only merges the .env rules)
- Creates backups before modifying
- Creates the settings files if they don't exist
Rules applied:
DENY:
- Read(**/.env)
- Write(**/.env)
- Read(**/.env.local)
- Write(**/.env.local)
ALLOW:
- Read(**/.env.example)
- Write(**/.env.example)
Scripts
scripts/check-env-permissions.sh- Check .env permissions across all Claude settings filesscripts/apply-env-security.sh- Apply secure .env deny rules to project-level settings
How It Works
Claude Code has a settings precedence system:
.claude/settings.local.json(highest precedence).claude/settings.json(overrides user settings)~/.claude/settings.json(user-level settings)
This plugin ensures that .env protections are applied at the project level to prevent accidental exposure of sensitive credentials to Claude Code.
Using .env Values Securely
Even with deny rules in place, you can still use environment variables from your .env file by sourcing it when running commands. This loads the variables into the shell environment without Claude reading the file directly.
Safe approach: Source .env for application commands
source .env && npm start
source .env && npm run migrate
source .env && docker-compose up
source .env && python manage.py runserver
How it works:
source .envloads environment variables into the current shell session- The variables become available to your application or scripts
- Claude never reads the .env file contents
- The .env file remains protected by deny rules
- Important: Avoid echoing or printing env var values, as that would expose them in the context
What NOT to do:
- ❌ Don't run commands like
echo $SECRET_KEYorprintenv- this exposes secrets in the output - ❌ Don't ask Claude to help debug env var values - use
.env.examplewith dummy values instead - ✅ Do use
source .env && <command>to run your applications that need the variables
Best Practices
- Run
/secure-env.checkto see current permissions - Run
/secure-env.applyin each project to add protections - Use
.env.examplefiles for documentation (Claude can read these) - Keep actual credentials in
.envor.env.local(Claude cannot read these after applying rules) - Use
source .env && <command>to run applications that need environment variables - Never echo or print env var values in commands - this exposes them to Claude's context
Contributing
Contributions are welcome! Please feel free to submit pull requests or open issues.
License
MIT