gatekeep-mcp 0.2.0__py3-none-any.whl
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.
- gatekeep/__init__.py +135 -0
- gatekeep/__main__.py +6 -0
- gatekeep/cli.py +5 -0
- gatekeep/control_plane.py +1043 -0
- gatekeep/decorator.py +137 -0
- gatekeep/gate.py +1816 -0
- gatekeep/ledger.py +1021 -0
- gatekeep/mcp/__init__.py +51 -0
- gatekeep/mcp/__main__.py +8 -0
- gatekeep/mcp/cli.py +603 -0
- gatekeep/mcp/http_server.py +1696 -0
- gatekeep/mcp/onboarding.py +583 -0
- gatekeep/mcp/proxy.py +1858 -0
- gatekeep/middleware.py +359 -0
- gatekeep/persistence.py +1688 -0
- gatekeep/policy.py +260 -0
- gatekeep/redaction.py +206 -0
- gatekeep/registry.py +314 -0
- gatekeep/saga.py +609 -0
- gatekeep/security.py +536 -0
- gatekeep_mcp-0.2.0.dist-info/METADATA +245 -0
- gatekeep_mcp-0.2.0.dist-info/RECORD +27 -0
- gatekeep_mcp-0.2.0.dist-info/WHEEL +5 -0
- gatekeep_mcp-0.2.0.dist-info/entry_points.txt +2 -0
- gatekeep_mcp-0.2.0.dist-info/licenses/LICENSE-APACHE +172 -0
- gatekeep_mcp-0.2.0.dist-info/licenses/LICENSE-MIT +21 -0
- gatekeep_mcp-0.2.0.dist-info/top_level.txt +1 -0
gatekeep/__init__.py
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Gatekeep — Zero-Dependency Pre-Execution Firewall & Saga Proxy for MCP AI Agents.
|
|
3
|
+
|
|
4
|
+
Deterministic sub-millisecond protection for tool-calling AI agents:
|
|
5
|
+
- Causal entity provenance & indirect prompt injection (IPI) taint tracking
|
|
6
|
+
- Outbound secret/PII DLP, SSRF/DNS-rebinding, sensitive path & SQL/shell guards
|
|
7
|
+
- Durable MCP tool poisoning & mid-session rug-pull schema pinning
|
|
8
|
+
- Sliding rate limits & atomic cross-session cumulative spend caps
|
|
9
|
+
- Automatic LIFO Saga compensation rollback & Idempotency-Key deduplication
|
|
10
|
+
- Dual-control RBAC/SoD human approvals & SHA-256 hash-chained AuditVault
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
|
|
15
|
+
__version__ = "0.2.0"
|
|
16
|
+
|
|
17
|
+
from gatekeep.control_plane import (
|
|
18
|
+
AuditVault,
|
|
19
|
+
CentralPolicyRegistry,
|
|
20
|
+
EscalationRouter,
|
|
21
|
+
EscalationTicket,
|
|
22
|
+
SagaRecoveryDaemon,
|
|
23
|
+
SweepReport,
|
|
24
|
+
ToolPolicySpec,
|
|
25
|
+
WebhookEscalationNotifier,
|
|
26
|
+
resolve_effective_tool,
|
|
27
|
+
)
|
|
28
|
+
from gatekeep.decorator import gatekeep_tool, slim_tool
|
|
29
|
+
from gatekeep.gate import AuditReceipt, GateDecision, PreExecutionGate, Verdict
|
|
30
|
+
from gatekeep.ledger import LedgerEntry, ToolReturnLedger
|
|
31
|
+
from gatekeep.mcp.http_server import (
|
|
32
|
+
ApiPrincipal,
|
|
33
|
+
AuthContext,
|
|
34
|
+
MCPHttpGateway,
|
|
35
|
+
parse_api_principals,
|
|
36
|
+
serve_http,
|
|
37
|
+
)
|
|
38
|
+
from gatekeep.mcp.onboarding import (
|
|
39
|
+
generate_starter_policy,
|
|
40
|
+
simulate_policy_against_traces,
|
|
41
|
+
synthesize_policies_from_store,
|
|
42
|
+
)
|
|
43
|
+
from gatekeep.mcp.proxy import (
|
|
44
|
+
AsyncCallableMCPUpstream,
|
|
45
|
+
CallableMCPUpstream,
|
|
46
|
+
HttpMCPUpstream,
|
|
47
|
+
MCPTransactionProxy,
|
|
48
|
+
MCPUpstream,
|
|
49
|
+
RegistryMCPUpstream,
|
|
50
|
+
StdioMCPUpstream,
|
|
51
|
+
)
|
|
52
|
+
from gatekeep.middleware import GatekeepMiddleware, GatekeepPolicyError
|
|
53
|
+
from gatekeep.persistence import (
|
|
54
|
+
ConcurrencyConflictError,
|
|
55
|
+
InMemorySessionStore,
|
|
56
|
+
PostgresSessionStore,
|
|
57
|
+
RedisSessionStore,
|
|
58
|
+
SQLiteSessionStore,
|
|
59
|
+
SessionStateStore,
|
|
60
|
+
)
|
|
61
|
+
from gatekeep.policy import PolicySyntaxError, SafePolicyEvaluator, evaluate_declarative_policy
|
|
62
|
+
from gatekeep.redaction import (
|
|
63
|
+
DEFAULT_SENSITIVE_KEYS,
|
|
64
|
+
SensitiveDataRedactor,
|
|
65
|
+
canonical_action_fingerprint,
|
|
66
|
+
hash_secret_token,
|
|
67
|
+
)
|
|
68
|
+
from gatekeep.registry import ToolDefinition, ToolRegistry
|
|
69
|
+
from gatekeep.saga import RollbackSummary, SagaCoordinator, SagaStep
|
|
70
|
+
from gatekeep.security import (
|
|
71
|
+
compute_tool_schema_hash,
|
|
72
|
+
detect_tool_description_poisoning,
|
|
73
|
+
inspect_payload_safety,
|
|
74
|
+
scan_outbound_secrets,
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
__all__ = [
|
|
78
|
+
"__version__",
|
|
79
|
+
"gatekeep_tool",
|
|
80
|
+
"slim_tool",
|
|
81
|
+
"ToolDefinition",
|
|
82
|
+
"ToolRegistry",
|
|
83
|
+
"ToolReturnLedger",
|
|
84
|
+
"LedgerEntry",
|
|
85
|
+
"PreExecutionGate",
|
|
86
|
+
"GateDecision",
|
|
87
|
+
"Verdict",
|
|
88
|
+
"AuditReceipt",
|
|
89
|
+
"GatekeepMiddleware",
|
|
90
|
+
"GatekeepPolicyError",
|
|
91
|
+
"SafePolicyEvaluator",
|
|
92
|
+
"PolicySyntaxError",
|
|
93
|
+
"evaluate_declarative_policy",
|
|
94
|
+
"SagaCoordinator",
|
|
95
|
+
"SagaStep",
|
|
96
|
+
"RollbackSummary",
|
|
97
|
+
"SessionStateStore",
|
|
98
|
+
"InMemorySessionStore",
|
|
99
|
+
"SQLiteSessionStore",
|
|
100
|
+
"RedisSessionStore",
|
|
101
|
+
"PostgresSessionStore",
|
|
102
|
+
"ConcurrencyConflictError",
|
|
103
|
+
"ToolPolicySpec",
|
|
104
|
+
"CentralPolicyRegistry",
|
|
105
|
+
"resolve_effective_tool",
|
|
106
|
+
"EscalationTicket",
|
|
107
|
+
"EscalationRouter",
|
|
108
|
+
"WebhookEscalationNotifier",
|
|
109
|
+
"SagaRecoveryDaemon",
|
|
110
|
+
"SweepReport",
|
|
111
|
+
"AuditVault",
|
|
112
|
+
"DEFAULT_SENSITIVE_KEYS",
|
|
113
|
+
"SensitiveDataRedactor",
|
|
114
|
+
"canonical_action_fingerprint",
|
|
115
|
+
"hash_secret_token",
|
|
116
|
+
"compute_tool_schema_hash",
|
|
117
|
+
"detect_tool_description_poisoning",
|
|
118
|
+
"inspect_payload_safety",
|
|
119
|
+
"scan_outbound_secrets",
|
|
120
|
+
"MCPUpstream",
|
|
121
|
+
"CallableMCPUpstream",
|
|
122
|
+
"AsyncCallableMCPUpstream",
|
|
123
|
+
"RegistryMCPUpstream",
|
|
124
|
+
"StdioMCPUpstream",
|
|
125
|
+
"HttpMCPUpstream",
|
|
126
|
+
"MCPTransactionProxy",
|
|
127
|
+
"MCPHttpGateway",
|
|
128
|
+
"ApiPrincipal",
|
|
129
|
+
"AuthContext",
|
|
130
|
+
"parse_api_principals",
|
|
131
|
+
"serve_http",
|
|
132
|
+
"generate_starter_policy",
|
|
133
|
+
"synthesize_policies_from_store",
|
|
134
|
+
"simulate_policy_against_traces",
|
|
135
|
+
]
|
gatekeep/__main__.py
ADDED