T09 · Insecure Skill Coding Practices
- Location
scripts/manage_objects.js:18- Finding
Destructive COS Operations Lack Confirmation and Scope Safeguards
- Content
View full analysis
({ Key })), }); return print({ success: true, action: 'delete_multiple', total: input.object_keys.length, data }); } ``` `scripts/delete_folder.js:21-39` ```js async function main() { const input = readJsonArg(2, 'input'); if (!input.folder_path) throw new Error('folder_path is required'); const cos = createCos(); const { bucket, region } = getBucketConfig(); const folderKey = input.folder_path.endsWith('/') ? input.folder_path : `${input.folder_path}/`; if (input.recursive) { const files = await listAll(cos, bucket, region, folderKey); const keys = files.map((item) => ({ Key: item.Key })); if (keys.length) { await call(cos, 'deleteMultipleObject', { Bucket: bucket, Region: region, Delete: { Objects: keys, Quiet: false }, }); } ``` ### Technical Analysis The scripts execute single-object, bulk-object, and recursive-prefix deletion immediately after parsing one caller-supplied JSON argument. They do not implement any of the following safeguards: - An explicit ...[truncated 1744 chars]- Remediation
View remediation
