correctover-runtime-guard 1.0.0__tar.gz → 1.1.2__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.
@@ -0,0 +1,8 @@
1
+ {
2
+ "mcpServers": {
3
+ "correctover-runtime-guard": {
4
+ "command": "correctover-runtime-guard",
5
+ "args": ["start", "--format", "json"]
6
+ }
7
+ }
8
+ }
@@ -0,0 +1,78 @@
1
+ Metadata-Version: 2.4
2
+ Name: correctover-runtime-guard
3
+ Version: 1.1.2
4
+ Summary: Real-time RCE/SSRF/credential leak interception for AI agents — 22µs P50, 99.7% detection rate. MCP Server mode with diagnose_error, fault patterns, repair suggestions.
5
+ Project-URL: Homepage, https://correctover.com
6
+ Project-URL: Repository, https://github.com/Correctover/runtime-guard
7
+ Project-URL: Issues, https://github.com/Correctover/runtime-guard/issues
8
+ Author-email: Correctover <wangguigui@correctover.com>
9
+ License: Apache-2.0
10
+ Keywords: ai-agent,correctover,credential-leak,guardrail,interception,mcp,rce,real-time,runtime-guard,security,ssrf
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Topic :: Security
17
+ Requires-Python: >=3.11
18
+ Requires-Dist: click>=8.0
19
+ Requires-Dist: fastmcp>=2.0
20
+ Provides-Extra: dev
21
+ Requires-Dist: pytest>=7.0; extra == 'dev'
22
+ Description-Content-Type: text/markdown
23
+
24
+ # 🛡️ correctover-runtime-guard
25
+
26
+ **Real-time RCE/SSRF/Env Leak interception — 22µs P50.**
27
+
28
+ [![PyPI version](https://img.shields.io/pypi/v/correctover-runtime-guard.svg)](https://pypi.org/project/correctover-runtime-guard/)
29
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
30
+ [![License: Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-green.svg)](https://opensource.org/licenses/Apache-2.0)
31
+
32
+ ## Quick Start
33
+
34
+ ```bash
35
+ pip install correctover-runtime-guard
36
+ correctover-runtime-guard start
37
+ ```
38
+
39
+ ## What It Does
40
+
41
+ Runtime guardrail for AI Agent tool calls — intercepts before execution:
42
+
43
+ - **RCE interception** (CWE-78) — command injection in tool arguments
44
+ - **SSRF blocking** (CWE-918) — metadata endpoint access, internal port scanning
45
+ - **Env leak prevention** (CWE-200) — `AWS_SECRET_ACCESS_KEY`, `OPENAI_API_KEY` exfiltration
46
+ - **MCP Server mode** — `diagnose_error` / `get_fault_pattern` / `get_repair_suggestion`
47
+
48
+ ### Performance
49
+
50
+ | Metric | Value |
51
+ |--------|-------|
52
+ | P50 latency | 22µs |
53
+ | P99 latency | 89µs |
54
+ | Overhead | <0.01% |
55
+ | Detection rate | 99.7% |
56
+
57
+ ## Free Tier
58
+
59
+ 50 interceptions/day — no credit card required.
60
+
61
+ Enterprise: $1,999/month — [correctover.com/checkout](https://correctover.com/checkout)
62
+
63
+ ```bash
64
+ export CORRECTOVER_LICENSE_KEY=your-key-here
65
+ ```
66
+
67
+ ## Related Correctover Tools
68
+
69
+ | Tool | Install | Description |
70
+ |------|---------|-------------|
71
+ | **Security Scanner** | `npx correctover-scan` | MCP config security audit (14 checks) |
72
+ | **Self-Healing Test** | `pip install correctover-test` | Agent self-healing test suite |
73
+ | **Vulnerability Scan** | `pip install correctover-security-audit` | 215 fault type scanner |
74
+ | **Compliance Check** | `pip install correctover-compliance-check` | OAuth 2.1 + CCS v1.0 |
75
+ | **Runtime Guard** | `pip install correctover-runtime-guard` | 22µs RCE/SSRF interception |
76
+ | **MCP Server** | `npm install correctover-mcp-server` | 6-dimension validation |
77
+
78
+ **Website**: [correctover.com](https://correctover.com) · **GitHub**: [github.com/Correctover](https://github.com/Correctover)
@@ -0,0 +1,55 @@
1
+ # 🛡️ correctover-runtime-guard
2
+
3
+ **Real-time RCE/SSRF/Env Leak interception — 22µs P50.**
4
+
5
+ [![PyPI version](https://img.shields.io/pypi/v/correctover-runtime-guard.svg)](https://pypi.org/project/correctover-runtime-guard/)
6
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
7
+ [![License: Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-green.svg)](https://opensource.org/licenses/Apache-2.0)
8
+
9
+ ## Quick Start
10
+
11
+ ```bash
12
+ pip install correctover-runtime-guard
13
+ correctover-runtime-guard start
14
+ ```
15
+
16
+ ## What It Does
17
+
18
+ Runtime guardrail for AI Agent tool calls — intercepts before execution:
19
+
20
+ - **RCE interception** (CWE-78) — command injection in tool arguments
21
+ - **SSRF blocking** (CWE-918) — metadata endpoint access, internal port scanning
22
+ - **Env leak prevention** (CWE-200) — `AWS_SECRET_ACCESS_KEY`, `OPENAI_API_KEY` exfiltration
23
+ - **MCP Server mode** — `diagnose_error` / `get_fault_pattern` / `get_repair_suggestion`
24
+
25
+ ### Performance
26
+
27
+ | Metric | Value |
28
+ |--------|-------|
29
+ | P50 latency | 22µs |
30
+ | P99 latency | 89µs |
31
+ | Overhead | <0.01% |
32
+ | Detection rate | 99.7% |
33
+
34
+ ## Free Tier
35
+
36
+ 50 interceptions/day — no credit card required.
37
+
38
+ Enterprise: $1,999/month — [correctover.com/checkout](https://correctover.com/checkout)
39
+
40
+ ```bash
41
+ export CORRECTOVER_LICENSE_KEY=your-key-here
42
+ ```
43
+
44
+ ## Related Correctover Tools
45
+
46
+ | Tool | Install | Description |
47
+ |------|---------|-------------|
48
+ | **Security Scanner** | `npx correctover-scan` | MCP config security audit (14 checks) |
49
+ | **Self-Healing Test** | `pip install correctover-test` | Agent self-healing test suite |
50
+ | **Vulnerability Scan** | `pip install correctover-security-audit` | 215 fault type scanner |
51
+ | **Compliance Check** | `pip install correctover-compliance-check` | OAuth 2.1 + CCS v1.0 |
52
+ | **Runtime Guard** | `pip install correctover-runtime-guard` | 22µs RCE/SSRF interception |
53
+ | **MCP Server** | `npm install correctover-mcp-server` | 6-dimension validation |
54
+
55
+ **Website**: [correctover.com](https://correctover.com) · **GitHub**: [github.com/Correctover](https://github.com/Correctover)
@@ -14,9 +14,10 @@ from typing import Optional
14
14
  import click
15
15
 
16
16
  from .guard import RuntimeGuard, FAULT_PATTERNS
17
+ from .license import LicenseValidator, check_and_record, LicenseExceededError
17
18
 
18
- VERSION = "1.0.0"
19
- CTA_URL = "https://correctover.com"
19
+ VERSION = "1.1.0"
20
+ CTA_URL = "https://correctover.com/checkout"
20
21
  PRICING = "$1,999/month (Enterprise)"
21
22
  LATENCY_P50 = "22µs"
22
23
 
@@ -38,6 +39,19 @@ def cli():
38
39
  @click.option("--port", default=8080, help="Port for SSE/HTTP transport")
39
40
  def start(transport: str, host: str, port: int):
40
41
  """Start the Runtime Guard MCP server."""
42
+ # License check
43
+ license_key = LicenseValidator.get_license_from_env()
44
+ validator = LicenseValidator("correctover-runtime-guard")
45
+ if license_key:
46
+ validator.set_license_key(license_key)
47
+ status = validator.record_call()
48
+ tier = status.get('tier', 'free')
49
+ remaining = status.get('calls_remaining', 0)
50
+ if tier == 'free':
51
+ click.echo('Free tier: {} calls remaining today ({}/{})'.format(remaining, status['calls_today'], validator.FREE_LIMIT_PER_DAY), err=True)
52
+ click.echo(' Upgrade: https://correctover.com/checkout', err=True)
53
+ elif tier == 'pro':
54
+ click.echo('Pro license active - unlimited calls', err=True)
41
55
  GREEN = "\033[92m"
42
56
  CYAN = "\033[96m"
43
57
  BOLD = "\033[1m"
@@ -0,0 +1,199 @@
1
+ """
2
+ License validator — enforces free tier limits (50 audits/day).
3
+ Embedded in all Correctover Agent products.
4
+ """
5
+
6
+ import hashlib
7
+ import json
8
+ import os
9
+ import time
10
+ from pathlib import Path
11
+ from typing import Dict, Optional
12
+
13
+
14
+ class LicenseValidator:
15
+ """Enforces usage limits for Correctover Agent products."""
16
+
17
+ FREE_LIMIT_PER_DAY = 50
18
+ STATE_FILE = Path.home() / ".correctover" / "license.json"
19
+
20
+ def __init__(self, product: str):
21
+ self.product = product
22
+ self.state = self._load_state()
23
+
24
+ def _load_state(self) -> Dict:
25
+ if self.STATE_FILE.exists():
26
+ try:
27
+ return json.loads(self.STATE_FILE.read_text())
28
+ except (json.JSONDecodeError, OSError):
29
+ pass
30
+ return {"products": {}, "license_key": None, "installed_at": time.time()}
31
+
32
+ def _save_state(self) -> None:
33
+ self.STATE_FILE.parent.mkdir(parents=True, exist_ok=True)
34
+ self.STATE_FILE.write_text(json.dumps(self.state, indent=2))
35
+
36
+ def _get_product_state(self) -> Dict:
37
+ return self.state["products"].setdefault(self.product, {
38
+ "calls_today": 0,
39
+ "date": time.strftime("%Y-%m-%d"),
40
+ "total_calls": 0,
41
+ })
42
+
43
+ def check_license(self) -> Dict:
44
+ """Check if the current usage is within limits. Returns status dict."""
45
+ today = time.strftime("%Y-%m-%d")
46
+ ps = self._get_product_state()
47
+
48
+ # Reset daily counter if it's a new day
49
+ if ps.get("date") != today:
50
+ ps["calls_today"] = 0
51
+ ps["date"] = today
52
+
53
+ license_key = self.state.get("license_key")
54
+ has_license = bool(license_key)
55
+
56
+ if has_license:
57
+ # Pro/Enterprise — no limits
58
+ return {
59
+ "authorized": True,
60
+ "tier": "pro" if self._verify_license_key(license_key) else "free",
61
+ "calls_remaining": float("inf"),
62
+ "calls_today": ps["calls_today"],
63
+ "limit": float("inf"),
64
+ "license_key": license_key[:8] + "..." if license_key else None,
65
+ }
66
+
67
+ # Free tier
68
+ remaining = max(0, self.FREE_LIMIT_PER_DAY - ps["calls_today"])
69
+ return {
70
+ "authorized": remaining > 0,
71
+ "tier": "free",
72
+ "calls_remaining": remaining,
73
+ "calls_today": ps["calls_today"],
74
+ "limit": self.FREE_LIMIT_PER_DAY,
75
+ "license_key": None,
76
+ }
77
+
78
+ def record_call(self) -> Dict:
79
+ """Record a single API call. Returns updated status."""
80
+ status = self.check_license()
81
+ if not status["authorized"]:
82
+ return status
83
+
84
+ ps = self._get_product_state()
85
+ ps["calls_today"] += 1
86
+ ps["total_calls"] = ps.get("total_calls", 0) + 1
87
+ self._save_state()
88
+
89
+ status["calls_remaining"] = max(0, status["limit"] - ps["calls_today"])
90
+ status["calls_today"] = ps["calls_today"]
91
+ return status
92
+
93
+ def set_license_key(self, key: str) -> bool:
94
+ """Set and validate a license key.
95
+
96
+ Supports two formats:
97
+
98
+ * **COV-<product>-<hash>** — Cloud-issued, HMAC-verified offline.
99
+ * **CV-TRL-<base64>** / **CV-PRO-<base64>** — FC-issued (XunhuPay),
100
+ base64 payload containing JWT-like signed claims. Accepted as valid
101
+ when the payload decodes cleanly (the real verification happens
102
+ server-side in the FC callback).
103
+ """
104
+ if self._verify_license_key(key):
105
+ self.state["license_key"] = key
106
+ self._save_state()
107
+ return True
108
+ return False
109
+
110
+ def _verify_license_key(self, key: str) -> bool:
111
+ """Validate a license key against supported formats."""
112
+ if not key or len(key) < 12:
113
+ return False
114
+
115
+ # ── COV-<product>-<hash> (Cloud / HMAC offline) ──
116
+ if key.startswith("COV-"):
117
+ parts = key.split("-")
118
+ if len(parts) < 3:
119
+ return False
120
+ product_code = "-".join(parts[1:-1])
121
+ expected_prefix = self._compute_key_prefix(product_code)
122
+ return parts[-1].startswith(expected_prefix)
123
+
124
+ # ── CV-TRL-<base64> / CV-PRO-<base64> (FC / XunhuPay) ──
125
+ # Format: CV-{TRL|PRO}-{urlsafe_b64(json_claims)}.{urlsafe_b64(hmac)}
126
+ if key.startswith("CV-"):
127
+ parts = key.split("-", 2)
128
+ if len(parts) < 3:
129
+ return False
130
+ import base64 as _b64
131
+ try:
132
+ payload = parts[2]
133
+ # The payload is "<b64_claims>.<b64_sig>" — decode the claims part
134
+ dot = payload.find(".")
135
+ if dot > 0:
136
+ b64_claims = payload[:dot]
137
+ else:
138
+ b64_claims = payload
139
+ padded = b64_claims + "=" * (4 - len(b64_claims) % 4) if len(b64_claims) % 4 else b64_claims
140
+ decoded = _b64.urlsafe_b64decode(padded)
141
+ return b"@" in decoded or len(decoded) > 10
142
+ except Exception:
143
+ return False
144
+
145
+ return False
146
+
147
+ def _compute_key_prefix(self, product_code: str) -> str:
148
+ secret = f"correctover-{product_code}-2026"
149
+ return hashlib.sha256(secret.encode()).hexdigest()[:12]
150
+
151
+ def get_upgrade_message(self) -> str:
152
+ """Return the appropriate upgrade CTA."""
153
+ status = self.check_license()
154
+ if status["tier"] == "free":
155
+ remaining = status["calls_remaining"]
156
+ if remaining <= 0:
157
+ return (
158
+ f"\n🚫 Free tier limit reached ({self.FREE_LIMIT_PER_DAY} audits/day).\n"
159
+ f" Upgrade to Pro for unlimited audits: https://correctover.com/checkout\n"
160
+ f" Or set your license key: export CORRECTOVER_LICENSE_KEY=<your-key>\n"
161
+ )
162
+ return (
163
+ f"\n📊 Free tier: {remaining} audits remaining today.\n"
164
+ f" Upgrade to Pro: https://correctover.com/checkout\n"
165
+ )
166
+ return ""
167
+
168
+ @staticmethod
169
+ def get_license_from_env() -> Optional[str]:
170
+ return os.environ.get("CORRECTOVER_LICENSE_KEY")
171
+
172
+
173
+ # Global singleton
174
+ _validators: Dict[str, LicenseValidator] = {}
175
+
176
+
177
+ def get_validator(product: str = "correctover-test") -> LicenseValidator:
178
+ if product not in _validators:
179
+ _validators[product] = LicenseValidator(product)
180
+ return _validators[product]
181
+
182
+
183
+ def check_and_record(product: str = "correctover-test") -> Dict:
184
+ """Check license, record call, return status. Raise if over limit."""
185
+ v = get_validator(product)
186
+ status = v.check_license()
187
+
188
+ if not status["authorized"]:
189
+ msg = v.get_upgrade_message()
190
+ raise LicenseExceededError(
191
+ f"Free tier limit ({v.FREE_LIMIT_PER_DAY}/day) exceeded. {msg}"
192
+ )
193
+
194
+ return v.record_call()
195
+
196
+
197
+ class LicenseExceededError(Exception):
198
+ """Raised when free tier limit is exceeded."""
199
+ pass
@@ -0,0 +1,15 @@
1
+ {
2
+ "$schema": "https://glama.ai/schema/glama.json",
3
+ "name": "correctover-runtime-guard",
4
+ "displayName": "Correctover Runtime Guard — Real-time RCE/SSRF/Env Leak Interception",
5
+ "description": "Runtime guardrail for AI Agent tool calls. Intercept RCE, SSRF, and environment variable leaks at 22µs P50. MCP Server mode with diagnose_error, get_fault_pattern, and get_repair_suggestion tools.",
6
+ "homepage": "https://correctover.com/agents/runtime-guard",
7
+ "category": "Security",
8
+ "license": "Apache-2.0",
9
+ "tags": ["runtime", "guard", "rce", "ssrf", "env-leak", "mcp", "agent-security", "correctover", "guardrail"],
10
+ "pricing": {
11
+ "model": "freemium",
12
+ "description": "Enterprise $1,999/mo. Free: 1,500 calls/month (50/day).",
13
+ "free_tier": "1,500 calls/month (50/day)"
14
+ }
15
+ }
@@ -4,11 +4,12 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "correctover-runtime-guard"
7
- version = "1.0.0"
8
- description = "Runtime RCE/SSRF/Env leak interception — 22µs P50 via correctover GuardrailProvider"
7
+ version = "1.1.2"
8
+ description = "Real-time RCE/SSRF/credential leak interception for AI agents — 22µs P50, 99.7% detection rate. MCP Server mode with diagnose_error, fault patterns, repair suggestions."
9
+ readme = "README.md"
9
10
  license = { text = "Apache-2.0" }
10
11
  authors = [{ name = "Correctover", email = "wangguigui@correctover.com" }]
11
- keywords = ["runtime", "guard", "rce", "ssrf", "env-leak", "mcp", "correctover", "security"]
12
+ keywords = ["runtime-guard", "rce", "ssrf", "credential-leak", "mcp", "ai-agent", "correctover", "security", "guardrail", "interception", "real-time"]
12
13
  classifiers = [
13
14
  "Development Status :: 4 - Beta",
14
15
  "Intended Audience :: Developers",
@@ -0,0 +1,5 @@
1
+ name: correctover-runtime-guard
2
+ description: Runtime RCE/SSRF/Env leak interception — 22µs P50 via GuardrailProvider
3
+ version: 1.0.0
4
+ runtime: python
5
+ entry: correctover-runtime-guard
@@ -1,21 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: correctover-runtime-guard
3
- Version: 1.0.0
4
- Summary: Runtime RCE/SSRF/Env leak interception — 22µs P50 via correctover GuardrailProvider
5
- Project-URL: Homepage, https://correctover.com
6
- Project-URL: Repository, https://github.com/Correctover/runtime-guard
7
- Project-URL: Issues, https://github.com/Correctover/runtime-guard/issues
8
- Author-email: Correctover <wangguigui@correctover.com>
9
- License: Apache-2.0
10
- Keywords: correctover,env-leak,guard,mcp,rce,runtime,security,ssrf
11
- Classifier: Development Status :: 4 - Beta
12
- Classifier: Intended Audience :: Developers
13
- Classifier: License :: OSI Approved :: Apache Software License
14
- Classifier: Programming Language :: Python :: 3.11
15
- Classifier: Programming Language :: Python :: 3.12
16
- Classifier: Topic :: Security
17
- Requires-Python: >=3.11
18
- Requires-Dist: click>=8.0
19
- Requires-Dist: fastmcp>=2.0
20
- Provides-Extra: dev
21
- Requires-Dist: pytest>=7.0; extra == 'dev'
@@ -1,18 +0,0 @@
1
- # 🛡️ correctover-runtime-guard
2
-
3
- **Real-time RCE/SSRF/Env Leak interception — 22µs P50.**
4
-
5
- ```bash
6
- pip install correctover-runtime-guard
7
- correctover-runtime-guard start
8
- ```
9
-
10
- Runtime guardrail for AI Agent tool calls:
11
- - Intercept RCE attempts (CWE-78)
12
- - Block SSRF attacks (CWE-918)
13
- - Prevent environment variable leaks (CWE-200)
14
- - MCP Server mode: diagnose_error / get_fault_pattern / get_repair_suggestion
15
-
16
- **Pricing**: $1,999/month Enterprise
17
-
18
- [Deploy now → correctover.com](https://correctover.com)