Metadata-Version: 2.4
Name: agnostic-security
Version: 4.60.0
Summary: The firewall for AI coding agents — prevents secrets, PII, and credentials from leaking through Copilot, Claude Code, Cursor, and LangChain
Author-email: AgnosticSecurity <security@agnosticsecurity.io>
License: MIT
Project-URL: Homepage, https://securemind.live
Project-URL: Repository, https://github.com/secure-mind-live/AgnosticSecurity
Project-URL: Issues, https://github.com/secure-mind-live/AgnosticSecurity/issues
Project-URL: Documentation, https://secure-mind-live.github.io/agnostic-security-site/docs.html
Keywords: security,dlp,data-loss-prevention,ai-agents,llm,copilot,claude-code,cursor,windsurf,guardrail,secrets,pii,credentials,devsecops
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: Topic :: Security
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Environment :: Console
Classifier: Operating System :: OS Independent
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: securityagent-core>=3.1.0
Provides-Extra: gateway
Requires-Dist: fastapi>=0.110; extra == "gateway"
Requires-Dist: uvicorn[standard]; extra == "gateway"
Requires-Dist: httpx; extra == "gateway"
Requires-Dist: python-dotenv; extra == "gateway"
Requires-Dist: pydantic-settings>=2.0; extra == "gateway"
Provides-Extra: llm
Requires-Dist: ollama; extra == "llm"
Provides-Extra: all
Requires-Dist: agnostic-security[gateway,llm]; extra == "all"

# AgnosticSecurity

**DLP for AI coding agents.** Stops secrets, credentials, and PII from leaking through Copilot, Claude Code, Cursor, and 17+ LLM providers — before the data leaves your machine.

