Skip to main content

Supply-chain security, capability intelligence, and trust system for AI agents

Project description

Bastion AI

Supply-chain security, capability intelligence, and trust system for AI agents.

Bastion AI protects bot-first ecosystems by detecting malicious or risky skills/plugins/tools, tracking capability drift over time, and producing machine-readable security artifacts (Dynamic AIBOM).

Installation

pip install bastion-ai-security

For JavaScript/TypeScript analysis support:

pip install bastion-ai-security[js]

PyPI: https://pypi.org/project/bastion-ai-security/

Two Ways to Use Bastion

Bastion works for both humans operating from the command line and AI agents acting autonomously.

Path 1: Human-Operated CLI

You install Bastion, run scans yourself, and review results in the terminal or cloud dashboard. This is the traditional security workflow — a developer or security engineer vetting plugins before deployment.

pip install bastion-ai-security
bastion init
bastion scan

You see the results, make decisions, and optionally connect to the cloud dashboard for monitoring and trust scores.

Path 2: AI Agent Integration (MCP Server)

Bastion runs as an MCP (Model Context Protocol) server, letting AI agents like Claude, Cursor, or any MCP-compatible client use it as a built-in security tool. The agent can scan directories, analyze files, and check trust scores autonomously — acting as its own security gate before installing or using third-party plugins.

pip install bastion-ai-security[mcp]
bastion mcp-serve

The AI agent calls Bastion's tools directly through the MCP protocol. No human in the loop required — the agent makes security decisions based on scan results.

Both paths produce the same security artifacts, trust scores, and detection coverage across all 10 capability categories.

Quick Start

Initialize a project

cd your-agent-project
bastion init

This creates a .bastion/ directory with project configuration and prepares for scanning.

Scan for risks

bastion scan

Bastion auto-discovers plugins, skills, and tools in your project and analyzes them across 10 security categories:

  • System execution — detects capabilities that allow running arbitrary commands
  • Network access — identifies outbound network communication
  • Secret/environment access — flags reading of credentials and environment variables
  • File system access — detects reading/writing to the local filesystem
  • Dynamic code execution — identifies runtime code generation and execution
  • Obfuscation patterns — catches attempts to hide malicious intent through encoding
  • Sandbox bypass — flags attempts to disable or circumvent safety controls
  • Install script risks — detects potentially dangerous installation behaviors
  • Hardcoded secrets — finds credentials embedded directly in source code
  • Privilege escalation — identifies plugins requesting excessive combined permissions

For each plugin, the scan also captures:

  • Dependencies — third-party libraries imported by the plugin
  • Skills — exported functions and classes
  • Metadata — description (from docstrings), file count, and lines of code

Scan a specific directory:

bastion scan --path ./my-plugins

OpenClaw SKILL.md Analysis

Bastion has first-class support for OpenClaw skills. When scanning with --openclaw, it analyzes SKILL.md files for dangerous agent instructions, unsafe configuration flags, suspicious install metadata, and skills that instruct agents to download and execute remote code.

bastion scan --openclaw

This directly addresses research findings on skill-based supply chain attacks, where innocent-looking documentation can bundle malicious instructions.

MCP Server (AI Agent Integration)

Bastion can run as an MCP (Model Context Protocol) server, letting AI agents and LLMs use it as a security tool directly.

Install with MCP support:

pip install bastion-ai-security[mcp]

Start the MCP server:

bastion mcp-serve

Or run it directly:

bastion-mcp

The MCP server exposes these tools:

Tool Description
scan_directory Scan a directory for plugin/skill security risks
analyze_file Analyze a single file for dangerous capabilities
get_project_status Get current Bastion project configuration
list_detection_categories List all detection categories with descriptions
check_trust_score Check trust score from Bastion Cloud

To configure in Claude Desktop or other MCP clients, add to your config:

{
  "mcpServers": {
    "bastion-security": {
      "command": "bastion-mcp"
    }
  }
}

This allows an AI agent running on your machine to automatically verify plugins before installing them — acting as a security gate in the agent's workflow.

Check project status

bastion status

Shows your project ID, version, baseline status, cloud connection, and verification URL.

Connect to Bastion Cloud

bastion connect

Links your project to Bastion Cloud for continuous monitoring, trust scores, and a security dashboard.

