修复: relay token 改环境变量 + api_key 脱敏 + 路径规范化 + create_project 自动建目录
- relay token 必设 DF_RELAY_TOKEN 环境变量,移除硬编码默认 - AiProviderRecord Debug 脱敏 api_key/model_configs/config - ScriptNode 危险命令告警(rm -rf/DROP TABLE 等) - bind_directory 路径规范化,拒绝含 .. 的原始路径 - create_project 目录不存在时自动创建 - probe_pwsh OnceLock 全局缓存,异步探测不阻塞 tokio - retry jitter 改 rand,范围扩大到 ±50% - EventBus send 错误改 tracing::warn - StateMachine 文档警告不得在 await 期间持锁
This commit is contained in:
@@ -280,7 +280,9 @@ pub struct NodeExecutionRecord {
|
||||
// ============================================================
|
||||
|
||||
/// AI 提供商配置记录
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
///
|
||||
/// 自定义 Debug: api_key 脱敏为 `"sk-****"`, model_configs / config 脱敏为 `"***"`。
|
||||
#[derive(Clone, Serialize, Deserialize)]
|
||||
pub struct AiProviderRecord {
|
||||
pub id: String,
|
||||
pub name: String,
|
||||
@@ -308,6 +310,27 @@ pub struct AiProviderRecord {
|
||||
pub weight: u32,
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for AiProviderRecord {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_struct("AiProviderRecord")
|
||||
.field("id", &self.id)
|
||||
.field("name", &self.name)
|
||||
.field("provider_type", &self.provider_type)
|
||||
.field("api_key", &"sk-****")
|
||||
.field("base_url", &self.base_url)
|
||||
.field("default_model", &self.default_model)
|
||||
.field("models", &self.models)
|
||||
.field("model_configs", &"***")
|
||||
.field("is_default", &self.is_default)
|
||||
.field("config", &"***")
|
||||
.field("created_at", &self.created_at)
|
||||
.field("updated_at", &self.updated_at)
|
||||
.field("enabled", &self.enabled)
|
||||
.field("weight", &self.weight)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
/// AiProviderRecord.enabled 的 serde 默认(true)。老库/缺字段 JSON → enabled。
|
||||
fn default_enabled() -> bool {
|
||||
true
|
||||
|
||||
Reference in New Issue
Block a user