[![Version](https://img.shields.io/badge/version-4.59.0-blue)]()
[![Tests](https://img.shields.io/badge/tests-1%2C235%20passing-brightgreen)]()
[![Compliance](https://img.shields.io/badge/compliance-65%2F65%20(100%25)-brightgreen)]()
[![PyPI](https://img.shields.io/pypi/v/securityagent-core)](https://pypi.org/project/securityagent-core/)
[![HarmBench ASR](https://img.shields.io/badge/HarmBench%20ASR-%3C3%25-green)]()
[![License](https://img.shields.io/badge/license-BSL%201.1-lightgrey)]()

---

## What It Does

- **Makes sensitive data invisible to AI.** File gates, context boundaries, and prompt guards ensure your `.env` files, API keys, and PII never enter an AI context window. If AI never sees it, there is nothing to leak.

- **Catches what other tools miss.** 19 detection layers handle base64-encoded exfiltration, split-across-turns attacks, tool call smuggling, memory poisoning, and cross-session taint tracking. 242 detection patterns across 64 attack categories.

- **Works with every AI tool you already use.** One install protects Copilot, Claude Code, Cursor, Windsurf, ChatGPT, and LangChain agents simultaneously. No vendor lock-in, no code changes.

---

## Quick Start

```bash
pip install securityagent-core
as-init    # auto-detects AI tools, configures protections — 30 seconds
```

That's it. Your `.env` files, credentials, and PII are now protected across every AI tool in your environment.

**Other install methods:** [Docker](#installation) | [VS Code Extension](#installation) | [Helm](#installation) | [GitHub Action](#github-action)

---

## How It Works

```
Developer using Copilot / Claude Code / Cursor / ChatGPT / LangChain
  |
  |  AI tries to read .env ──────────── BLOCKED  (file gate, <1ms)
  |  Prompt contains SSN ────────────── BLOCKED  (prompt guard, 10 decoding layers)
  |  Agent runs `curl -d @.env` ─────── BLOCKED  (exec guard + egress allowlist)
  |  @workspace indexes credentials ─── BLOCKED  (context boundary)
  |  LLM response leaks PII ────────── BLOCKED  (output pipeline)
  |  Tool call smuggles data out ────── BLOCKED  (tool call guard + taint tracker)
  |  Memory stores "password is X" ──── BLOCKED  (memory guard)
  |  Base64-encoded exfil in 3 steps ── BLOCKED  (multi-step exfil detector)
  |  External agent probes your API ─── BLOCKED  (6-layer ingress guard)
  |
  └── Everything else ──────────────── Works normally
```

---

## Key Numbers

| Metric | Value |
|--------|-------|
| **Detection patterns** | 242 across 19 layers (tiered T0/T1/T2) |
| **Attack categories** | 64/64 covered (100%) |
| **HarmBench ASR** | sub-3%, 0% false positives, F1 0.98+ |
| **Red team agents** | 55 Docker-isolated agents, 84 events, 100% detection |
| **Compliance** | 65/65 — OWASP 10/10, NIST 26/26, MITRE 14/14, CSA 15/15 |
| **Tests** | 1,235 across 32 suites (100% pass) |
| **Languages** | 40 (multilingual prompt injection detection) |
| **LLM providers** | 17+ supported (OpenAI, Anthropic, Google, Azure, Ollama, ...) |
| **Components** | 48+ |

---

## Features

### Detection & Prevention

- **File gate** — blocks AI from reading `.env`, `.pem`, `id_rsa`, credentials
- **Prompt guard** — 10 decoding sublayers (base64, hex, ROT13, unicode, zero-width chars, reversed text, leetspeak, digit reassembly)
- **Exec guard** — catches `cat ~/.env`, `curl -d @secrets`, obfuscated payloads, netcat/SSH tunnels
- **Context boundary** — `.copilotignore` + `search.exclude` + LM API interceptor ensures AI never sees sensitive content
- **Terminal Guard v4** — process ancestry tree + input cadence detection separates AI from human terminal commands
- **Output pipeline** — scans LLM responses for leaked PII, credentials, semantic disclosure patterns
- **Taint tracking** — SHA-256 + n-gram Jaccard similarity detects exfiltration across sessions
- **Tool call guard** — DLP + taint scan on MCP/function call arguments
- **Lethal trifecta detector** — blocks when private data + untrusted input + external comm all active simultaneously
- **Streaming DLP** — real-time scanning of streamed LLM responses
- **Memory scanner** — detects trust boundary violations and memory poisoning
- **Injection detection** — 242 regex patterns covering SQL injection, SSRF, SSTI, XXE, Log4Shell, deserialization, and more
- **Code fingerprint guard** — proprietary code leak prevention via n-gram fingerprinting
- **Vulnerability scanner** — OWASP SAST-lite for AI-generated code

### Governance & Compliance

- **RBAC** — 7 roles (super_admin through developer), team scoping, API key resolution
- **Smart redaction** — 4 modes per data type: block, redact (reversible tokenization), mask (partial), allow
- **Privacy mode** — `full_privacy` (local LLM only), `balanced`, `permissive`
- **Policy-as-code** — YAML policy templates, versioned, org-wide + per-team overrides
- **Alert rules** — configurable thresholds and notification channels
- **Compliance scoring** — OWASP, NIST AI RMF + 800-53, MITRE ATLAS, CSA ARIA
- **Compliance PDF export** — enterprise-styled reports with score cards, per-framework detail, eval metrics
- **Audit backend** — PostgreSQL (production) or SQLite (local), immutable SHA-256 checksummed logs
- **Security scorecard** — real-time posture assessment across all detection layers

### Dashboards (7 pages, unified design system)

- **Dashboard** — gateway stats, breach data, DLP blocks, latency metrics
- **Prompt Injection** — real-time injection attempt visualization
- **Red Team** — attack replay + forensics from Docker harness
- **Events** — paginated audit trail with filters (action, model, search)
- **DLP Controls** — per-type PII blocking, egress domain allowlist, redaction policy
- **Console** — policy management, agent enrollment, RBAC administration
- **Platform** — SDK status, cost tracking, system health

### Integrations

- **CrowdStrike EDR** — IOC push on high-severity blocks
- **Splunk HEC** — audit event forwarding
- **Datadog** — metrics and event ingestion
- **PagerDuty / OpsGenie** — alert escalation
- **Slack / Teams** — real-time alert bot
- **WebSocket event feed** — live streaming for custom dashboards

### CISO Skills (Claude Code slash commands)

8 self-contained security workflows — no code deps, call existing APIs:

| Command | What It Does |
|---------|-------------|
| `/ciso` | Executive security briefing with risk assessment |
| `/threat-brief` | Current threat landscape analysis |
| `/audit-now` | Run 50-check security audit |
| `/redteam-auto` | Automated red team exercise |
| `/posture` | Security posture scorecard |
| `/incident` | Incident response workflow |
| `/learn-security` | Interactive security training |
| `/compliance-check` | Multi-framework compliance validation |

---

## Supported AI Tools

| AI Tool | Protection Method |
|---------|-------------------|
| **GitHub Copilot** | VS Code extension (context boundary + LM API interceptor) |
| **Claude Code** | Hook-based (PreToolUse + UserPromptSubmit, 4-layer pipeline) |
| **Cursor** | `.cursorignore` + VS Code extension |
| **Windsurf** | `.aiignore` + VS Code extension |
| **ChatGPT, Claude.ai, Gemini, Grok, Perplexity, DeepSeek** | Chrome extension (DLP for web LLM interfaces) |
| **LangChain / Autogen** | Auto-instrumentation SDK (zero-code) |
| **Any LLM provider** | API Gateway with input/output security pipelines |

---

## Installation

| Method | Command | Best For |
|--------|---------|----------|
| **PyPI** | `pip install securityagent-core && as-init` | Individual developers |
| **Docker** | `docker compose up` | Full stack (gateway + breach engine + proxy) |
| **VS Code** | Install `.vsix` from [Releases](https://github.com/secure-mind-live/AgnosticSecurity/releases) | Copilot / Cursor users |
| **Chrome** | Load unpacked from `chrome-extension/` | ChatGPT / Claude web users |
| **Pre-commit** | `bash hooks/install.sh` | Git-level scanning |
| **GitHub Action** | [See below](#github-action) | CI/CD pipeline |
| **Helm** | `helm install agsec helm/agnosticsecurity/` | Kubernetes production |

---

## GitHub Action

```yaml
name: AgnosticSecurity Scan
on: [pull_request]

jobs:
  scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: secure-mind-live/AgnosticSecurity/.github/actions/security-scan@main
        with:
          severity-threshold: HIGH
          fail-on-findings: true
          scan-dlp: true
          scan-vulns: true
```

---

## Architecture

```
                         +------------------+
                         |   Developer IDE  |
                         | (VS Code/Cursor) |
                         +--------+---------+
                                  |
              +-------------------+-------------------+
              |                   |                   |
     +--------v--------+ +-------v--------+ +--------v--------+
     |  VS Code Ext    | | Claude Code    | | Chrome Ext      |
     |  Context boundary| | Hooks (4-layer)| | Web LLM DLP     |
     +---------+--------+ +-------+--------+ +--------+--------+
              |                   |                   |
              +-------------------+-------------------+
                                  |
                         +--------v---------+
                         |   API Gateway    |    Port 8000
                         |  (Smart Router)  |
                         +--------+---------+
                                  |
              +-------------------+-------------------+
              |                   |                   |
     +--------v--------+ +-------v--------+ +--------v--------+
     | Input Pipeline  | | Output Pipeline| | Ingress Guard   |
     | DLP + injection | | PII + redaction| | 6-layer defense |
     | + guardrails    | | + de-tokenize  | | + risk scoring  |
     +--------+--------+ +-------+--------+ +--------+--------+
              |                   |                   |
              +-------------------+-------------------+
                                  |
                    +-------------+-------------+
                    |                           |
           +--------v--------+        +--------v--------+
           |  Breach Engine  |        |  Audit Backend  |
           |  Classification |        |  PostgreSQL/    |
           |  + Compliance   |        |  SQLite         |
           +-----------------+        +-----------------+
```

---

## Testing

```bash
source .venv/bin/activate

# Quick validation
python3 scripts/smoke_test.py            # 31 tests — file gate + content DLP
python3 scripts/test_red_team.py         # 52 tests — adversarial attacks

# Red team Docker harness (55 agents, 10 OWASP categories)
docker compose -f docker-compose.redteam.yml up --build -d
docker exec agsec-attacker python3 /agents/run_all.py

# Full suite: 1,235 tests across 32 files — see CLAUDE.md for complete list
```

---

## Privacy

- **Runs on your machine** — no telemetry, no analytics, no cloud dependency
- **Pluggable LLM** — local Ollama (air-gapped), Anthropic, or OpenAI for optional semantic analysis
- **Privacy mode** — `full_privacy` locks to local models only; `balanced` allows cloud with DLP; `permissive` logs only
- **Audit logs stored locally** — SHA-256 checksummed, tamper-detected

---

## Documentation

| Document | Description |
|----------|-------------|
| [Security Design](docs/SECURITY_DESIGN.md) | Threat model, design decisions, failure modes |
| [OWASP LLM Mapping](docs/OWASP_LLM_MAPPING.md) | Control-to-risk compliance mapping |
| [Admin Console](docs/ADMIN_CONSOLE.md) | Policy management architecture |
| [Enterprise RBAC](docs/ENTERPRISE_RBAC.md) | Role-based access control design |
| [Memory Agent Threats](docs/MEMORY_AGENT_THREAT_MODEL.md) | Memory poisoning, trust boundaries |
| [Competitive Analysis](docs/COMPETITIVE_ANALYSIS.md) | vs Lakera, Protect AI, Prompt Security, HiddenLayer |

---

## Contributing

```bash
git clone https://github.com/secure-mind-live/AgnosticSecurity.git
cd AgnosticSecurity
python3 -m venv .venv && source .venv/bin/activate
pip install -e .
python3 scripts/smoke_test.py   # verify setup
```

PRs welcome. All contributions run through the security hook — if it blocks your action, adjust your approach.

---

## License

Business Source License 1.1 (BSL-1.1). Free for non-production use. See [LICENSE](LICENSE) for details.
