T09 · Insecure Skill Coding Practices
- Location
dist/actions/delete-task.js:8- Finding
Destructive task deletion lacks an enforced confirmation gate
- Content
View full analysis
Vulnerability Details
File Location:
dist/actions/delete-task.js:8-16
Vulnerability Type: Missing authorization confirmation for a destructive operation
Risk Level: MediumThe Skill documentation requires immediate user confirmation before deleting a subtitle task (
SKILL.md:38), but the executable deletion path does not require or validate proof of that confirmation.Complete Code Snippet
javascript async function deleteTask(params, client) { const validationError = (0, validator_1.validate)("deleteTask", params); if (validationError) return validationError; const requestParams = { taskId: params.taskId.trim() }; if (params.subUserId != null && String(params.subUserId).trim() !== "") { requestParams.subUserId = String(params.subUserId).trim(); } const response = await client.post("/open/deleteTask", requestParams, types_1.TIMEOUT_CONFIG.query); return response.code === types_1.ErrorCode.SUCCESS ? { ...response, message: (0, i18n_1.localize)(params.locale, "任务已删除,相关媒体将异步清理;已扣积分不会退还", "Task deleted. Related media will be cleaned up asynchronously; charged credits are not refunded.") } : (0, error_handler_1.mapApiError)(response, params.locale, params.region); }The MCP exposure in
dist/mcp-server.js:94-103accepts only a task ID, optional sub-user scope, and locale before directly dispatching deletion:javascript server.registerTool("delete_subtitle_task", { description: description("删除本人一项去字幕任务,并安排清理上传及结果媒体;已扣积分不退还。", "Permanently hide one owned subtitle-removal task and schedule its uploaded and result media for cleanup. Charged credits are not refunded."), inputSchema: { taskId: zod_1.z.string().min(1).max(64).describe(description("去字幕任务 ID。", "Task ID returned by subtitle removal.")), subUserId: zod_1.z.string().max(128).optional().describe(description("提交时使用的可选子用户标识。", "Option ...[truncated 2617 chars]- Remediation
View remediation
Remediation Suggestions
- Add a mandatory confirmation field, such as
confirmed: z.literal(true), to every deletion entry point. - Validate confirmation again inside
deleteTaskso direct dispatcher or CLI invocation cannot bypass the MCP schema. - Prefer a two-step flow:
- First return the exact task ID, affected media, cleanup consequences, and lack of credit refund.
- After explicit user approval, issue a short-lived, single-use confirmation token bound to the account, task ID, sub-user ID, and action.
- Require and consume that token before calling
/open/deleteTask.
- Reject stale, reused, missing, or mismatched confirmation tokens.
- Apply the same gate to the MCP server, standard-input CLI, and any exported programmatic API.
- Keep
destructiveHint: true, but treat it only as metadata rather than as an authorization control. - Add tests proving that deletion requests without valid confirmation never reach
ApiClient.post.
- Add a mandatory confirmation field, such as
