npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@gitdamnit/opencode-stranger-danger

v0.1.0

Published

OpenCode safety plugin for detecting suspicious, risky, or secret-leaking context before it causes damage.

Readme

strangerDanger

strangerDanger logo

Secret and PII redaction guard for AI coding agents.

npm version license node

The Problem

Every secret scanner checks your files. None check what goes into the LLM's context window. A secret can be clean in your repo and still get sent to a cloud API inside a prompt, checkpoint, or shell summary. strangerDanger operates at three layers to catch what others miss.

How It Works — Three Layers of Protection

  • Layer 1: File-level (before reads) — Intercepts file reads, redacts secrets in-place before the agent sees them.
  • Layer 2: Context-level (before compaction) — Scans everything injected into the LLM context during session compaction. Also scans outbound user messages.
  • Layer 3: Output-level (after tool execution) — Scans tool outputs before they're written to disk.

Installation

OpenCode Plugin

Add to your opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["@gitdamnit/stranger-danger"]
}

Standalone CLI

npm install -g @gitdamnit/stranger-danger

Use with envsitter-guard

strangerDanger and envsitter-guard are complementary:

  • envsitter-guard blocks .env* file reads entirely
  • strangerDanger scans everything else and protects the context window

Use both for complete coverage.

Quick Start

Plugin

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["@gitdamnit/stranger-danger"]
}

CLI

sd scan .                    # Scan current directory
sd scan src/config.ts        # Scan a single file
sd scan - < file.txt         # Scan stdin
sd redact src/config.ts      # Redact secrets in-place (creates .backup)
sd audit                     # Show audit log
sd rules                     # List all active rules

Detection Rules

  • ~160 rules vendored from gitleaks (MIT)
  • ~12 clean-room additions for AI/ML providers (Groq, DeepSeek, Replicate, ElevenLabs, etc.)
  • 3 entropy-based detectors (Base64, Hex, Alphanumeric)

Key Providers Covered

| Category | Providers | |----------|-----------| | Cloud | AWS, GCP, Azure, Alibaba, DigitalOcean, Heroku, Cloudflare | | AI/ML | OpenAI, Anthropic, Groq, DeepSeek, Cohere, HuggingFace, Replicate, ElevenLabs | | Version Control | GitHub, GitLab, Bitbucket | | Communication | Slack, Discord, Telegram, Twilio, SendGrid, Mailgun | | Payment | Stripe, Square, PayPal, Coinbase, Plaid | | Databases | MongoDB, PostgreSQL, Redis (connection strings) | | Generic | Private keys, JWTs, high-entropy strings |

OpenCode Plugin Tools

  • sd_status — Show rule count, findings, audit log path
  • sd_audit — Show audit log with timestamps and rule IDs
  • sd_allowlist_add — Add allowlist entry
  • sd_allowlist_show — Show current allowlist
  • sd_scan — Manually scan content

Allowlist

Create .strangerdanger-allowlist.toml in your project root:

[[entries]]
description = "Known test key"
fingerprint = "a3f7b2c1"

[[entries]]
description = "Ignore generic-api-key in test files"
ruleId = "generic-api-key"
path = "test/"

Entry types: fingerprint, ruleId, path, regex.

Audit Log

Location: .opencode/state/strangerdanger-audit.jsonl

Format: one JSON line per finding. Logs fingerprint, rule ID, timestamp, and source. Never logs the actual secret value.

Architecture

src/engine/     → Core detection engine (zero OpenCode deps)
src/plugin/     → OpenCode plugin hooks
src/cli/        → Standalone CLI (sd binary)

Zero runtime dependencies beyond @opencode-ai/plugin. Node.js built-ins only.

Development

npm install          # Install dependencies
npm run build:rules  # Compile gitleaks TOML → TypeScript
npm run build        # Build all TypeScript
npm run typecheck    # Type check
npm test             # Run tests

Adding New Rules

Edit scripts/compile-rules.ts to add clean-room rules. The gitleaks TOML is compiled automatically at build time.

Attribution

  • gitleaks/gitleaks (MIT) — Secret detection rules vendored from config/gitleaks.toml. https://github.com/gitleaks/gitleaks
  • Yelp/detect-secrets (Apache-2.0) — Shannon entropy detection approach referenced for high-entropy string detectors. Clean-room TypeScript implementation. https://github.com/Yelp/detect-secrets
  • boxpositron/envsitter-guard (MIT) — Complementary plugin. strangerDanger coordinates with envsitter-guard to avoid duplicating .env* file blocking. https://github.com/boxpositron/envsitter-guard

License

MIT. See LICENSE.