After connecting, the CLI prints a claim URL — click it to link the project to your account on the dashboard. If you're not signed in yet, you'll be prompted to sign in first, and the project will be linked automatically.

Once connected, every bastion scan automatically uploads results to the cloud. No extra flags needed.

Dashboard: https://bastion-ai-hub.replit.app

Share verification with partners

After a scan uploads to the cloud, the CLI prints a verification URL like:

https://bastion-ai-hub.replit.app/verify/abc123...

Share this link with business partners, customers, or integrators. The public verification page shows:

  • Trust score and verification status
  • Detected capabilities
  • Number of scans and plugins analyzed
  • Last scan date

No login is required to view a verification page.

How It Works

Plugin Discovery

Bastion automatically discovers plugins using framework-aware heuristics. It recognizes common agent frameworks (OpenClaw, LangChain, AutoGPT, CrewAI, and others) and finds plugins without manual configuration.

Capability Analysis

Each discovered plugin is analyzed using language-appropriate static analysis:

  • Python: AST-based analysis
  • JavaScript/TypeScript: Parser-based analysis with fallback strategies
  • SKILL.md: Structured document analysis for agent instruction risks

Detection Categories

Bastion scans across 10 capability categories at varying severity levels:

Category Severity
System Execution Critical
Dynamic Code Critical
Obfuscation Critical
Sandbox Bypass Critical
Hardcoded Secret Critical
Privilege Escalation Critical/High
Network Access High
Secret/Env Access High
Install Script Risk High/Medium
File System Access Medium

Privilege Escalation Detection

Bastion automatically flags plugins that combine multiple dangerous capabilities, identifying over-privileged plugins that pose elevated risk.

Drift Detection

On subsequent scans, Bastion compares against the baseline to detect:

  • New plugins added since last scan
  • Modified plugins with changed capabilities
  • Removed plugins no longer present

Generated Artifacts

All artifacts are written to .bastion/:

File Description
security_state.json Overall security posture
capability_surface.json All plugin capabilities
drift_summary.json Changes since last scan
aibom.json Dynamic AI Bill of Materials
events.log.jsonl Rolling event log
baseline.json Baseline for drift comparison

CI/CD Usage

bastion init
bastion scan --ci

Uses exit codes to signal whether security risks were found, suitable for automated gates.

Language Support

  • Python (.py)
  • JavaScript (.js, .jsx)
  • TypeScript (.ts, .tsx)
  • SKILL.md (OpenClaw skill format)

Troubleshooting

"bastion: command not found"

Make sure the pip install directory is in your PATH:

python3 -m bastion --version

Or:

pip install --user bastion-ai-security
export PATH="$HOME/.local/bin:$PATH"
bastion --version

Scan finds no plugins

If Bastion doesn't find your plugins automatically, point it at the right directory:

bastion scan --path /path/to/your/plugins

Cloud connection issues

Scans work fully offline — results are saved locally in .bastion/ even if the cloud is unreachable.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bastion_ai_security-0.1.6.tar.gz (32.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bastion_ai_security-0.1.6-py3-none-any.whl (35.0 kB view details)

Uploaded Python 3

File details

Details for the file bastion_ai_security-0.1.6.tar.gz.

File metadata

  • Download URL: bastion_ai_security-0.1.6.tar.gz
  • Upload date:
  • Size: 32.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for bastion_ai_security-0.1.6.tar.gz
Algorithm Hash digest
SHA256 722a8be2a1b5f0a3cad19103c15153f200d13fee6841df28ff72c4a607db7ecd
MD5 1b7446f3d5eb37f737fd0c59fcebbcf0
BLAKE2b-256 11739385d999d1cc0f018607a368a992b34bcbf1f5adc47c7ae607a356b1b74d

See more details on using hashes here.

File details

Details for the file bastion_ai_security-0.1.6-py3-none-any.whl.

File metadata

File hashes

Hashes for bastion_ai_security-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 fb5c8c78ccc8f838c81b6ad2eed84d7e5e71710bbb6bc28c5fe4679d58ced52f
MD5 5bb49f3a55ecda150d2d5912da1b49c1
BLAKE2b-256 10fb48678a7bae63d6e72a3617dc81b74f203cf4019a56c03103f9d416e42f90

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page