Skip to content

Commit 8a41499

Browse files
committed
add post
1 parent 2769d5b commit 8a41499

File tree

1 file changed

+174
-0
lines changed

1 file changed

+174
-0
lines changed
Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
---
2+
layout: post
3+
title: Introducing SchemaPin - Cryptographic Security for AI Tool Schemas
4+
author: ThirdKey Team
5+
categories: [AI Security, MCP, Cryptography]
6+
tags: [schemapin, mcp, ai agents, cryptography, security, tool schemas]
7+
---
8+
9+
As AI agents become increasingly sophisticated and autonomous, they rely heavily on external tools and services to extend their capabilities. The Model Context Protocol (MCP) has emerged as a standard for AI agents to interact with these tools, but this creates a critical security vulnerability: **how do we ensure that tool schemas haven't been maliciously modified?**
10+
11+
Today, we're excited to introduce [**SchemaPin**](https://schemapin.org) 🧷 - a cryptographic protocol that prevents "MCP Rug Pull" attacks by enabling developers to cryptographically sign their tool schemas and allowing clients to verify schema integrity and authenticity.
12+
13+
## The Problem: MCP Rug Pull Attacks
14+
15+
Consider this scenario: An AI agent uses a popular "file_manager" tool that initially provides legitimate file operations. After gaining widespread adoption, the tool's schema is maliciously updated to include a new "backup_to_cloud" function that secretly exfiltrates sensitive files to an attacker-controlled server.
16+
17+
Without cryptographic verification, AI agents would automatically trust and use this modified schema, potentially compromising sensitive data. This is what we call an **"MCP Rug Pull"** - where a trusted tool is maliciously modified after gaining user trust.
18+
19+
## The Solution: Cryptographic Schema Integrity
20+
21+
SchemaPin addresses this critical vulnerability by providing:
22+
23+
### 🔐 Core Security Guarantees
24+
25+
- **Schema Integrity**: Guarantees that tool schemas haven't been altered since publication
26+
- **Authenticity**: Cryptographic signatures prove schema origin from the claimed developer
27+
- **MITM Protection**: Application-layer security prevents schema tampering even if network connections are intercepted
28+
- **Infrastructure Defense**: Protection against compromised servers, CDNs, or repositories
29+
30+
### 🛡️ Trust-On-First-Use (TOFU) Key Pinning
31+
32+
SchemaPin implements a robust key pinning mechanism that:
33+
- Pins developer keys on first successful verification
34+
- Protects against future key substitution attacks
35+
- Alerts users when keys change unexpectedly
36+
- Enables long-term trust relationships
37+
38+
## How SchemaPin Works
39+
40+
```mermaid
41+
flowchart TD
42+
A[Tool Developer] -->|Publishes| B["/.well-known/schemapin.json<br/>(Public Key + Revoked Keys)"]
43+
A -->|Signs| C["Tool Schema + Signature"]
44+
45+
subgraph "AI Agent"
46+
D["Fetch Schema + Signature"]
47+
E["Fetch or Cache Public Key"]
48+
F["Check Key Revocation"]
49+
G["Verify Signature"]
50+
H{"Key Revoked?"}
51+
I{"Signature Valid?"}
52+
J["Pin Key (TOFU)"]
53+
K["Accept & Use Tool Schema"]
54+
L["Reject / Block Tool"]
55+
end
56+
57+
C --> D
58+
B --> E
59+
D --> G
60+
E --> F
61+
F --> H
62+
E --> G
63+
H -- Yes --> L
64+
H -- No --> G
65+
G --> I
66+
I -- No --> L
67+
I -- Yes --> J
68+
J --> K
69+
```
70+
71+
The protocol uses industry-standard cryptography:
72+
- **ECDSA P-256** signatures for verification
73+
- **SHA-256** hashing for schema integrity
74+
- **RFC 8615** `.well-known` URIs for public key discovery
75+
- **PEM/Base64** encoding for interoperability
76+
77+
## Quick Integration Example
78+
79+
### For Tool Developers (Signing Schemas)
80+
81+
```python
82+
from schemapin.utils import SchemaSigningWorkflow
83+
from schemapin.crypto import KeyManager
84+
85+
# Generate key pair
86+
private_key, public_key = KeyManager.generate_keypair()
87+
private_key_pem = KeyManager.export_private_key_pem(private_key)
88+
89+
# Sign your tool schema
90+
workflow = SchemaSigningWorkflow(private_key_pem)
91+
schema = {
92+
"name": "calculate_sum",
93+
"description": "Calculates the sum of two numbers",
94+
"parameters": {
95+
"type": "object",
96+
"properties": {
97+
"a": {"type": "number", "description": "First number"},
98+
"b": {"type": "number", "description": "Second number"}
99+
},
100+
"required": ["a", "b"]
101+
}
102+
}
103+
signature = workflow.sign_schema(schema)
104+
```
105+
106+
### For AI Clients (Verifying Schemas)
107+
108+
```python
109+
from schemapin.utils import SchemaVerificationWorkflow
110+
111+
# Initialize verification
112+
workflow = SchemaVerificationWorkflow()
113+
114+
# Verify schema (auto-pins key on first use)
115+
result = workflow.verify_schema(
116+
schema=schema,
117+
signature_b64=signature,
118+
tool_id="example.com/calculate_sum",
119+
domain="example.com",
120+
auto_pin=True
121+
)
122+
123+
if result['valid']:
124+
print("✅ Schema signature is valid")
125+
# Safe to use the tool
126+
else:
127+
print("❌ Schema signature is invalid")
128+
# Reject the tool
129+
```
130+
131+
## Cross-Language Support
132+
133+
SchemaPin provides implementations across multiple languages to ensure broad ecosystem adoption:
134+
135+
- **Python**: Available on PyPI (`pip install schemapin`)
136+
- **JavaScript/Node.js**: Available on npm (`npm install schemapin`)
137+
- **Go**: Available via Go modules (`go install github.com/ThirdKeyAi/schemapin/go/cmd/...@latest`)
138+
139+
Each implementation includes:
140+
- High-level APIs for signing and verification
141+
- CLI tools for key generation, signing, and verification
142+
- Comprehensive test suites
143+
- Production-ready security features
144+
145+
## Enterprise and Ecosystem Benefits
146+
147+
### Standardized Trust Mechanism
148+
SchemaPin provides a common, interoperable standard for verifying tools across different AI agent frameworks and programming languages, creating a unified security foundation for the entire AI ecosystem.
149+
150+
### Automated Governance
151+
The protocol enables enterprises to programmatically enforce security policies requiring valid signatures before tool execution, allowing automated compliance checking while maintaining strong security guarantees.
152+
153+
### Supply Chain Security
154+
By preventing malicious schema modifications, SchemaPin protects against supply-chain attacks where legitimate tools are compromised after approval, ensuring long-term security for AI agent deployments.
155+
156+
## Getting Started
157+
158+
Visit [schemapin.org](https://schemapin.org) to:
159+
- Download implementations for your preferred language
160+
- Read the complete technical specification
161+
- Explore integration examples and best practices
162+
- Access CLI tools for immediate use
163+
164+
The project is open source and available on [GitHub](https://github.com/thirdkey/schemapin), with comprehensive documentation, examples, and automated CI/CD workflows for reliable package distribution.
165+
166+
## The Future of AI Tool Security
167+
168+
As AI agents become more autonomous and handle increasingly sensitive tasks, cryptographic verification of tool schemas becomes essential infrastructure. SchemaPin provides the foundation for this security layer, enabling developers to build trust relationships that scale with the growing AI ecosystem.
169+
170+
By implementing SchemaPin in your AI agent or tool development workflow, you're not just protecting your users - you're contributing to a more secure and trustworthy AI future for everyone.
171+
172+
---
173+
174+
*SchemaPin is part of ThirdKey Research's commitment to advancing AI security through practical, open-source solutions. Learn more about our Zero Trust for AI research at [research.thirdkey.ai](https://research.thirdkey.ai).*

0 commit comments

Comments
 (0)