agent-security-gate-x402 1.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.
Files changed (39) hide show
  1. agent_security_gate_x402-1.1.0/.well-known/ap2.json +37 -0
  2. agent_security_gate_x402-1.1.0/LICENSE +21 -0
  3. agent_security_gate_x402-1.1.0/MANIFEST.in +10 -0
  4. agent_security_gate_x402-1.1.0/PKG-INFO +232 -0
  5. agent_security_gate_x402-1.1.0/README.md +196 -0
  6. agent_security_gate_x402-1.1.0/agent_security_gate_x402.egg-info/PKG-INFO +232 -0
  7. agent_security_gate_x402-1.1.0/agent_security_gate_x402.egg-info/SOURCES.txt +37 -0
  8. agent_security_gate_x402-1.1.0/agent_security_gate_x402.egg-info/dependency_links.txt +1 -0
  9. agent_security_gate_x402-1.1.0/agent_security_gate_x402.egg-info/entry_points.txt +4 -0
  10. agent_security_gate_x402-1.1.0/agent_security_gate_x402.egg-info/requires.txt +14 -0
  11. agent_security_gate_x402-1.1.0/agent_security_gate_x402.egg-info/top_level.txt +3 -0
  12. agent_security_gate_x402-1.1.0/app/__init__.py +2 -0
  13. agent_security_gate_x402-1.1.0/app/agrid_finance_legal.py +172 -0
  14. agent_security_gate_x402-1.1.0/app/enterprise_manager.py +90 -0
  15. agent_security_gate_x402-1.1.0/app/main.py +655 -0
  16. agent_security_gate_x402-1.1.0/app/multi_chain.py +56 -0
  17. agent_security_gate_x402-1.1.0/app/onchain_signer.py +124 -0
  18. agent_security_gate_x402-1.1.0/app/schemas.py +210 -0
  19. agent_security_gate_x402-1.1.0/app/security_engine.py +337 -0
  20. agent_security_gate_x402-1.1.0/app/static/index.html +903 -0
  21. agent_security_gate_x402-1.1.0/app/vault_manager.py +195 -0
  22. agent_security_gate_x402-1.1.0/app/x402_verifier.py +206 -0
  23. agent_security_gate_x402-1.1.0/contracts/AgentSecurityVault.sol +64 -0
  24. agent_security_gate_x402-1.1.0/contracts/SecurityGateConsumer.sol +99 -0
  25. agent_security_gate_x402-1.1.0/glama.json +39 -0
  26. agent_security_gate_x402-1.1.0/llms.txt +39 -0
  27. agent_security_gate_x402-1.1.0/mcp_server.py +276 -0
  28. agent_security_gate_x402-1.1.0/mcp_tool_spec.json +80 -0
  29. agent_security_gate_x402-1.1.0/pyproject.toml +81 -0
  30. agent_security_gate_x402-1.1.0/sdk/__init__.py +22 -0
  31. agent_security_gate_x402-1.1.0/sdk/agent_gate_sdk.py +340 -0
  32. agent_security_gate_x402-1.1.0/sdk/integrations.py +118 -0
  33. agent_security_gate_x402-1.1.0/setup.cfg +4 -0
  34. agent_security_gate_x402-1.1.0/tests/test_client.py +462 -0
  35. agent_security_gate_x402-1.1.0/tests/test_high_throughput_m2m.py +123 -0
  36. agent_security_gate_x402-1.1.0/tests/test_onchain_binding.py +76 -0
  37. agent_security_gate_x402-1.1.0/tests/test_phase1_upgrades.py +60 -0
  38. agent_security_gate_x402-1.1.0/tests/test_phase2_multichain.py +34 -0
  39. agent_security_gate_x402-1.1.0/tests/test_phase3_enterprise.py +52 -0
