Skip to main content

securityagent-core

The DLP engine behind AgnosticSecurity -- the firewall for AI coding agents.

v4.60.0 | 1,235 tests | 242 detection patterns | 19 layers | 64/64 attack categories | 65/65 compliance | 40 languages

Quick Start

pip install securityagent-core
as-init

as-init auto-detects your AI tools and configures protections. Supports: Claude Code | Copilot | Cursor | Windsurf | Aider | Continue | Tabnine | Codeium

What's Inside

Package What It Does
endpoint_agent/ DLP engine -- file blocking (60+ path patterns), confidence-scored content scanning (PII, credentials, semantic disclosure) with structural validators (Luhn, SSA, entropy), data flow taint tracking (hash/n-gram/substring), tool call argument scanning (MCP/function DLP), behavioral monitoring, honeypot traps. Notebook-aware .ipynb + PDF extraction (PyMuPDF/Tesseract/pypdf). Image OCR via Tesseract + QR/barcode decode.
skills/ MCP server (9 tools) -- secure_read, secure_write, secure_exec, analyze_prompt, scan_output, check_policy, get_session_policy, audit_log, scan_code. Works with any MCP-compatible client.
policy/ Policy engine -- per-session least privilege, behavioral chain detection (11 attack patterns), audit trail with agent attribution. Obsidian vault integration for cross-session policy context.
plugin.py CLI entry point -- validate_exec(), validate_prompt(), validate_output() pure functions.

Key Features

Exec Guard (60+ rules)

Blocks dangerous commands before execution. High-confidence rules (env var dumps, encoded exfil) block immediately. Low-confidence rules go through a 4-tier decision: domain allowlist, localhost check, payload scan, LLM verification.

Prompt Scanner (10 decode layers)

Catches PII and credentials even when obfuscated: direct regex, base64, hex escapes, ROT13, unicode escapes, URL percent-encoding, zero-width character stripping, reversed text, word-to-number with leetspeak, partial credential completion. Plus digit fragment reassembly and low-sensitivity PII escalation.

Terminal Guard

Traces process ancestry -- if a parent process is an AI agent and a child process touches sensitive files, the operation is blocked. Priority-based cadence scanning.

Code Fingerprint Guard

Registers proprietary code via n-gram fingerprinting. Detects similar code in prompts even with renamed variables (Jaccard similarity). Locality-aware thresholds.

Data Flow Taint Tracking

Tags sensitive data at ingress (file read, prompt, tool result). Detects at egress via SHA-256 hash, n-gram Jaccard similarity, and substring matching. Cross-session persistence (24h TTL).

Install

# From PyPI
pip install securityagent-core

# From source
pip install git+https://github.com/secure-mind-live/securityagent-core.git

# With optional dependencies
pip install "securityagent-core[cloud]"   # Cloud LLM providers (Anthropic, OpenAI)
pip install "securityagent-core[llm]"     # Local LLM (Ollama)
pip install "securityagent-core[dev]"     # Test dependencies

Usage

Python SDK

from skills.adapters.python_sdk import SecurityAgentSDK

sdk = SecurityAgentSDK(agent_id="my-agent", agent_type="langchain")

result = sdk.secure_read("/path/to/file")       # DLP-gated file read
result = sdk.secure_exec("ls -la")              # Command validation
result = sdk.analyze_prompt("Get all SSNs")     # Prompt intent analysis

MCP Server

python -m skills.adapters.mcp_server

Any MCP-compatible client (Claude Code, Copilot, Cursor, custom agents) connects via stdio JSON-RPC.

CLI

python -m plugin ~/.env                                    # File read gate
python -m plugin --exec "cat ~/.env"                       # Exec validation
python -m plugin --prompt "Get all passwords"              # Prompt analysis
python -m plugin --mcp-server                              # MCP server mode

Claude Code Integration

Add to .claude/settings.json:

{
  "hooks": {
    "PreToolUse": [
      { "command": "python3 /path/to/hook_fast.py" }
    ]
  }
}

Or run as-init -- it configures this automatically.

Tests

pip install -e ".[dev]"
pytest                      # Unit tests
python3 scripts/smoke_test.py   # 31 integration tests

Full suite: 1,235 tests across 32 suites -- see AgnosticSecurity for the complete test runner.

Numbers

Metric Value
Detection patterns 242
Detection layers 19 (tiered: T0/T1/T2)
Attack categories 64/64 (100%)
Compliance controls 65/65 -- OWASP, NIST, MITRE, CSA
HarmBench ASR Sub-3%
False positive rate 0.99%
Languages 40

License

Proprietary. See LICENSE.

Metadata

Release files for securityagent-core 4.61.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for securityagent-core 4.61.0
File Size Uploaded Provenance Actions
securityagent_core-4.61.0.tar.gz 251.8 kB Without provenance Details for securityagent_core-4.61.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for securityagent-core 4.61.0
File Interpreter ABI Platform Actions
securityagent_core-4.61.0-py3-none-any.whl Python 3 none any Details for securityagent_core-4.61.0-py3-none-any.whl

Total release size: 533.2 kB

Release files / securityagent_core-4.61.0.tar.gz

Download URL securityagent_core-4.61.0.tar.gz
Size 251.8 kB
Tags Source
SHA-256 checksum
How to use checksums
0966a0eeb2790b4ea779d0b848ef20ac741ae042ab2a2f37711851140b52b6eb
BLAKE2b-256 checksum
How to use checksums
2f361e2b8ce54dcd0b297f607cf0d9e9e728a2747393e94909cc1d21425fab89
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Release files / securityagent_core-4.61.0-py3-none-any.whl

Download URL securityagent_core-4.61.0-py3-none-any.whl
Size 281.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
30cec809816cae24456fa62b582c9c6d14b89aa493395ea2273276565a83a67c
BLAKE2b-256 checksum
How to use checksums
cf84ffa03307891c30bda1231b2f1945e224ef2cc2cf2b49dece71c764674a95
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Security for securityagent-core 4.61.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

4.61.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page