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

@siliconvalleyglobal/agent-leak-guard

v0.1.0

Published

Inline secret leak scanner, redactor, CLI, and git hook for AI coding agents

Downloads

0

Readme

Agent Leak Guard

Inline secret leak scanner, redactor, CLI, and git hook for AI coding agents.

Scans content an AI coding agent is about to write, commit, or output — files, diffs, terminal output, logs — for accidentally leaked API keys, tokens, or credentials, and blocks or redacts them before they land anywhere.

Installation

npm install agent-leak-guard

Quick Start

# Scan a file
npx agent-leak-guard scan path/to/file.js

# Scan from stdin
cat file.js | npx agent-leak-guard scan --stdin

# Install pre-commit hook
npx agent-leak-guard install-hook

Library Usage

import { scan } from 'agent-leak-guard';

const result = scan('AWS_KEY=AKIAIOSFODNN7EXAMPLE', {
  mode: 'block', // warn | block | redact
});

console.log(result.hasFindings); // true
console.log(result.isBlocked);   // true
console.log(result.findings[0].rawMatch); // AKIA****MPLE (never the full secret)

Response Modes

| Mode | Behavior | |------|----------| | warn | Flag the finding, redact in output, allow action to proceed | | block | Prevent write/commit/output, show redacted finding and reason | | redact | Replace detected secret with [REDACTED:<type>] and proceed |

Configuration

Create .leakguard.json in your project root:

{
  "defaultMode": "block",
  "entropyThreshold": 4.5,
  "entropyMinLength": 20,
  "allowlist": {
    "strings": ["AKIAIOSFODNN7EXAMPLE"],
    "regexes": ["^TEST_", "^EXAMPLE_"],
    "files": ["**/node_modules/**", "**/*.min.js"]
  },
  "rules": {
    "aws_access_key": { "enabled": true, "mode": "block" },
    "jwt_token": { "enabled": true, "mode": "warn" },
    "entropy": { "enabled": true, "mode": "warn" }
  }
}

Integration with agent-permit

Use agent-leak-guard as an inline check in your agent middleware:

import { scan } from 'agent-leak-guard';

async function onFileWrite(content: string) {
  const result = scan(content, { filePath: '/path/to/file' });
  if (result.isBlocked) {
    throw new Error(`Secret leak blocked: ${result.summary.blocked} finding(s)`);
  }
  return result.redactedContent;
}

Detectors

  • AWS Access Keys (AKIA/ASIA/ABIA/ACCA)
  • OpenAI API Keys (sk-...)
  • Anthropic API Keys (sk-ant-api...)
  • GitHub Personal Access Tokens (ghp_, gho_, ghu_, ghs_, ghr_, github_pat_)
  • Stripe API Keys (sk_test_, sk_live_, rk_test_, rk_live_)
  • Private Key Blocks (-----BEGIN ... PRIVATE KEY-----)
  • JSON Web Tokens (JWT)
  • Database Connection Strings with credentials
  • Slack Tokens (xoxb-, xoxa-, xoxp-, xoxr-)
  • Google Cloud API Keys (AIzaSy...)
  • High-Entropy Strings (fallback for unknown tokens)

Patterns reference open-source standards such as gitleaks and trufflehog.

Never Leak the Leak

All findings are redacted before exposure. The rawMatch field contains only a masked preview (e.g. AKIA****MPLE). Full secret values are never logged, returned, or persisted.

License

MIT