kailash 0.3.1__py3-none-any.whl → 0.4.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.
- kailash/__init__.py +33 -1
- kailash/access_control/__init__.py +129 -0
- kailash/access_control/managers.py +461 -0
- kailash/access_control/rule_evaluators.py +467 -0
- kailash/access_control_abac.py +825 -0
- kailash/config/__init__.py +27 -0
- kailash/config/database_config.py +359 -0
- kailash/database/__init__.py +28 -0
- kailash/database/execution_pipeline.py +499 -0
- kailash/middleware/__init__.py +306 -0
- kailash/middleware/auth/__init__.py +33 -0
- kailash/middleware/auth/access_control.py +436 -0
- kailash/middleware/auth/auth_manager.py +422 -0
- kailash/middleware/auth/jwt_auth.py +477 -0
- kailash/middleware/auth/kailash_jwt_auth.py +616 -0
- kailash/middleware/communication/__init__.py +37 -0
- kailash/middleware/communication/ai_chat.py +989 -0
- kailash/middleware/communication/api_gateway.py +802 -0
- kailash/middleware/communication/events.py +470 -0
- kailash/middleware/communication/realtime.py +710 -0
- kailash/middleware/core/__init__.py +21 -0
- kailash/middleware/core/agent_ui.py +890 -0
- kailash/middleware/core/schema.py +643 -0
- kailash/middleware/core/workflows.py +396 -0
- kailash/middleware/database/__init__.py +63 -0
- kailash/middleware/database/base.py +113 -0
- kailash/middleware/database/base_models.py +525 -0
- kailash/middleware/database/enums.py +106 -0
- kailash/middleware/database/migrations.py +12 -0
- kailash/{api/database.py → middleware/database/models.py} +183 -291
- kailash/middleware/database/repositories.py +685 -0
- kailash/middleware/database/session_manager.py +19 -0
- kailash/middleware/mcp/__init__.py +38 -0
- kailash/middleware/mcp/client_integration.py +585 -0
- kailash/middleware/mcp/enhanced_server.py +576 -0
- kailash/nodes/__init__.py +25 -3
- kailash/nodes/admin/__init__.py +35 -0
- kailash/nodes/admin/audit_log.py +794 -0
- kailash/nodes/admin/permission_check.py +864 -0
- kailash/nodes/admin/role_management.py +823 -0
- kailash/nodes/admin/security_event.py +1519 -0
- kailash/nodes/admin/user_management.py +944 -0
- kailash/nodes/ai/a2a.py +24 -7
- kailash/nodes/ai/ai_providers.py +1 -0
- kailash/nodes/ai/embedding_generator.py +11 -11
- kailash/nodes/ai/intelligent_agent_orchestrator.py +99 -11
- kailash/nodes/ai/llm_agent.py +407 -2
- kailash/nodes/ai/self_organizing.py +85 -10
- kailash/nodes/api/auth.py +287 -6
- kailash/nodes/api/rest.py +151 -0
- kailash/nodes/auth/__init__.py +17 -0
- kailash/nodes/auth/directory_integration.py +1228 -0
- kailash/nodes/auth/enterprise_auth_provider.py +1328 -0
- kailash/nodes/auth/mfa.py +2338 -0
- kailash/nodes/auth/risk_assessment.py +872 -0
- kailash/nodes/auth/session_management.py +1093 -0
- kailash/nodes/auth/sso.py +1040 -0
- kailash/nodes/base.py +344 -13
- kailash/nodes/base_cycle_aware.py +4 -2
- kailash/nodes/base_with_acl.py +1 -1
- kailash/nodes/code/python.py +293 -12
- kailash/nodes/compliance/__init__.py +9 -0
- kailash/nodes/compliance/data_retention.py +1888 -0
- kailash/nodes/compliance/gdpr.py +2004 -0
- kailash/nodes/data/__init__.py +22 -2
- kailash/nodes/data/async_connection.py +469 -0
- kailash/nodes/data/async_sql.py +757 -0
- kailash/nodes/data/async_vector.py +598 -0
- kailash/nodes/data/readers.py +767 -0
- kailash/nodes/data/retrieval.py +360 -1
- kailash/nodes/data/sharepoint_graph.py +397 -21
- kailash/nodes/data/sql.py +94 -5
- kailash/nodes/data/streaming.py +68 -8
- kailash/nodes/data/vector_db.py +54 -4
- kailash/nodes/enterprise/__init__.py +13 -0
- kailash/nodes/enterprise/batch_processor.py +741 -0
- kailash/nodes/enterprise/data_lineage.py +497 -0
- kailash/nodes/logic/convergence.py +31 -9
- kailash/nodes/logic/operations.py +14 -3
- kailash/nodes/mixins/__init__.py +8 -0
- kailash/nodes/mixins/event_emitter.py +201 -0
- kailash/nodes/mixins/mcp.py +9 -4
- kailash/nodes/mixins/security.py +165 -0
- kailash/nodes/monitoring/__init__.py +7 -0
- kailash/nodes/monitoring/performance_benchmark.py +2497 -0
- kailash/nodes/rag/__init__.py +284 -0
- kailash/nodes/rag/advanced.py +1615 -0
- kailash/nodes/rag/agentic.py +773 -0
- kailash/nodes/rag/conversational.py +999 -0
- kailash/nodes/rag/evaluation.py +875 -0
- kailash/nodes/rag/federated.py +1188 -0
- kailash/nodes/rag/graph.py +721 -0
- kailash/nodes/rag/multimodal.py +671 -0
- kailash/nodes/rag/optimized.py +933 -0
- kailash/nodes/rag/privacy.py +1059 -0
- kailash/nodes/rag/query_processing.py +1335 -0
- kailash/nodes/rag/realtime.py +764 -0
- kailash/nodes/rag/registry.py +547 -0
- kailash/nodes/rag/router.py +837 -0
- kailash/nodes/rag/similarity.py +1854 -0
- kailash/nodes/rag/strategies.py +566 -0
- kailash/nodes/rag/workflows.py +575 -0
- kailash/nodes/security/__init__.py +19 -0
- kailash/nodes/security/abac_evaluator.py +1411 -0
- kailash/nodes/security/audit_log.py +91 -0
- kailash/nodes/security/behavior_analysis.py +1893 -0
- kailash/nodes/security/credential_manager.py +401 -0
- kailash/nodes/security/rotating_credentials.py +760 -0
- kailash/nodes/security/security_event.py +132 -0
- kailash/nodes/security/threat_detection.py +1103 -0
- kailash/nodes/testing/__init__.py +9 -0
- kailash/nodes/testing/credential_testing.py +499 -0
- kailash/nodes/transform/__init__.py +10 -2
- kailash/nodes/transform/chunkers.py +592 -1
- kailash/nodes/transform/processors.py +484 -14
- kailash/nodes/validation.py +321 -0
- kailash/runtime/access_controlled.py +1 -1
- kailash/runtime/async_local.py +41 -7
- kailash/runtime/docker.py +1 -1
- kailash/runtime/local.py +474 -55
- kailash/runtime/parallel.py +1 -1
- kailash/runtime/parallel_cyclic.py +1 -1
- kailash/runtime/testing.py +210 -2
- kailash/utils/migrations/__init__.py +25 -0
- kailash/utils/migrations/generator.py +433 -0
- kailash/utils/migrations/models.py +231 -0
- kailash/utils/migrations/runner.py +489 -0
- kailash/utils/secure_logging.py +342 -0
- kailash/workflow/__init__.py +16 -0
- kailash/workflow/cyclic_runner.py +3 -4
- kailash/workflow/graph.py +70 -2
- kailash/workflow/resilience.py +249 -0
- kailash/workflow/templates.py +726 -0
- {kailash-0.3.1.dist-info → kailash-0.4.0.dist-info}/METADATA +253 -20
- kailash-0.4.0.dist-info/RECORD +223 -0
- kailash/api/__init__.py +0 -17
- kailash/api/__main__.py +0 -6
- kailash/api/studio_secure.py +0 -893
- kailash/mcp/__main__.py +0 -13
- kailash/mcp/server_new.py +0 -336
- kailash/mcp/servers/__init__.py +0 -12
- kailash-0.3.1.dist-info/RECORD +0 -136
- {kailash-0.3.1.dist-info → kailash-0.4.0.dist-info}/WHEEL +0 -0
- {kailash-0.3.1.dist-info → kailash-0.4.0.dist-info}/entry_points.txt +0 -0
- {kailash-0.3.1.dist-info → kailash-0.4.0.dist-info}/licenses/LICENSE +0 -0
- {kailash-0.3.1.dist-info → kailash-0.4.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,132 @@
|
|
1
|
+
"""
|
2
|
+
SecurityEventNode - Security event monitoring and alerting
|
3
|
+
"""
|
4
|
+
|
5
|
+
import logging
|
6
|
+
from dataclasses import dataclass
|
7
|
+
from datetime import datetime, timezone
|
8
|
+
from enum import Enum
|
9
|
+
from typing import Any, Dict, Optional
|
10
|
+
|
11
|
+
from kailash.nodes.base import Node, NodeParameter, register_node
|
12
|
+
|
13
|
+
|
14
|
+
class SeverityLevel(str, Enum):
|
15
|
+
CRITICAL = "CRITICAL"
|
16
|
+
HIGH = "HIGH"
|
17
|
+
MEDIUM = "MEDIUM"
|
18
|
+
LOW = "LOW"
|
19
|
+
INFO = "INFO"
|
20
|
+
|
21
|
+
|
22
|
+
@dataclass
|
23
|
+
class SecurityEvent:
|
24
|
+
"""Represents a security event."""
|
25
|
+
|
26
|
+
event_type: str
|
27
|
+
severity: SeverityLevel
|
28
|
+
timestamp: datetime
|
29
|
+
source: str
|
30
|
+
description: str
|
31
|
+
details: Dict[str, Any]
|
32
|
+
user_id: Optional[str] = None
|
33
|
+
ip_address: Optional[str] = None
|
34
|
+
session_id: Optional[str] = None
|
35
|
+
correlation_id: Optional[str] = None
|
36
|
+
|
37
|
+
|
38
|
+
@register_node()
|
39
|
+
class SecurityEventNode(Node):
|
40
|
+
"""Node for security event processing and monitoring."""
|
41
|
+
|
42
|
+
def __init__(
|
43
|
+
self,
|
44
|
+
name: str,
|
45
|
+
severity_threshold: str = "INFO",
|
46
|
+
enable_alerting: bool = False,
|
47
|
+
**kwargs,
|
48
|
+
):
|
49
|
+
super().__init__(name=name, **kwargs)
|
50
|
+
self.severity_threshold = SeverityLevel(severity_threshold)
|
51
|
+
self.enable_alerting = enable_alerting
|
52
|
+
self.logger = logging.getLogger(f"security.{name}")
|
53
|
+
|
54
|
+
def get_parameters(self) -> Dict[str, NodeParameter]:
|
55
|
+
return {
|
56
|
+
"event_type": NodeParameter(
|
57
|
+
name="event_type",
|
58
|
+
type=str,
|
59
|
+
required=True,
|
60
|
+
description="Type of security event",
|
61
|
+
),
|
62
|
+
"severity": NodeParameter(
|
63
|
+
name="severity",
|
64
|
+
type=str,
|
65
|
+
required=True,
|
66
|
+
description="Event severity level",
|
67
|
+
),
|
68
|
+
"details": NodeParameter(
|
69
|
+
name="details",
|
70
|
+
type=dict,
|
71
|
+
required=False,
|
72
|
+
description="Security event details",
|
73
|
+
),
|
74
|
+
}
|
75
|
+
|
76
|
+
def process(self, inputs: Dict[str, Any]) -> Dict[str, Any]:
|
77
|
+
"""Process security event."""
|
78
|
+
|
79
|
+
event_type = inputs.get("event_type")
|
80
|
+
severity = SeverityLevel(inputs.get("severity", "INFO"))
|
81
|
+
details = inputs.get("details", {})
|
82
|
+
|
83
|
+
security_event = {
|
84
|
+
"event_type": event_type,
|
85
|
+
"severity": severity.value,
|
86
|
+
"timestamp": datetime.now(timezone.utc).isoformat(),
|
87
|
+
"details": details,
|
88
|
+
}
|
89
|
+
|
90
|
+
# Log security event
|
91
|
+
self.logger.warning(f"SECURITY: {event_type} [{severity.value}] - {details}")
|
92
|
+
|
93
|
+
# Trigger alerts if needed
|
94
|
+
alert_triggered = False
|
95
|
+
if self.enable_alerting and self._should_alert(severity):
|
96
|
+
alert_triggered = self._trigger_alert(security_event)
|
97
|
+
|
98
|
+
return {
|
99
|
+
"event_processed": True,
|
100
|
+
"event": security_event,
|
101
|
+
"alert_triggered": alert_triggered,
|
102
|
+
}
|
103
|
+
|
104
|
+
def _should_alert(self, severity: SeverityLevel) -> bool:
|
105
|
+
"""Determine if alert should be triggered."""
|
106
|
+
severity_order = {
|
107
|
+
SeverityLevel.INFO: 0,
|
108
|
+
SeverityLevel.LOW: 1,
|
109
|
+
SeverityLevel.MEDIUM: 2,
|
110
|
+
SeverityLevel.HIGH: 3,
|
111
|
+
SeverityLevel.CRITICAL: 4,
|
112
|
+
}
|
113
|
+
|
114
|
+
return severity_order[severity] >= severity_order[self.severity_threshold]
|
115
|
+
|
116
|
+
def _trigger_alert(self, event: Dict[str, Any]) -> bool:
|
117
|
+
"""Trigger security alert (placeholder)."""
|
118
|
+
# In production, this would integrate with alerting systems
|
119
|
+
self.logger.critical(f"SECURITY ALERT: {event}")
|
120
|
+
return True
|
121
|
+
|
122
|
+
def run(self, **kwargs) -> Dict[str, Any]:
|
123
|
+
"""Alias for process method."""
|
124
|
+
return self.process(kwargs)
|
125
|
+
|
126
|
+
def execute(self, **kwargs) -> Dict[str, Any]:
|
127
|
+
"""Alias for process method."""
|
128
|
+
return self.process(kwargs)
|
129
|
+
|
130
|
+
async def async_run(self, **kwargs) -> Dict[str, Any]:
|
131
|
+
"""Async execution method for enterprise integration."""
|
132
|
+
return self.run(**kwargs)
|