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

secret-tripwire

v0.1.1

Published

PostToolUse hook that scans Claude Code tool outputs for leaked secrets

Downloads

172

Readme

secret-tripwire

PostToolUse hook for Claude Code that scans tool outputs for leaked secrets before they enter the model's context window. Once a secret hits the context, it's effectively leaked to the model. This intercepts it first.

Install

npm install -g secret-tripwire

Setup

Add to ~/.claude/settings.json:

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": ".*",
        "hooks": [
          {
            "type": "command",
            "command": "secret-tripwire",
            "timeout": 5
          }
        ]
      }
    ]
  }
}

What It Detects

| Secret Type | Pattern | Example | |-------------|---------|---------| | AWS Access Key | AKIA* / ASIA* | AKIAIOSFODNN7EXAMPLE | | GitHub Token | ghp_, gho_, ghs_, ghr_, gha_, github_pat_ | ghp_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefgh | | Private Key | -----BEGIN * PRIVATE KEY----- | RSA, EC, PKCS#8, PGP, OPENSSH, DSA | | JWT Token | eyJ...eyJ... (base64url, incl. alg:none) | eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOi... | | Connection String | postgresql://, postgres://, mongodb+srv://, etc. | postgres://user:pass@host/db | | API Key | api_key: "...", secret_key=... | api_key: "sk_live_abcdef1234567890" | | Bearer Token | Bearer <40+ chars> | Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6... |

How It Works

  1. Claude Code calls a tool (Read, Bash, WebFetch, etc.)
  2. The tool returns output
  3. Before the output enters Claude's context, this hook scans it
  4. If secrets are detected, a warning is injected via additionalContext
  5. Claude sees the warning and knows not to repeat the raw output

This is a PostToolUse hook — it's advisory (exit 0 always). It cannot block tool execution, only warn after the fact. The warning tells Claude that secrets were detected and the raw output should not be referenced.

Library Usage

import { scan, redact } from 'secret-tripwire'

// Scan text for secrets
const result = scan('My AWS key is AKIAIOSFODNN7EXAMPLE')
console.log(result.clean)       // false
console.log(result.detections)  // [{ type: 'AWS_KEY', match: 'AKIAIOSF...', index: 14 }]

// Redact secrets from text
const { redacted, count } = redact('Key: AKIAIOSFODNN7EXAMPLE')
console.log(redacted) // 'Key: [REDACTED-AWS_KEY]'
console.log(count)    // 1

Design

  • Zero false positives over zero false negatives — patterns are conservative (high-confidence only)
  • Truncated matches — detected secrets are truncated to 8 chars in logs so the warning itself doesn't leak
  • Always exits 0 — PostToolUse hooks are advisory, never blocking
  • Zero runtime dependencies beyond @valencets/resultkit

Requirements

  • Node.js >= 22
  • ESM only

License

MIT