Ensor Secret Detection & Redaction

ensor is a CLI tool built in golang that finds hardcoded secrets, redacts them with placeholders, and converts env files between dotenv, JSON, YAML, and TOML.

Hardcoded secrets in codebases (API keys, database URLs, tokens) are a top cause of breaches. Most tools scan and stop there — you still manually rotate secrets and update .env Files.

ensor detects, and redacts in one interactive flow. It extracts discovered secrets into a .env File and replaces them with configurable placeholders across your project.

# Install
mise use github:github.com/pratyay360/ensor@latest
# or: brew install pratyay360/tap/ensor

ensor

Why ensor?

Problemensor Approach
Scanners only detectDetects and remediates in one pass
Manual .env managementAuto-generates .env with descriptive keys
Format fragmentationConverts .env ↔ JSON ↔ YAML ↔ TOML
CI/CD integrationNon-interactive mode for pipelines
False positive fatigueInteractive review before redaction

Key Features

Installation

MethodCommand
misemise use github:github.com/pratyay360/ensor@latest
Homebrewbrew tap pratyay360/tap && brew install pratyay360/tap/ensor
Go installgo install github.com/pratyay360/ensor@latest
Shell scriptcurl -sSL https://raw.githubusercontent.com/Pratyay360/ensor/main/install.sh | sh
goblincurl -sf http://goblin.run/github.com/pratyay360/ensor | PREFIX=~/.local/bin sh
Scoop (Windows)scoop bucket add pratyay360 https://github.com/pratyay360/scoop-bucket && scoop install pratyay360/ensor
Stewstew install pratyay360/ensor
PrebuiltGitHub Releases — .deb, .rpm, .apk, Linux/macOS/Windows/FreeBSD binaries

Usage

Scan & redact (interactive)

ensor

Convert environment formats

# .env → JSON
ensor convert .env env.json

# JSON → YAML
ensor convert env.json env.yaml

# YAML → TOML
ensor convert env.yaml env.toml

How It Works

  1. Scan — Walks project files (respects .gitignore, configurable skip paths)
  2. Detect — Runs git leaks/better leaks engine + custom patterns
  3. Map or prompt —
    • Match found in .env? → Use existing key
    • New secret? → Suggest name (e.g., STRIPE_SECRET_KEY) or prompt
  4. Redact — Replace hardcoded value with {KEY} placeholder
  5. Store — Write secrets to .env (or specified format)

Demo

DemoLink
Video walkthroughYouTube
Secret scan & redactasciinema
Env file conversionasciinema

Best Practices

Comparison: ensor vs. git leaks vs. trufflehog

Featureensorgitleakstrufflehog
Detection✅ (gitleaks engine)✅✅
Interactive redaction✅❌❌
Auto .env generation✅❌❌
Format conversion✅❌❌
TUI/Interactive✅ (Bubble Tea)❌❌
CI/CD JSON output✅✅✅
Custom patterns✅✅✅

Built With

asciicast

asciicast

asciicast

ensor

Comments