improve(dispatch-webhook): 強化輸入驗證與參數邊界防護 #2
Reference in New Issue
Block a user
Delete Branch "tiangong/openclaw-skill:improve/dispatch-webhook-input-guardrails"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
改進說明
dispatch-webhook是跨節點任務派送的底層能力,若輸入參數異常(例如 target 不合法、payload 非物件、timeout/retries 越界)目前會在執行期產生不一致行為,且存在 header 值未淨化的風險。本次從架構安全與邊界條件角度,補上輸入防護與參數上限,讓 skill 在面對不可信輸入時能「可預期失敗」。
變更內容
validateInput():target僅允許vps-a | vps-bwebhookUrl為有效 URL 且協定僅http/httpspayload必須是 JSON object(排除 array/primitive)clampInt():timeoutMs限制在1000~120000,預設30000retries限制在1~5,預設3sanitizeTaskId():Error實例,避免非 Error 類型造成判斷不一致測試建議
timeoutMs = -1 / 999999,應被限制在區間內retries = 0 / 99,應被限制在1~5target = "vps-c"、payload = []、webhookUrl = "ftp://...",應回覆明確錯誤payload.task_id含\r\n字元時,header 內容應被淨化🤖 由 tiangong 自動審查並提交