fix(security): P0 审计修复 — 6项关键安全/编译问题
F1: kernel.rs multi-agent 编译错误 — 重排 spawn_agent 中 A2A 注册顺序,
在 config 被 registry.register() 消费前使用
F2: saas-config.toml 从 git 追踪中移除 — 包含数据库密码已进入版本历史
F3: config.rs 硬编码开发密钥改用 #[cfg(debug_assertions)] 编译时门控 —
dev fallback 密钥不再进入 release 构建
F4: 公共认证端点添加 IP 速率限制 (20 RPM) — 防止暴力破解
F5: SSE relay 路由分离出全局 15s TimeoutLayer — 避免长流式响应被截断
F6: Provider API 密钥入库前 AES-256-GCM 加密 — 明文存储修复
附带:完整审计报告 docs/superpowers/specs/2026-03-30-comprehensive-audit-report.md
This commit is contained in:
@@ -435,21 +435,22 @@ impl Kernel {
|
||||
// Register in memory
|
||||
self.memory.save_agent(&config).await?;
|
||||
|
||||
// Register in registry
|
||||
self.registry.register(config);
|
||||
|
||||
// Register with A2A router for multi-agent messaging
|
||||
// Register with A2A router for multi-agent messaging (before config is moved)
|
||||
#[cfg(feature = "multi-agent")]
|
||||
{
|
||||
let profile = Self::agent_config_to_a2a_profile(&config_clone);
|
||||
let profile = Self::agent_config_to_a2a_profile(&config);
|
||||
let rx = self.a2a_router.register_agent(profile).await;
|
||||
self.a2a_inboxes.insert(id, Arc::new(Mutex::new(rx)));
|
||||
}
|
||||
|
||||
// Register in registry (consumes config)
|
||||
let name = config.name.clone();
|
||||
self.registry.register(config);
|
||||
|
||||
// Emit event
|
||||
self.events.publish(Event::AgentSpawned {
|
||||
agent_id: id,
|
||||
name: self.registry.get(&id).map(|a| a.name.clone()).unwrap_or_default(),
|
||||
name,
|
||||
});
|
||||
|
||||
Ok(id)
|
||||
|
||||
Reference in New Issue
Block a user