concepts

How It Works

Architecture and scanning pipeline

Overview

brin is a security-first package gateway for AI agents. It answers one simple question: is this package sus?

Traditional package managers were built for human developers who can review code, recognize suspicious patterns, and make judgment calls. AI agents don't have these instincts. They trust what they're told and execute what they're given. This makes them uniquely vulnerable to a new class of attacks designed specifically to exploit autonomous code execution.

brin solves this by scanning every package before installation, detecting both traditional security threats and agentic-specific attacks, and providing a centralized docs index so agents know how to use packages correctly.

How brin Works

brin uses a distributed architecture where packages are pre-scanned in the cloud, so lookups are instant:

100%

The Scanning Pipeline

When brin scans a package, it runs a comprehensive analysis pipeline:

100%
  1. Metadata Fetch: Pull package info from the registry (maintainers, downloads, repository)
  2. Tarball Download: Fetch and extract the package contents
  3. Parallel Analysis: Run all scanners concurrently for speed
  4. Risk Calculation: Combine all signals into a final risk assessment
  5. Store & Serve: Cache results for instant lookups

Capability Extraction

brin performs static analysis to detect what a package can do:

CapabilityWhat It Detects
NetworkHTTP/HTTPS requests, WebSocket connections, TCP/UDP sockets, domains accessed, protocols used
FilesystemFile read/write operations, paths accessed with permissions (read, write, or both)
ProcessChild process spawning via exec/spawn/fork, specific commands extracted (npm, git, curl, etc.)
EnvironmentEnvironment variables accessed via process.env
NativeNative modules, binding.gyp presence, N-API bindings (node-addon-api, napi-rs, nan)

This information helps agents understand what permissions a package needs and whether its capabilities match its stated purpose.

Bash
$ brin check axios
๐Ÿ” checking axios@1.6.0...
โœ… not sus
 
capabilities:
   โ”œโ”€ network: http, https (api calls)
   โ”œโ”€ filesystem: none
   โ”œโ”€ process: none
   โ””โ”€ environment: HTTP_PROXY, HTTPS_PROXY

Trust Score

Every package gets a trust score from 0-100 based on multiple signals:

SignalImpact
5+ maintainers+20 points
Linked repository+10 points
Has description+5 points
High download count+15 points
Package age (1+ year)+10 points
Verified publisher+20 points
Base score50 points

A higher trust score doesn't mean a package is safe. It means the package has more signals of legitimacy. Even high-trust packages can have CVEs or be compromised.

Scan Priority

brin continuously monitors package registries and prioritizes scans:

PriorityTrigger
ImmediateKnown malicious patterns detected
HighUser-requested scan via CLI or API
MediumNew package discovered by watcher
LowBackground re-scan of existing packages

This ensures that when you run brin add, the package has likely already been scanned and results are instant.

Summary

brin protects AI agents by:

  1. Scanning before installing - Unlike npm audit, brin blocks threats before they touch your system
  2. Detecting agentic threats - Prompt injection, repo poisoning, and other attacks targeting AI
  3. Extracting capabilities - Understanding what packages can actually do
  4. Maintaining a docs index - Centralized documentation in AGENTS.md for instant agent access
  5. Calculating trust scores - Multiple signals combined into actionable risk levels

The result: AI agents can safely install packages without falling victim to attacks designed to exploit their autonomous nature.

Learn the commands and docs index for more details.