修复: 灵感模块数据安全 + 建立整体任务图谱DAG
- IDEA-FIX-02: ideas 白名单移除 id/created_at(对标 tasks B-260616-16,防主键/创建时间篡改) - IDEA-FIX-03: create_idea 加 priority ∈ 0..=3 值域校验(对标 tasks B-260615-15,防越界静默吞) - docs/todo.md: 建立整体任务图谱(DAG·有方向有状态),整合知识图谱设计+22条待办+G1 - 核销 BUG-260620-05 层1: 已被 F-260619-03 方案①弱化取代(default_with_root 空,reload 不塞 workspace_root),层2 黑名单制仍待决策
This commit is contained in:
@@ -73,6 +73,15 @@ pub async fn create_idea(
|
||||
state: State<'_, AppState>,
|
||||
input: CreateIdeaInput,
|
||||
) -> Result<IdeaRecord, String> {
|
||||
// IDEA-FIX-03: priority 值域校验 ∈ 0..=3 (对标 tasks B-260615-15)。
|
||||
// priority_from_i32 对越界值兜底归并(>=3→Critical),但 IPC 入口应显式拒非法值,
|
||||
// 防 LLM/前端传 99 等被静默吞为 Critical。
|
||||
if !(0..=3).contains(&input.priority) {
|
||||
return Err(format!(
|
||||
"priority 必须在 0..=3 (Low=0/Medium=1/High=2/Critical=3),收到 {}",
|
||||
input.priority
|
||||
));
|
||||
}
|
||||
let now = now_millis();
|
||||
let record = IdeaRecord {
|
||||
id: new_id(),
|
||||
|
||||
Reference in New Issue
Block a user