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

agent-perm-audit

v0.1.0

Published

Least-privilege auditor for AI agent tool/function permissions. Detects dangerous capability combinations (e.g. secret-read + network-egress) in LangChain, OpenAI function-calling, and MCP tool definitions.

Readme

agent-perm-audit

npm License: MIT Node.js >= 18

Least-privilege auditor for AI agent tool permissions.

LLM agents (LangChain, OpenAI function-calling, MCP servers) are wired into real infrastructure now — databases, shells, payment APIs, secret stores. Nobody checks whether an agent's tool list is over-privileged the way we've checked IAM roles for a decade.

agent-perm-audit scans your agent's tool/function definitions and flags dangerous capability combinations — a single tool that can both read secrets and reach the network, or both write files and execute code — the exact shape of a real exfiltration or RCE path.

npx agent-perm-audit tools.json
agent-perm-audit — 2 tool(s) analyzed

[CRITICAL] AGT001 — Secret read + network egress (exfiltration path)
  tool: sync_credentials_to_webhook
  capabilities: read_secrets, network_egress
  This tool can both read sensitive values (secrets/tokens/credentials) and
  make outbound network calls. An agent with this single tool, if
  prompt-injected or misled, has everything needed to exfiltrate
  credentials to an attacker-controlled endpoint.

[CRITICAL] AGT002 — File system write + code execution (RCE surface)
  tool: run_and_save_script
  capabilities: file_system_write, code_execution
  ...

Summary: 2 critical, 0 high, 0 medium, 0 low

Why this exists

IAM security matured around one idea: least privilege. A role that can both read S3 and assume any role is a bigger risk than either permission alone. Nobody applies that lens to AI agents yet, even though a single overprivileged tool can let a prompt-injected agent exfiltrate secrets, run arbitrary code, or make irreversible changes — with no attacker needing to touch your infra directly.

This tool applies that same combination-based analysis to agent tool definitions, in ~5 seconds, with zero configuration.

Install

npm install --save-dev agent-perm-audit

Usage

CLI

agent-perm-audit tools.json                          # auto-detects format
agent-perm-audit tools.json --format=openai           # explicit format
agent-perm-audit tools.json --json                    # machine-readable output
agent-perm-audit tools.json --fail-on=critical         # exit 1 for CI pipelines

Supported formats: openai (function-calling tools/functions arrays), langchain (serialized tool exports), mcp (MCP tools/list responses).

As a library

import { auditAuto } from "agent-perm-audit";

const report = auditAuto(myToolDefinitions, "openai");

console.log(report.summary);
// { critical: 1, high: 0, medium: 1, low: 0 }

CI pipeline (GitHub Actions)

- name: Audit agent tool permissions
  run: npx agent-perm-audit ./config/agent-tools.json --fail-on=high

Fails the build before an overprivileged tool combination ever reaches production.

How it works

  1. Classify — each tool's name, description, and parameter schema are scanned against capability heuristics (network_egress, read_secrets, code_execution, file_system_write, database_write, delete_action, financial_action, external_communication, and more).
  2. Correlate — a rules engine checks each tool for known-dangerous combinations of capabilities on the same tool, not just individual capabilities in isolation.
  3. Report — findings are ranked critical → low, with a plain-English explanation of the actual risk, so a non-security engineer on the team understands why it's flagged.

Current rule set

| ID | Combination | Severity | |---|---|---| | AGT001 | Secret read + network egress | Critical | | AGT002 | File write + code execution | Critical | | AGT006 | Code execution + network egress | Critical | | AGT003 | Database write + delete | High | | AGT004 | Financial action + external comms | High | | AGT005 | Secret read + external comms | High | | AGT007 | Unscoped delete action | Medium |

Limitations

This is heuristic, keyword-based analysis of tool metadata — not runtime enforcement or static analysis of your tool's implementation code. A tool named helper with a vague description can hide risky behavior this won't catch. Treat findings as a starting point for review, not a guarantee of safety. PRs improving the capability heuristics or adding new rules are very welcome.

Roadmap

  • [ ] Confidence scoring per finding (based on how many signals matched)
  • [ ] Support for Anthropic tool-use / Claude Agent SDK schema
  • [ ] Custom rule definitions via config file
  • [ ] SARIF output for GitHub code scanning integration

License

MIT