AgentSentry CLI
Open-source NHI scanner, runs locally, zero data upload, one command to audit your entire cloud.
What's New
- Data-driven least-privilege,
scan aws --analyze-usagepulls IAM Access Advisor data and names the exact granted-but-unused services that are safe to revoke (finding NHI-006) - Continuous monitoring,
scan --saverecords to a local history store;agentsentry diff awsshows what changed since the last scan (new identities, newly-zombie, rotation-due) - Deeper AWS coverage, Secrets Manager, RDS, and DynamoDB now scanned as crown-jewel resources, so the attack graph reaches your most sensitive targets
- Real policy documents, managed policies are now fetched and analyzed by their actual permissions, not just their names (a custom policy with
"Action": "*"no longer hides as INFO)
- Fix
~/.aws/configbeing over-scored, it stores profile names, not keys, so it now correctly scores as INFO - Fix GCP
credentials.dbshowing wrong "Hardcoded secrets" description - Exclude
tests/directories from source scanner to eliminate intentional test-fixture false positives - Tighten secret regex: now requires 16+ characters with at least one uppercase letter or digit to cut noise from short placeholder values
- Fix
agentsentry scan local --procrash on LOW-risk identities (Rich markup typo) - Block Xbox Live / WindowsLive / MicrosoftAccount consumer tokens from Windows Credential Manager scan (was 22 false positives)
- Cloud credential files now get realistic privilege scores: AWS credentials → HIGH, kubeconfig → CRITICAL
- Escape all credential names in Rich output to prevent markup injection
- Windows Credential Manager scan (
cmdkey /list), no admin required - macOS Keychain scan (
security dump-keychain), metadata only, never reads secret values - Cross-platform Docker detection via subprocess (fixes Windows named-pipe blind spot)
- Expanded credential file coverage: Azure CLI, GitHub CLI, Terraform Cloud, Windows gcloud path
Installation
AgentSentry requires Python 3.10+. The PyPI package is nhi-audit; the CLI command is agentsentry.
# Base install (local scan, no cloud credentials needed)$ pip install nhi-audit# With all provider extras$ pip install 'nhi-audit[aws,azure,gcp,github,k8s]'# Verify$ agentsentry --version
Quick start
The fastest way to see AgentSentry in action, scan your local environment. No credentials needed.
# Scan local environment (no credentials needed)$ agentsentry scan local# Full analyst report with attack narratives per identity$ agentsentry scan local --pro# Scan everything configured on this machine$ agentsentry scan all# Open the interactive attack graph in your browser$ agentsentry visualize
Provider setup & scan commands
Scans environment variables, .env files, SSH keys, cloud credential files, source code, and OS credential stores. On Windows it reads Windows Credential Manager (cmdkey /list), consumer tokens (Xbox Live, MicrosoftAccount) are automatically filtered. On macOS it reads Keychain metadata (security dump-keychain), secret values are never read.
# Quick scan$ agentsentry scan local# Full analyst report (--pro): attack narratives + MITRE mappings + remediation steps$ agentsentry scan local --pro
# Install AWS extra$ pip install 'nhi-audit[aws]'# Configure credentials$ export AWS_PROFILE=my-profile# Scan$ agentsentry scan aws
$ pip install 'nhi-audit[azure]'$ az login$ agentsentry scan azure
$ pip install 'nhi-audit[gcp]'$ gcloud auth application-default login$ agentsentry scan gcp
$ pip install nhi-audit$ export GITHUB_TOKEN=<your-pat>$ agentsentry scan github
$ pip install 'nhi-audit[k8s]'$ kubectl config use-context <your-cluster>$ agentsentry scan k8s
Output formats
Export findings in multiple formats for integration with your existing security toolchain.
# Default: rich terminal table$ agentsentry scan all# --pro: full analyst report per identity (attack narrative + MITRE + remediation)$ agentsentry scan local --pro# JSON (for SIEM / automation)$ agentsentry scan all --output json > findings.json# CSV (for spreadsheets)$ agentsentry scan all --output csv > findings.csv# Open attack graph in browser$ agentsentry visualize# Save graph as HTML file$ agentsentry visualize --save report.html
Pass --pro to get a full analyst-grade breakdown for each identity: a plain-English "WHAT IS THIS?" explanation, step-by-step attacker exploit narrative with real commands, MITRE ATT&CK technique mappings, and numbered remediation steps. Works with agentsentry scan local today.
Advanced usage
Filter by risk threshold, target a specific AWS profile, or run in CI/CD pipelines.
# Show only CRITICAL and HIGH findings$ agentsentry scan all --min-risk HIGH# Use a specific AWS profile$ export AWS_PROFILE=prod$ agentsentry scan aws# Non-zero exit code on CRITICAL findings (great for CI)$ agentsentry scan all --fail-on CRITICAL# Scan a specific LangChain / CrewAI project directory$ agentsentry scan agents ./my-agent-project
GitHub Actions example:
- name: AgentSentry NHI Scanrun: |pip install nhi-audit[aws]agentsentry scan aws --output json --fail-on CRITICALenv:AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Testing v0.2.0
New features in 0.2.0: explicit consent gates, continuous scan history, data-driven least-privilege via AWS Access Advisor, and deeper resource coverage (Secrets Manager, RDS, DynamoDB). Here's what to test.
Verify the version and test the new consent gate:
# Verify version$ agentsentry --version# Activate (use your activation code)$ agentsentry activate YOUR-CODE# → Expect: consent panel asking 'Do you accept Terms & Privacy?', type 'y'
This is the new consent gate. Answering n should cancel with exit 1.
Test the new scan history + diff feature (uses mock data):
# Save a mock scan to history$ agentsentry scan mock --save# List past scans$ agentsentry history# Compare current scan to baseline (should show 'no changes')$ agentsentry diff mock
--save writes to a local SQLite store; diff scans again and shows what changed.
Before running this, ensure your AWS read-only role has these 4 new permissions:
iam:GenerateServiceLastAccessedDetailsiam:GetServiceLastAccessedDetailsrds:DescribeDBInstancesdynamodb:ListTables
Then run the new --analyze-usage flag:
# Data-driven least-privilege: find unused permissions$ agentsentry scan aws --analyze-usage# → Expect: NHI-006 'Excessive Unused Permissions' findings# Each shows exact services granted but never used.
This queries AWS Access Advisor per identity, runs slower but gives precise, defensible revocation recommendations.
Your AgentSentry API Key
Your AgentSentry API key authenticates the CLI with our backend, it tells us who you are, what tier you're on, and tracks credit usage when you run scans.
- Authenticating the
agentsentry activatecommand - Gating Pro features and deducting scan credits
- Identifying your account when you contact support
- Connecting to AWS, Azure, or GCP, your cloud credentials stay on your machine and never touch our servers
- Linking to any third-party platform or deployment tool
For security, your full API key is never displayed in the dashboard, only a short preview is shown. If you need the full key, email support@agentsentry.org from your registered address and we'll send it securely.