agentgate-mcp 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- agentgate_mcp-0.1.0/.dockerignore +12 -0
- agentgate_mcp-0.1.0/.github/workflows/bench.yml +22 -0
- agentgate_mcp-0.1.0/.github/workflows/ci.yml +30 -0
- agentgate_mcp-0.1.0/.github/workflows/release.yml +34 -0
- agentgate_mcp-0.1.0/.gitignore +16 -0
- agentgate_mcp-0.1.0/CHANGELOG.md +20 -0
- agentgate_mcp-0.1.0/CONTRIBUTING.md +37 -0
- agentgate_mcp-0.1.0/Dockerfile +24 -0
- agentgate_mcp-0.1.0/LICENSE +201 -0
- agentgate_mcp-0.1.0/NEXT_STEPS.md +71 -0
- agentgate_mcp-0.1.0/PKG-INFO +223 -0
- agentgate_mcp-0.1.0/README.md +184 -0
- agentgate_mcp-0.1.0/SECURITY.md +5 -0
- agentgate_mcp-0.1.0/bench/README.md +44 -0
- agentgate_mcp-0.1.0/bench/attacks/exfil_subtle_01/meta.yaml +7 -0
- agentgate_mcp-0.1.0/bench/attacks/exfil_subtle_01/server.py +22 -0
- agentgate_mcp-0.1.0/bench/attacks/indirect_injection_01/meta.yaml +7 -0
- agentgate_mcp-0.1.0/bench/attacks/indirect_injection_01/server.py +20 -0
- agentgate_mcp-0.1.0/bench/attacks/poison_obvious_01/meta.yaml +7 -0
- agentgate_mcp-0.1.0/bench/attacks/poison_obvious_01/server.py +28 -0
- agentgate_mcp-0.1.0/bench/attacks/rugpull_01/meta.yaml +7 -0
- agentgate_mcp-0.1.0/bench/attacks/rugpull_01/server.py +23 -0
- agentgate_mcp-0.1.0/bench/attacks/unicode_tag_01/meta.yaml +7 -0
- agentgate_mcp-0.1.0/bench/attacks/unicode_tag_01/server.py +18 -0
- agentgate_mcp-0.1.0/bench/benign/airtable.json +1149 -0
- agentgate_mcp-0.1.0/bench/benign/arxiv.json +716 -0
- agentgate_mcp-0.1.0/bench/benign/atlassian.json +3524 -0
- agentgate_mcp-0.1.0/bench/benign/aws-docs.json +802 -0
- agentgate_mcp-0.1.0/bench/benign/aws-kb-retrieval-ref.json +37 -0
- agentgate_mcp-0.1.0/bench/benign/brave-search-ref.json +58 -0
- agentgate_mcp-0.1.0/bench/benign/browserbase.json +182 -0
- agentgate_mcp-0.1.0/bench/benign/chrome-devtools.json +1266 -0
- agentgate_mcp-0.1.0/bench/benign/context7.json +77 -0
- agentgate_mcp-0.1.0/bench/benign/desktop-commander.json +892 -0
- agentgate_mcp-0.1.0/bench/benign/duckduckgo.json +145 -0
- agentgate_mcp-0.1.0/bench/benign/everart-ref.json +37 -0
- agentgate_mcp-0.1.0/bench/benign/everything.json +886 -0
- agentgate_mcp-0.1.0/bench/benign/exa.json +310 -0
- agentgate_mcp-0.1.0/bench/benign/excel.json +405 -0
- agentgate_mcp-0.1.0/bench/benign/fetch.json +78 -0
- agentgate_mcp-0.1.0/bench/benign/figma-context.json +139 -0
- agentgate_mcp-0.1.0/bench/benign/filesystem.json +767 -0
- agentgate_mcp-0.1.0/bench/benign/firecrawl.json +6833 -0
- agentgate_mcp-0.1.0/bench/benign/git.json +504 -0
- agentgate_mcp-0.1.0/bench/benign/github-ref.json +1055 -0
- agentgate_mcp-0.1.0/bench/benign/google-maps-ref.json +195 -0
- agentgate_mcp-0.1.0/bench/benign/heroku.json +936 -0
- agentgate_mcp-0.1.0/bench/benign/hubspot.json +1276 -0
- agentgate_mcp-0.1.0/bench/benign/kubernetes.json +1163 -0
- agentgate_mcp-0.1.0/bench/benign/linear.json +179 -0
- agentgate_mcp-0.1.0/bench/benign/memory.json +748 -0
- agentgate_mcp-0.1.0/bench/benign/mongodb.json +3032 -0
- agentgate_mcp-0.1.0/bench/benign/notion.json +6421 -0
- agentgate_mcp-0.1.0/bench/benign/playwright-ea.json +792 -0
- agentgate_mcp-0.1.0/bench/benign/playwright.json +937 -0
- agentgate_mcp-0.1.0/bench/benign/postgres-ref.json +23 -0
- agentgate_mcp-0.1.0/bench/benign/puppeteer-ref.json +157 -0
- agentgate_mcp-0.1.0/bench/benign/qdrant.json +59 -0
- agentgate_mcp-0.1.0/bench/benign/sentry.json +20910 -0
- agentgate_mcp-0.1.0/bench/benign/sequential-thinking.json +119 -0
- agentgate_mcp-0.1.0/bench/benign/slack-ref.json +178 -0
- agentgate_mcp-0.1.0/bench/benign/tavily.json +336 -0
- agentgate_mcp-0.1.0/bench/benign/time.json +265 -0
- agentgate_mcp-0.1.0/bench/benign/todoist.json +147 -0
- agentgate_mcp-0.1.0/bench/benign/wikipedia.json +1863 -0
- agentgate_mcp-0.1.0/bench/benign/youtube-transcript.json +33 -0
- agentgate_mcp-0.1.0/bench/calibrate_judge.py +60 -0
- agentgate_mcp-0.1.0/bench/cases/attacks/command_injection.yaml +35 -0
- agentgate_mcp-0.1.0/bench/cases/attacks/indirect_injection.yaml +63 -0
- agentgate_mcp-0.1.0/bench/cases/attacks/instructions_poisoning.yaml +14 -0
- agentgate_mcp-0.1.0/bench/cases/attacks/invisible_unicode.yaml +43 -0
- agentgate_mcp-0.1.0/bench/cases/attacks/obfuscated_exfil.yaml +54 -0
- agentgate_mcp-0.1.0/bench/cases/attacks/prompt_poisoning.yaml +18 -0
- agentgate_mcp-0.1.0/bench/cases/attacks/rug_pull.yaml +53 -0
- agentgate_mcp-0.1.0/bench/cases/attacks/secret_exfil_args.yaml +57 -0
- agentgate_mcp-0.1.0/bench/cases/attacks/ssrf_egress.yaml +35 -0
- agentgate_mcp-0.1.0/bench/cases/attacks/tool_poisoning_obvious.yaml +74 -0
- agentgate_mcp-0.1.0/bench/cases/attacks/tool_poisoning_subtle.yaml +86 -0
- agentgate_mcp-0.1.0/bench/cases/attacks/tool_shadowing.yaml +39 -0
- agentgate_mcp-0.1.0/bench/collect_benign.py +214 -0
- agentgate_mcp-0.1.0/bench/compare.py +193 -0
- agentgate_mcp-0.1.0/bench/judge_cache/openai_gpt-oss-120b.jsonl +322 -0
- agentgate_mcp-0.1.0/bench/judge_cache/openai_gpt-oss-20b.jsonl +729 -0
- agentgate_mcp-0.1.0/bench/labels.csv +241 -0
- agentgate_mcp-0.1.0/bench/redteam/README.md +64 -0
- agentgate_mcp-0.1.0/bench/run_bench.py +747 -0
- agentgate_mcp-0.1.0/bench/servers/files.py +17 -0
- agentgate_mcp-0.1.0/bench/servers/notes.py +15 -0
- agentgate_mcp-0.1.0/bench/servers/weather.py +15 -0
- agentgate_mcp-0.1.0/detections/README.md +98 -0
- agentgate_mcp-0.1.0/detections/build.sh +15 -0
- agentgate_mcp-0.1.0/detections/pipelines/agentgate_splunk.yml +15 -0
- agentgate_mcp-0.1.0/detections/sigma/ag_command_tool_call.yml +25 -0
- agentgate_mcp-0.1.0/detections/sigma/ag_corr_denied_burst.yml +18 -0
- agentgate_mcp-0.1.0/detections/sigma/ag_corr_injection_then_shell.yml +19 -0
- agentgate_mcp-0.1.0/detections/sigma/ag_exfil_flow.yml +19 -0
- agentgate_mcp-0.1.0/detections/sigma/ag_fail_closed.yml +18 -0
- agentgate_mcp-0.1.0/detections/sigma/ag_indian_pii_result.yml +21 -0
- agentgate_mcp-0.1.0/detections/sigma/ag_injection_in_result.yml +21 -0
- agentgate_mcp-0.1.0/detections/sigma/ag_lethal_trifecta.yml +19 -0
- agentgate_mcp-0.1.0/detections/sigma/ag_new_tool_first_seen.yml +19 -0
- agentgate_mcp-0.1.0/detections/sigma/ag_poisoned_instructions_or_prompt.yml +21 -0
- agentgate_mcp-0.1.0/detections/sigma/ag_rug_pull.yml +19 -0
- agentgate_mcp-0.1.0/detections/sigma/ag_secret_outgoing.yml +22 -0
- agentgate_mcp-0.1.0/detections/sigma/ag_ssrf_egress.yml +19 -0
- agentgate_mcp-0.1.0/detections/sigma/ag_tool_call_denied.yml +18 -0
- agentgate_mcp-0.1.0/detections/sigma/ag_tool_poisoning.yml +20 -0
- agentgate_mcp-0.1.0/detections/sigma/ag_tool_shadowing.yml +18 -0
- agentgate_mcp-0.1.0/detections/splunk/agentgate_dashboard.xml +119 -0
- agentgate_mcp-0.1.0/detections/splunk/savedsearches.conf +69 -0
- agentgate_mcp-0.1.0/detections/splunk/searches.spl +38 -0
- agentgate_mcp-0.1.0/detections/wazuh/agentgate_rules.xml +160 -0
- agentgate_mcp-0.1.0/detections/wazuh/test_rules.sh +18 -0
- agentgate_mcp-0.1.0/docs/article_draft.md +102 -0
- agentgate_mcp-0.1.0/docs/comparison.md +75 -0
- agentgate_mcp-0.1.0/docs/demo.md +57 -0
- agentgate_mcp-0.1.0/docs/error_analysis.md +138 -0
- agentgate_mcp-0.1.0/docs/img/splunk_dashboard.png +0 -0
- agentgate_mcp-0.1.0/docs/owasp_mapping.md +67 -0
- agentgate_mcp-0.1.0/docs/paper_draft.md +152 -0
- agentgate_mcp-0.1.0/docs/posts_draft.md +50 -0
- agentgate_mcp-0.1.0/docs/related_work.md +58 -0
- agentgate_mcp-0.1.0/docs/results.md +82 -0
- agentgate_mcp-0.1.0/docs/results_judge_20b.md +80 -0
- agentgate_mcp-0.1.0/docs/results_postfreeze.md +71 -0
- agentgate_mcp-0.1.0/docs/results_v2_test.md +64 -0
- agentgate_mcp-0.1.0/docs/threat_model.md +64 -0
- agentgate_mcp-0.1.0/docs/windows_quickstart.md +83 -0
- agentgate_mcp-0.1.0/lab/attacker/webhook.py +23 -0
- agentgate_mcp-0.1.0/lab/check_alerts.py +54 -0
- agentgate_mcp-0.1.0/lab/demo_agent.py +166 -0
- agentgate_mcp-0.1.0/lab/docker-compose.yml +33 -0
- agentgate_mcp-0.1.0/lab/generate_events.py +174 -0
- agentgate_mcp-0.1.0/lab/splunk_app/default/app.conf +10 -0
- agentgate_mcp-0.1.0/lab/splunk_app/default/props.conf +4 -0
- agentgate_mcp-0.1.0/policies/default.yaml +70 -0
- agentgate_mcp-0.1.0/pyproject.toml +85 -0
- agentgate_mcp-0.1.0/src/agentgate/__init__.py +3 -0
- agentgate_mcp-0.1.0/src/agentgate/__main__.py +3 -0
- agentgate_mcp-0.1.0/src/agentgate/approvals.py +138 -0
- agentgate_mcp-0.1.0/src/agentgate/audit.py +83 -0
- agentgate_mcp-0.1.0/src/agentgate/cli.py +416 -0
- agentgate_mcp-0.1.0/src/agentgate/config_audit.py +202 -0
- agentgate_mcp-0.1.0/src/agentgate/detectors/__init__.py +2 -0
- agentgate_mcp-0.1.0/src/agentgate/detectors/args_policy.py +196 -0
- agentgate_mcp-0.1.0/src/agentgate/detectors/classifier.py +144 -0
- agentgate_mcp-0.1.0/src/agentgate/detectors/judge.py +224 -0
- agentgate_mcp-0.1.0/src/agentgate/detectors/manifest_guard.py +342 -0
- agentgate_mcp-0.1.0/src/agentgate/detectors/poisoning.py +398 -0
- agentgate_mcp-0.1.0/src/agentgate/detectors/posture.py +72 -0
- agentgate_mcp-0.1.0/src/agentgate/detectors/secrets.py +191 -0
- agentgate_mcp-0.1.0/src/agentgate/detectors/taint.py +296 -0
- agentgate_mcp-0.1.0/src/agentgate/findings.py +59 -0
- agentgate_mcp-0.1.0/src/agentgate/install.py +87 -0
- agentgate_mcp-0.1.0/src/agentgate/pipeline.py +565 -0
- agentgate_mcp-0.1.0/src/agentgate/policy.py +172 -0
- agentgate_mcp-0.1.0/src/agentgate/protocol/__init__.py +0 -0
- agentgate_mcp-0.1.0/src/agentgate/protocol/models.py +125 -0
- agentgate_mcp-0.1.0/src/agentgate/report.py +90 -0
- agentgate_mcp-0.1.0/src/agentgate/sinks.py +136 -0
- agentgate_mcp-0.1.0/src/agentgate/transport/__init__.py +0 -0
- agentgate_mcp-0.1.0/src/agentgate/transport/http.py +186 -0
- agentgate_mcp-0.1.0/src/agentgate/transport/stdio.py +145 -0
- agentgate_mcp-0.1.0/tests/test_approvals.py +96 -0
- agentgate_mcp-0.1.0/tests/test_bench.py +37 -0
- agentgate_mcp-0.1.0/tests/test_classifier.py +94 -0
- agentgate_mcp-0.1.0/tests/test_cli.py +86 -0
- agentgate_mcp-0.1.0/tests/test_config_audit.py +81 -0
- agentgate_mcp-0.1.0/tests/test_detectors.py +305 -0
- agentgate_mcp-0.1.0/tests/test_fuzz.py +71 -0
- agentgate_mcp-0.1.0/tests/test_install.py +53 -0
- agentgate_mcp-0.1.0/tests/test_integration_http.py +120 -0
- agentgate_mcp-0.1.0/tests/test_integration_stdio.py +128 -0
- agentgate_mcp-0.1.0/tests/test_judge.py +132 -0
- agentgate_mcp-0.1.0/tests/test_pipeline.py +260 -0
- agentgate_mcp-0.1.0/tests/test_posture.py +56 -0
- agentgate_mcp-0.1.0/tests/test_redteam.py +32 -0
- agentgate_mcp-0.1.0/tests/test_report.py +44 -0
- agentgate_mcp-0.1.0/tests/test_sinks.py +80 -0
- agentgate_mcp-0.1.0/tests/test_taint.py +157 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Benchmark regression check: fails if detection quality on the DEV split drops.
|
|
2
|
+
# (The test split is never used for gating; it is read once per freeze, by hand.)
|
|
3
|
+
name: Bench regression
|
|
4
|
+
on:
|
|
5
|
+
push:
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
bench:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
- uses: actions/setup-python@v5
|
|
14
|
+
with:
|
|
15
|
+
python-version: "3.12"
|
|
16
|
+
- run: pip install -e ".[dev]"
|
|
17
|
+
- run: python bench/run_bench.py --split dev --out bench-dev.md --min-recall 0.85 --max-fpr 0.08
|
|
18
|
+
- uses: actions/upload-artifact@v4
|
|
19
|
+
if: always()
|
|
20
|
+
with:
|
|
21
|
+
name: bench-dev-results
|
|
22
|
+
path: bench-dev.md
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
pull_request:
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
test:
|
|
8
|
+
runs-on: ${{ matrix.os }}
|
|
9
|
+
strategy:
|
|
10
|
+
fail-fast: false
|
|
11
|
+
matrix:
|
|
12
|
+
os: [ubuntu-latest, windows-latest]
|
|
13
|
+
python: ["3.11", "3.13"]
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
- uses: actions/setup-python@v5
|
|
17
|
+
with:
|
|
18
|
+
python-version: ${{ matrix.python }}
|
|
19
|
+
- run: pip install -e ".[dev]"
|
|
20
|
+
- run: ruff check .
|
|
21
|
+
- run: ruff format --check .
|
|
22
|
+
- run: mypy
|
|
23
|
+
- run: pytest -q --cov=agentgate.detectors --cov=agentgate.policy --cov-report=term --cov-fail-under=80
|
|
24
|
+
|
|
25
|
+
docker:
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
steps:
|
|
28
|
+
- uses: actions/checkout@v4
|
|
29
|
+
- run: docker build -t agentgate:ci .
|
|
30
|
+
- run: docker run --rm agentgate:ci agentgate version
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Publishes to PyPI when a GitHub release is published (Releases -> Draft a new release), using PyPI trusted publishing (no token
|
|
2
|
+
# stored in GitHub). One-time setup on pypi.org: add a trusted publisher for this repository,
|
|
3
|
+
# workflow `release.yml`, environment `pypi`.
|
|
4
|
+
name: Release
|
|
5
|
+
on:
|
|
6
|
+
release:
|
|
7
|
+
types: [published] # publish a release on GitHub (website or phone app) to ship to PyPI
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
- uses: actions/setup-python@v5
|
|
15
|
+
with:
|
|
16
|
+
python-version: "3.12"
|
|
17
|
+
- run: pip install build && python -m build
|
|
18
|
+
- uses: actions/upload-artifact@v4
|
|
19
|
+
with:
|
|
20
|
+
name: dist
|
|
21
|
+
path: dist/
|
|
22
|
+
|
|
23
|
+
publish:
|
|
24
|
+
needs: build
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
environment: pypi
|
|
27
|
+
permissions:
|
|
28
|
+
id-token: write
|
|
29
|
+
steps:
|
|
30
|
+
- uses: actions/download-artifact@v4
|
|
31
|
+
with:
|
|
32
|
+
name: dist
|
|
33
|
+
path: dist/
|
|
34
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0 (unreleased)
|
|
4
|
+
|
|
5
|
+
First public version.
|
|
6
|
+
|
|
7
|
+
- stdio relay (`agentgate wrap`) and Streamable HTTP reverse proxy (`agentgate serve`)
|
|
8
|
+
- YAML policy engine: allow / deny / ask, fail closed, per-tool argument rules
|
|
9
|
+
- Detectors: manifest pinning and rug-pull diff, tool shadowing, poisoning heuristics
|
|
10
|
+
(incl. invisible Unicode and base64), argument policy (paths, shell metacharacters, SSRF,
|
|
11
|
+
egress allowlist), secrets and Indian PII (Aadhaar with Verhoeff check, PAN), indirect
|
|
12
|
+
injection in results, cross-server taint tracking, lethal-trifecta posture warning
|
|
13
|
+
- Optional layers: ONNX prompt-injection classifier, LLM judge (OpenAI-compatible API)
|
|
14
|
+
- `agentgate scan-config` (SARIF), `agentgate check`, optional secret redaction in results
|
|
15
|
+
- JSONL audit log, Splunk HEC sink, 15 Sigma rules, Splunk dashboard, docker-compose lab
|
|
16
|
+
- AgentGate-Bench: 110 attack cases (three corpus versions, two freezes), 42 real benign
|
|
17
|
+
servers (tools, instructions, prompts), comparison with Cisco MCP Scanner and mcpwall,
|
|
18
|
+
red-team split, CI regression gate
|
|
19
|
+
- Server `instructions` and prompts scanned; Telegram approvals; pin export/import; Wazuh rules
|
|
20
|
+
- Taint: key=value secrets, identifier matching for paraphrased leaks, hex decoding
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Thanks for your interest. Issues and pull requests are welcome.
|
|
4
|
+
|
|
5
|
+
## Development setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
python -m venv .venv && . .venv/bin/activate # Windows: .venv\Scripts\activate
|
|
9
|
+
pip install -e ".[dev]"
|
|
10
|
+
pytest -q && ruff check . && ruff format --check . && mypy
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Ground rules
|
|
14
|
+
|
|
15
|
+
- **Fail closed.** A detector bug must lead to a denial, never to a silent allow.
|
|
16
|
+
- **Never log secrets.** Evidence strings go through `findings.redact()`.
|
|
17
|
+
- **No `shell=True`**, and no network calls from detectors (the optional LLM judge is the one
|
|
18
|
+
explicit exception, and it's off by default).
|
|
19
|
+
- **Benchmark discipline.** Tune detectors on the **dev** split only
|
|
20
|
+
(`python bench/run_bench.py --split dev`). Never tune against the test split or the
|
|
21
|
+
red-team set. CI fails if dev recall drops below 0.85 or the false-positive rate rises above
|
|
22
|
+
0.08.
|
|
23
|
+
- New attack cases go in `bench/cases/attacks/<category>.yaml` with a `family`; the family
|
|
24
|
+
decides the dev/test split, so give a new idea a new family.
|
|
25
|
+
|
|
26
|
+
## Adding a detector
|
|
27
|
+
|
|
28
|
+
1. Add `src/agentgate/detectors/<name>.py` returning `list[Finding]` with a stable rule ID,
|
|
29
|
+
an OWASP MCP Top 10 ID and, where one fits, a verified MITRE ATLAS ID.
|
|
30
|
+
2. Call it from `pipeline.py` through `self._guard(...)` so crashes fail closed.
|
|
31
|
+
3. Add positive and negative unit tests; keep detector coverage above 80%.
|
|
32
|
+
4. Add a Sigma rule in `detections/sigma/` if it produces a new finding ID, and run
|
|
33
|
+
`detections/build.sh`.
|
|
34
|
+
|
|
35
|
+
## Security issues
|
|
36
|
+
|
|
37
|
+
Please don't open public issues for vulnerabilities; see [SECURITY.md](SECURITY.md).
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# AgentGate as a central Streamable HTTP gateway.
|
|
2
|
+
# docker build -t agentgate .
|
|
3
|
+
# docker run -p 8765:8765 -e UPSTREAM=http://mcp-server:8000/mcp -e SERVER=github agentgate
|
|
4
|
+
ARG BASE_IMAGE=python:3.12-slim
|
|
5
|
+
FROM ${BASE_IMAGE}
|
|
6
|
+
|
|
7
|
+
RUN useradd --create-home --uid 10001 agentgate
|
|
8
|
+
WORKDIR /app
|
|
9
|
+
COPY pyproject.toml README.md LICENSE ./
|
|
10
|
+
COPY src ./src
|
|
11
|
+
COPY policies ./policies
|
|
12
|
+
# Behind a TLS-intercepting proxy, pass its CA as an optional build secret:
|
|
13
|
+
# docker build --secret id=ca_bundle,src=/path/to/ca.pem -t agentgate .
|
|
14
|
+
RUN --mount=type=secret,id=ca_bundle,required=false \
|
|
15
|
+
if [ -f /run/secrets/ca_bundle ]; then export PIP_CERT=/run/secrets/ca_bundle; fi; \
|
|
16
|
+
pip install --no-cache-dir ".[http]"
|
|
17
|
+
|
|
18
|
+
USER agentgate
|
|
19
|
+
ENV AGENTGATE_HOME=/home/agentgate/.agentgate \
|
|
20
|
+
AGENTGATE_AUDIT=stderr \
|
|
21
|
+
UPSTREAM="" SERVER="upstream" PORT=8765
|
|
22
|
+
EXPOSE 8765
|
|
23
|
+
# Audit events go to stderr so `docker logs` / a log shipper (Wazuh, Splunk) can collect them.
|
|
24
|
+
CMD ["sh", "-c", "exec agentgate serve --host 0.0.0.0 --port \"$PORT\" --server \"$SERVER\" --upstream \"$UPSTREAM\""]
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright {yyyy} {name of copyright owner}
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Where we stopped (28 Nov 2026)
|
|
2
|
+
|
|
3
|
+
## Done
|
|
4
|
+
- Scaffold: pyproject (PyPI name `agentgate-mcp`, since `agentgate` is taken), CI, ruff, strict mypy, pytest
|
|
5
|
+
- stdio relay, JSON-RPC framing, fail-closed errors, JSONL audit log
|
|
6
|
+
- Policy engine (allow/deny/ask), manifest pinning + rug-pull diff + shadowing,
|
|
7
|
+
poisoning heuristics, args policy (globs/SSRF/shell), secrets + Aadhaar/PAN, result scanner
|
|
8
|
+
- 4 attack servers in bench/attacks, 2 benign toy servers
|
|
9
|
+
- 38 tests passing (unit + end-to-end with the official MCP client)
|
|
10
|
+
|
|
11
|
+
- docs/owasp_mapping.md and docs/threat_model.md (Week 0)
|
|
12
|
+
- docs/related_work.md (Cisco MCP Scanner and Snyk Agent Scan, from their READMEs)
|
|
13
|
+
- 29 Nov evening: taint key=value secrets + token matching; intent heuristics (negation-aware);
|
|
14
|
+
Telegram approvals; pin export/import (team allowlist); Wazuh rules verified with wazuh-logtest;
|
|
15
|
+
server instructions + prompts scanned; corpus v3 (instructions/prompt poisoning, 110 cases);
|
|
16
|
+
benign corpus now includes real instructions (7) and prompts (8). Dev: 86% recall, 3.0% FPR
|
|
17
|
+
- Corpus v2 (103 cases), freeze 2 (c69015d): unseen v2 test recall 50% vs dev 77%; post-freeze-2
|
|
18
|
+
fixes (IPv4 shorthand, sensitive-file args, hex taint, narrower defaults rule)
|
|
19
|
+
- Red-team kit (bench/redteam/README.md, --split redteam); CI benchmark gate; CONTRIBUTING;
|
|
20
|
+
article and LinkedIn drafts (docs/article_draft.md, docs/posts_draft.md)
|
|
21
|
+
- Real-LLM demo (docs/demo.md): canary leaked 6/7 unprotected, 0/7 with AgentGate
|
|
22
|
+
- LLM-judge layer, ONNX classifier, `agentgate check`, result redaction, 95% detector coverage, v0.1.0 prepared
|
|
23
|
+
- Three-way comparison with Cisco MCP Scanner and mcpwall (docs/comparison.md); mcpwall in related work
|
|
24
|
+
- Frozen benchmark run: 77% recall, 5% FPR on 42 real servers + docs, 0.26 ms p95; error analysis written
|
|
25
|
+
- ONNX classifier backend (Apache-2.0 model, pinned); dev calibration; manifest scanning opt-in
|
|
26
|
+
- AgentGate-Bench: 60 attack cases, run_bench.py, baseline results (77% recall, 0.19 ms p95)
|
|
27
|
+
- Splunk lab run end to end: 10 of 12 searches fire incl. both correlations (pySigma temporal bug patched)
|
|
28
|
+
- Splunk HEC sink, 15 Sigma rules (incl. 2 correlations) -> SPL, dashboard, docker lab
|
|
29
|
+
- MITRE ATLAS IDs on findings (verified against atlas-data 2026.11)
|
|
30
|
+
- Classifier layer (pluggable; real HF model untested here: huggingface.co is blocked)
|
|
31
|
+
- Streamable HTTP proxy (`agentgate serve`), e2e tested in JSON and SSE modes
|
|
32
|
+
- Hypothesis fuzz tests: random bytes and malformed JSON-RPC never crash the pipeline
|
|
33
|
+
- `agentgate scan-config` (D7): AG-CFG-001..005, SARIF 2.1.0 output; config paths need re-checking per client docs
|
|
34
|
+
- Lethal-trifecta posture warning (AG-POSTURE-001)
|
|
35
|
+
- End-to-end exfil test across two wrapped servers (bench/attacks/exfil_subtle_01)
|
|
36
|
+
- D6 taint tracker: winnowed fingerprints + exact secrets in a shared SQLite store, so flows are
|
|
37
|
+
caught across servers (separate wrap processes); URL/base64 decoding before matching
|
|
38
|
+
|
|
39
|
+
## Next
|
|
40
|
+
|
|
41
|
+
### Status at 08:42 IST, 30 Nov (final checkpoint of the overnight run)
|
|
42
|
+
- gpt-oss-20b judge run complete (docs/results_judge_20b.md); docs updated.
|
|
43
|
+
- gpt-oss-120b judge cache 322/729 (~100 verdicts per daily-quota refill on Groq's free tier;
|
|
44
|
+
~2 more days, or upgrade the Groq tier). Resume with the command below.
|
|
45
|
+
- Dev 95% recall / 3.0% FPR; 113 tests and CI green.
|
|
46
|
+
|
|
47
|
+
### For the autonomous sessions (in order)
|
|
48
|
+
1. LLM-judge evaluation: gpt-oss-20b done; continue gpt-oss-120b (command below), then add
|
|
49
|
+
its column next to the 20b results in README / error analysis / paper. Groq free tier = 200k tokens/day for gpt-oss-120b; the run
|
|
50
|
+
needs ~335k (725 unique tool texts). Each session, re-run and commit the cache:
|
|
51
|
+
GROQ_API_KEY=proxy-injected python bench/run_bench.py --split all \
|
|
52
|
+
--judge openai/gpt-oss-120b --out docs/results_judge.md
|
|
53
|
+
It prefills bench/judge_cache/openai_gpt-oss-120b.jsonl, stops cleanly on quota, and refuses
|
|
54
|
+
to write results if any judge call failed. When complete: add the judge column to README,
|
|
55
|
+
results, error analysis, paper and article drafts (label it post-freeze).
|
|
56
|
+
2. Possible further work, measured on dev only (test and red-team stay unread):
|
|
57
|
+
reversed-text fingerprints; a "parameter purpose mismatch" rule; more attack families
|
|
58
|
+
(rug_pull has no dev cases); coverage of approvals.py.
|
|
59
|
+
|
|
60
|
+
### Needs Mayank
|
|
61
|
+
- Push tags (cloud session can't): `git tag -a bench-freeze ba3c71f -m freeze`,
|
|
62
|
+
`git tag -a bench-freeze-2 c69015d -m freeze2`, `git push origin bench-freeze bench-freeze-2`
|
|
63
|
+
(also in docs/windows_quickstart.md).
|
|
64
|
+
- PyPI v0.1.0: add a trusted publisher on pypi.org (repo Agent-Gate, workflow release.yml,
|
|
65
|
+
environment pypi), then `git tag v0.1.0 && git push origin v0.1.0`.
|
|
66
|
+
- Held-out red-team cases from a friend (bench/redteam/README.md): the next clean measurement.
|
|
67
|
+
- Telegram approvals: set TELEGRAM_BOT_TOKEN / TELEGRAM_CHAT_ID to try it for real.
|
|
68
|
+
- scan-config paths for Claude Desktop / VS Code / Cursor / Windsurf: their docs weren't
|
|
69
|
+
reachable from the cloud session; Claude Code's are verified.
|
|
70
|
+
- Snyk Agent Scan comparison needs a SNYK_TOKEN.
|
|
71
|
+
- Demo video; review/rewrite docs/article_draft.md, docs/posts_draft.md, docs/paper_draft.md.
|