@@ -0,0 +1,37 @@
1
+ {
2
+ "protocol": "AP2/1.0",
3
+ "service": "Agent Output Security & Hallucination Gate",
4
+ "version": "1.0.0",
5
+ "description": "Deterministic, ultra-low latency (<10ms) security, prompt injection, secret key leak, dangerous AST code, and factual hallucination inspection micro-oracle for autonomous agents.",
6
+ "supported_rails": [
7
+ "x402-polygon-usdc"
8
+ ],
9
+ "pricing": {
10
+ "amount": "0.002",
11
+ "currency": "USDC",
12
+ "network": "polygon",
13
+ "chain_id": 137,
14
+ "asset_contract": "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359"
15
+ },
16
+ "capabilities": [
17
+ {
18
+ "action": "inspect_agent_output",
19
+ "endpoint": "/api/v1/inspect",
20
+ "method": "POST",
21
+ "description": "Ultra-low latency security, key leak, and factual hallucination validator for 0.002 USDC on Polygon."
22
+ },
23
+ {
24
+ "action": "mcp_tool_invoke",
25
+ "endpoint": "/mcp/invoke",
26
+ "method": "POST",
27
+ "description": "Direct JSON-RPC standard MCP tool dispatcher with x402 payment validation."
28
+ }
29
+ ],
30
+
31
+ "security_checks": [
32
+ "prompt_injection_guard",
33
+ "secret_private_key_leak_scanner",
34
+ "dangerous_ast_execution_guard",
35
+ "numerical_and_entity_faithfulness_nli"
36
+ ]
37
+ }
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 nohosa001-pixel
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,10 @@
1
+ include README.md
2
+ include LICENSE
3
+ include glama.json
4
+ include mcp_tool_spec.json
5
+ include llms.txt
6
+ recursive-include .well-known *
7
+ recursive-include app/static *
8
+ recursive-include contracts *
9
+ recursive-include sdk *
10
+ global-exclude *.py[cod] __pycache__ *.so
@@ -0,0 +1,232 @@
1
+ Metadata-Version: 2.4
2
+ Name: agent-security-gate-x402
3
+ Version: 1.1.0
4
+ Summary: Ultra-low latency (<10ms) deterministic security, prompt injection, secret leak, dangerous AST, and factual hallucination inspection micro-oracle for autonomous agents on Polygon, Base, and Arbitrum.
5
+ Author-email: Security Gate Team <developer@security-gate-x402.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/nohosa001-pixel/security-gate-x402
8
+ Project-URL: Repository, https://github.com/nohosa001-pixel/security-gate-x402
9
+ Keywords: ai-agents,security,guardrails,hallucination,x402,attestation,polygon,base,arbitrum,mcp,glama,fastapi
10
+ Classifier: Development Status :: 5 - Production/Stable
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Intended Audience :: Information Technology
13
+ Classifier: Topic :: Security
14
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Requires-Python: >=3.10
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: fastapi>=0.110.0
23
+ Requires-Dist: uvicorn>=0.28.0
24
+ Requires-Dist: pydantic>=2.6.0
25
+ Requires-Dist: pydantic-settings>=2.2.0
26
+ Requires-Dist: httpx>=0.27.0
27
+ Requires-Dist: web3>=6.15.0
28
+ Requires-Dist: eth-account>=0.11.0
29
+ Requires-Dist: cryptography>=42.0.0
30
+ Requires-Dist: python-dotenv>=1.0.1
31
+ Requires-Dist: mcp>=1.0.0
32
+ Provides-Extra: dev
33
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
34
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
35
+ Dynamic: license-file
36
+
37
+ # Agent Output Security & Hallucination Gate (`agent-security-gate-x402`) ๐Ÿ›ก๏ธโšก
38
+
39
+ [![PyPI Version](https://img.shields.io/pypi/v/agent-security-gate-x402.svg?color=blue&style=for-the-badge&logo=pypi&logoColor=white)](https://pypi.org/project/agent-security-gate-x402/)
40
+ [![Glama.ai](https://img.shields.io/badge/Glama.ai-Approved-00ffcc?style=for-the-badge&logo=anthropic&logoColor=black)](https://glama.ai/mcp/servers/nohosa001-pixel/agent-security-gate-x402)
41
+ [![Cloud Run](https://img.shields.io/badge/Google_Cloud_Run-Live_24%2F7-4285F4?style=for-the-badge&logo=googlecloud&logoColor=white)](https://agent-security-gate-x402-7qxtp3324q-du.a.run.app/)
42
+ [![Polygon Network](https://img.shields.io/badge/Polygon_USDC-x402_Settlement-8247E5?style=for-the-badge&logo=polygon&logoColor=white)](https://polygon.technology)
43
+ [![FastAPI](https://img.shields.io/badge/FastAPI-0.110+-green.svg)](https://fastapi.tiangolo.com)
44
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
45
+
46
+ > **Ultra-low latency (<10ms) deterministic security, prompt injection, secret key leak, dangerous AST code, and factual hallucination inspection micro-oracle with EIP-191 & EIP-712 cryptographic attestations on Polygon, Base, and Arbitrum.**
47
+
48
+ ---
49
+
50
+ ## ๐Ÿ–ฅ๏ธ Interactive Web Dashboard & Simulator (Live)
51
+
52
+ ๐ŸŒ **[https://agent-security-gate-x402-7qxtp3324q-du.a.run.app/](https://agent-security-gate-x402-7qxtp3324q-du.a.run.app/)**
53
+
54
+ Explore the full consumer and enterprise visual interface directly in your browser:
55
+ - ๐Ÿ›ก๏ธ **Prompt Injection & Jailbreak Radar**: Live testing against DAN prompts, system tag escapes, and adversarial suffixes.
56
+ - โšก **Dangerous AST Code Analyzer**: Sub-millisecond Python syntax parsing detecting `os.system`, `subprocess`, `eval`, `exec`, and malicious sockets.
57
+ - ๐Ÿ” **Hallucination & NLI Fact-Checker**: Contrast agent generation with ground truth context to surface fabricated numbers and unanchored claims.
58
+ - ๐Ÿ“œ **EIP-712 On-Chain Attestation & Calldata**: Instant generation of `v, r, s` ABI calldata for EVM smart contracts.
59
+ - ๐Ÿ“ก **Real-Time Security Event Stream**: Live WebSocket event feed of inspection audits.
60
+
61
+ ---
62
+
63
+ ## ๐Ÿ”— Live Service Links & Resources
64
+
65
+ | Service / Endpoint | Description | URL Link |
66
+ |---|---|---|
67
+ | ๐Ÿ–ฅ๏ธ **Web Dashboard** | Interactive visual UI, security simulator & audit tester | [Launch Dashboard](https://agent-security-gate-x402-7qxtp3324q-du.a.run.app/dashboard) |
68
+ | โšก **API Playground** | Browser-based interactive query sandbox | [Open Playground](https://agent-security-gate-x402-7qxtp3324q-du.a.run.app/playground) |
69
+ | ๐Ÿ›ก๏ธ **Live Inspection** | Core deterministic security & NLI hallucination check | [`/inspect`](https://agent-security-gate-x402-7qxtp3324q-du.a.run.app/inspect) |
70
+ | ๐Ÿ“œ **On-Chain Calldata** | EIP-712 smart contract attestation calldata endpoint | [`/api/v1/gate/attestation/onchain`](https://agent-security-gate-x402-7qxtp3324q-du.a.run.app/api/v1/gate/attestation/onchain) |
71
+ | ๐Ÿ“– **Swagger API Docs** | Full interactive OpenAPI documentation | [View Swagger Docs](https://agent-security-gate-x402-7qxtp3324q-du.a.run.app/docs) |
72
+ | ๐Ÿค– **LLM Agent Manifest** | Machine-readable tool specifications | [`/llms.txt`](https://agent-security-gate-x402-7qxtp3324q-du.a.run.app/llms.txt) |
73
+
74
+ ---
75
+
76
+ ## โšก 1-Click MCP Integration (Claude Desktop & Cursor)
77
+
78
+ Connect to Claude Desktop, Cursor, Gemini, or any Model Context Protocol client instantly:
79
+
80
+ ```json
81
+ {
82
+ "mcpServers": {
83
+ "security-gate-x402": {
84
+ "command": "uvx",
85
+ "args": ["agent-security-gate-x402"]
86
+ }
87
+ }
88
+ }
89
+ ```
90
+
91
+ ---
92
+
93
+ ## ๐Ÿ’Ž Core Services & Capabilities
94
+
95
+ ### 1. Ultra-Low Latency Prompt & Security Radar (<5ms)
96
+ Deterministic pattern and AST scanning neutralizing prompt injections, system tag breakouts (`</system_instruction>`), and API token / private key leakages before downstream agent propagation.
97
+
98
+ ### 2. Python Code AST Hazard Auditing
99
+ In-memory Python Abstract Syntax Tree (AST) inspection isolating hazardous invocations:
100
+ - System execution (`os.system`, `os.popen`, `subprocess.Popen`, `subprocess.run`)
101
+ - Arbitrary code evaluation (`eval`, `exec`, `__import__`)
102
+ - Network socket reverse shells and unencrypted exfiltration vectors.
103
+
104
+ ### 3. Factual Grounding & NLI Hallucination Verification
105
+ Compares LLM text claims against trusted source documents or ledger ground truths, outputting:
106
+ - Grounding ratio (0.0 to 1.0)
107
+ - Explicit list of fabricated numbers and ungrounded entities.
108
+
109
+ ### 4. Cryptographic Proof-of-Safety & Smart Contracts
110
+ - **EIP-191 Signatures**: Off-chain attestation receipts for agent-to-agent validation.
111
+ - **EIP-712 Typed Data & Solidity Calldata**: Native integration with [`SecurityGateConsumer.sol`](contracts/SecurityGateConsumer.sol) on Polygon (137), Base (8453), and Arbitrum (42161).
112
+
113
+ ---
114
+
115
+ ## ๐Ÿ“ฆ Quick Start & Installation
116
+
117
+ ### Option 1. Run Instantly with `uvx` (No Installation Required)
118
+
119
+ ```bash
120
+ # Run stdio MCP server directly for LLM clients
121
+ uvx agent-security-gate-x402
122
+ ```
123
+
124
+ ### Option 2. Install from PyPI
125
+
126
+ ```bash
127
+ pip install agent-security-gate-x402
128
+
129
+ # Run MCP server (stdio mode)
130
+ agent-security-gate
131
+
132
+ # Or launch interactive terminal tester
133
+ python test_interactive.py
134
+ ```
135
+
136
+ ### Option 3. Local Development Server
137
+
138
+ ```bash
139
+ git clone https://github.com/nohosa001-pixel/security-gate-x402.git
140
+ cd security-gate-x402
141
+ pip install -e .
142
+ uvicorn app.main:app --port 8000 --reload
143
+ ```
144
+
145
+ ---
146
+
147
+ ## ๐Ÿ“œ Smart Contract Integration (`SecurityGateConsumer.sol`)
148
+
149
+ Autonomous on-chain agents can verify security attestations directly in Solidity:
150
+
151
+ ```solidity
152
+ // SPDX-License-Identifier: MIT
153
+ pragma solidity ^0.8.20;
154
+
155
+ import "./contracts/SecurityGateConsumer.sol";
156
+
157
+ contract AutonomousAgentExecutor {
158
+ SecurityGateConsumer public immutable securityGate;
159
+
160
+ constructor(address _securityGateAddress) {
161
+ securityGate = SecurityGateConsumer(_securityGateAddress);
162
+ }
163
+
164
+ function executeGuardedAction(
165
+ bytes32 payloadHash,
166
+ uint8 riskScore,
167
+ string calldata verdict,
168
+ uint256 expiresAt,
169
+ uint8 v,
170
+ bytes32 r,
171
+ bytes32 s,
172
+ address target,
173
+ bytes calldata callData
174
+ ) external {
175
+ // Enforces max 10% risk score threshold and valid oracle signature
176
+ securityGate.verifyAndExecute(
177
+ payloadHash,
178
+ riskScore,
179
+ verdict,
180
+ expiresAt,
181
+ v,
182
+ r,
183
+ s,
184
+ target,
185
+ callData,
186
+ 10 // maxRiskScore
187
+ );
188
+ }
189
+ }
190
+ ```
191
+
192
+ ---
193
+
194
+ ## ๐Ÿงช Testing
195
+
196
+ Run the full pytest suite:
197
+
198
+ ```bash
199
+ pytest -v tests/
200
+ ```
201
+
202
+ Launch the interactive terminal tester:
203
+
204
+ ```bash
205
+ python test_interactive.py
206
+ ```
207
+
208
+ ---
209
+
210
+ ## ๐Ÿ“ข X (Twitter) Automated Promotion & Security Alert Bot
211
+
212
+ Launch the automated promotion and status broadcast bot:
213
+
214
+ ```bash
215
+ # Windows 1-Click launcher
216
+ .\x_promo_bot.bat
217
+
218
+ # Or run via Python directly
219
+ python x_promo_bot.py
220
+ ```
221
+
222
+ - ๐Ÿ‡ฐ๐Ÿ‡ท **Korean Thread**: Comprehensive showcase of security radars, AST parser, and Web UI.
223
+ - ๐ŸŒ **Global Launch Thread**: High-impact English launch announcement with 1-click test links.
224
+ - ๐Ÿ›ก๏ธ **Real-Time Security Bulletins**: Automated micro-oracle status and guardrail alerts.
225
+ - ๐Ÿค– **Dual Mode**: Direct X API v2 thread chaining (`requests_oauthlib`) or instant 1-click Web Intent browser launcher.
226
+
227
+ ---
228
+
229
+ ## ๐Ÿ“„ License
230
+
231
+ MIT License &copy; 2026 Security Gate Team
232
+
@@ -0,0 +1,196 @@
1
+ # Agent Output Security & Hallucination Gate (`agent-security-gate-x402`) ๐Ÿ›ก๏ธโšก
2
+
3
+ [![PyPI Version](https://img.shields.io/pypi/v/agent-security-gate-x402.svg?color=blue&style=for-the-badge&logo=pypi&logoColor=white)](https://pypi.org/project/agent-security-gate-x402/)
4
+ [![Glama.ai](https://img.shields.io/badge/Glama.ai-Approved-00ffcc?style=for-the-badge&logo=anthropic&logoColor=black)](https://glama.ai/mcp/servers/nohosa001-pixel/agent-security-gate-x402)
5
+ [![Cloud Run](https://img.shields.io/badge/Google_Cloud_Run-Live_24%2F7-4285F4?style=for-the-badge&logo=googlecloud&logoColor=white)](https://agent-security-gate-x402-7qxtp3324q-du.a.run.app/)
6
+ [![Polygon Network](https://img.shields.io/badge/Polygon_USDC-x402_Settlement-8247E5?style=for-the-badge&logo=polygon&logoColor=white)](https://polygon.technology)
7
+ [![FastAPI](https://img.shields.io/badge/FastAPI-0.110+-green.svg)](https://fastapi.tiangolo.com)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
9
+
10
+ > **Ultra-low latency (<10ms) deterministic security, prompt injection, secret key leak, dangerous AST code, and factual hallucination inspection micro-oracle with EIP-191 & EIP-712 cryptographic attestations on Polygon, Base, and Arbitrum.**
11
+
12
+ ---
13
+
14
+ ## ๐Ÿ–ฅ๏ธ Interactive Web Dashboard & Simulator (Live)
15
+
16
+ ๐ŸŒ **[https://agent-security-gate-x402-7qxtp3324q-du.a.run.app/](https://agent-security-gate-x402-7qxtp3324q-du.a.run.app/)**
17
+
18
+ Explore the full consumer and enterprise visual interface directly in your browser:
19
+ - ๐Ÿ›ก๏ธ **Prompt Injection & Jailbreak Radar**: Live testing against DAN prompts, system tag escapes, and adversarial suffixes.
20
+ - โšก **Dangerous AST Code Analyzer**: Sub-millisecond Python syntax parsing detecting `os.system`, `subprocess`, `eval`, `exec`, and malicious sockets.
21
+ - ๐Ÿ” **Hallucination & NLI Fact-Checker**: Contrast agent generation with ground truth context to surface fabricated numbers and unanchored claims.
22
+ - ๐Ÿ“œ **EIP-712 On-Chain Attestation & Calldata**: Instant generation of `v, r, s` ABI calldata for EVM smart contracts.
23
+ - ๐Ÿ“ก **Real-Time Security Event Stream**: Live WebSocket event feed of inspection audits.
24
+
25
+ ---
26
+
27
+ ## ๐Ÿ”— Live Service Links & Resources
28
+
29
+ | Service / Endpoint | Description | URL Link |
30
+ |---|---|---|
31
+ | ๐Ÿ–ฅ๏ธ **Web Dashboard** | Interactive visual UI, security simulator & audit tester | [Launch Dashboard](https://agent-security-gate-x402-7qxtp3324q-du.a.run.app/dashboard) |
32
+ | โšก **API Playground** | Browser-based interactive query sandbox | [Open Playground](https://agent-security-gate-x402-7qxtp3324q-du.a.run.app/playground) |
33
+ | ๐Ÿ›ก๏ธ **Live Inspection** | Core deterministic security & NLI hallucination check | [`/inspect`](https://agent-security-gate-x402-7qxtp3324q-du.a.run.app/inspect) |
34
+ | ๐Ÿ“œ **On-Chain Calldata** | EIP-712 smart contract attestation calldata endpoint | [`/api/v1/gate/attestation/onchain`](https://agent-security-gate-x402-7qxtp3324q-du.a.run.app/api/v1/gate/attestation/onchain) |
35
+ | ๐Ÿ“– **Swagger API Docs** | Full interactive OpenAPI documentation | [View Swagger Docs](https://agent-security-gate-x402-7qxtp3324q-du.a.run.app/docs) |
36
+ | ๐Ÿค– **LLM Agent Manifest** | Machine-readable tool specifications | [`/llms.txt`](https://agent-security-gate-x402-7qxtp3324q-du.a.run.app/llms.txt) |
37
+
38
+ ---
39
+
40
+ ## โšก 1-Click MCP Integration (Claude Desktop & Cursor)
41
+
42
+ Connect to Claude Desktop, Cursor, Gemini, or any Model Context Protocol client instantly:
43
+
44
+ ```json
45
+ {
46
+ "mcpServers": {
47
+ "security-gate-x402": {
48
+ "command": "uvx",
49
+ "args": ["agent-security-gate-x402"]
50
+ }
51
+ }
52
+ }
53
+ ```
54
+
55
+ ---
56
+
57
+ ## ๐Ÿ’Ž Core Services & Capabilities
58
+
59
+ ### 1. Ultra-Low Latency Prompt & Security Radar (<5ms)
60
+ Deterministic pattern and AST scanning neutralizing prompt injections, system tag breakouts (`</system_instruction>`), and API token / private key leakages before downstream agent propagation.
61
+
62
+ ### 2. Python Code AST Hazard Auditing
63
+ In-memory Python Abstract Syntax Tree (AST) inspection isolating hazardous invocations:
64
+ - System execution (`os.system`, `os.popen`, `subprocess.Popen`, `subprocess.run`)
65
+ - Arbitrary code evaluation (`eval`, `exec`, `__import__`)
66
+ - Network socket reverse shells and unencrypted exfiltration vectors.
67
+
68
+ ### 3. Factual Grounding & NLI Hallucination Verification
69
+ Compares LLM text claims against trusted source documents or ledger ground truths, outputting:
70
+ - Grounding ratio (0.0 to 1.0)
71
+ - Explicit list of fabricated numbers and ungrounded entities.
72
+
73
+ ### 4. Cryptographic Proof-of-Safety & Smart Contracts
74
+ - **EIP-191 Signatures**: Off-chain attestation receipts for agent-to-agent validation.
75
+ - **EIP-712 Typed Data & Solidity Calldata**: Native integration with [`SecurityGateConsumer.sol`](contracts/SecurityGateConsumer.sol) on Polygon (137), Base (8453), and Arbitrum (42161).
76
+
77
+ ---
78
+
79
+ ## ๐Ÿ“ฆ Quick Start & Installation
80
+
81
+ ### Option 1. Run Instantly with `uvx` (No Installation Required)
82
+
83
+ ```bash
84
+ # Run stdio MCP server directly for LLM clients
85
+ uvx agent-security-gate-x402
86
+ ```
87
+
88
+ ### Option 2. Install from PyPI
89
+
90
+ ```bash
91
+ pip install agent-security-gate-x402
92
+
93
+ # Run MCP server (stdio mode)
94
+ agent-security-gate
95
+
96
+ # Or launch interactive terminal tester
97
+ python test_interactive.py
98
+ ```
99
+
100
+ ### Option 3. Local Development Server
101
+
102
+ ```bash
103
+ git clone https://github.com/nohosa001-pixel/security-gate-x402.git
104
+ cd security-gate-x402
105
+ pip install -e .
106
+ uvicorn app.main:app --port 8000 --reload
107
+ ```
108
+
109
+ ---
110
+
111
+ ## ๐Ÿ“œ Smart Contract Integration (`SecurityGateConsumer.sol`)
112
+
113
+ Autonomous on-chain agents can verify security attestations directly in Solidity:
114
+
115
+ ```solidity
116
+ // SPDX-License-Identifier: MIT
117
+ pragma solidity ^0.8.20;
118
+
119
+ import "./contracts/SecurityGateConsumer.sol";
120
+
121
+ contract AutonomousAgentExecutor {
122
+ SecurityGateConsumer public immutable securityGate;
123
+
124
+ constructor(address _securityGateAddress) {
125
+ securityGate = SecurityGateConsumer(_securityGateAddress);
126
+ }
127
+
128
+ function executeGuardedAction(
129
+ bytes32 payloadHash,
130
+ uint8 riskScore,
131
+ string calldata verdict,
132
+ uint256 expiresAt,
133
+ uint8 v,
134
+ bytes32 r,
135
+ bytes32 s,
136
+ address target,
137
+ bytes calldata callData
138
+ ) external {
139
+ // Enforces max 10% risk score threshold and valid oracle signature
140
+ securityGate.verifyAndExecute(
141
+ payloadHash,
142
+ riskScore,
143
+ verdict,
144
+ expiresAt,
145
+ v,
146
+ r,
147
+ s,
148
+ target,
149
+ callData,
150
+ 10 // maxRiskScore
151
+ );
152
+ }
153
+ }
154
+ ```
155
+
156
+ ---
157
+
158
+ ## ๐Ÿงช Testing
159
+
160
+ Run the full pytest suite:
161
+
162
+ ```bash
163
+ pytest -v tests/
164
+ ```
165
+
166
+ Launch the interactive terminal tester:
167
+
168
+ ```bash
169
+ python test_interactive.py
170
+ ```
171
+
172
+ ---
173
+
174
+ ## ๐Ÿ“ข X (Twitter) Automated Promotion & Security Alert Bot
175
+
176
+ Launch the automated promotion and status broadcast bot:
177
+
178
+ ```bash
179
+ # Windows 1-Click launcher
180
+ .\x_promo_bot.bat
181
+
182
+ # Or run via Python directly
183
+ python x_promo_bot.py
184
+ ```
185
+
186
+ - ๐Ÿ‡ฐ๐Ÿ‡ท **Korean Thread**: Comprehensive showcase of security radars, AST parser, and Web UI.
187
+ - ๐ŸŒ **Global Launch Thread**: High-impact English launch announcement with 1-click test links.
188
+ - ๐Ÿ›ก๏ธ **Real-Time Security Bulletins**: Automated micro-oracle status and guardrail alerts.
189
+ - ๐Ÿค– **Dual Mode**: Direct X API v2 thread chaining (`requests_oauthlib`) or instant 1-click Web Intent browser launcher.
190
+
191
+ ---
192
+
193
+ ## ๐Ÿ“„ License
194
+
195
+ MIT License &copy; 2026 Security Gate Team
196
+