T09 · Insecure Skill Coding Practices
Warning
- Location
- apps/apps_examples.md:295
- Finding
- Unattended Irreversible Bulk Deletion of Applications<![CDATA[ ## Vulnerability Details **File Location**: `apps/apps_examples.md`, lines 295–305; equivalent TypeScript workflow at lines 329–337 **Vulnerability Type**: Unsafe destructive operation without confirmation or dry-run safeguards **Risk Level**: Medium ### Vulnerable Code ```python # 3. Delete old apps (example: delete apps created more than 90 days ago) import time current_time = int(time.time()) ninety_days_ago = current_time - (90 * 24 * 60 * 60) for app in result["items"]: if app["created_at"] < ninety_days_ago: print(f"Deleting old app: {app['name']} (ID: {app['id']})") try: delete_app(app["id"]) except Exception as e: print(f"Failed to delete {app['id']}: {e}") ``` The equivalent TypeScript workflow is: ```typescript // 3. Delete old apps (example: delete apps created more than 90 days ago) const currentTime = Math.floor(Date.now() / 1000); const ninetyDaysAgo = currentTime - (90 * 24 * 60 * 60); for (const app of result.items) { if (app.created_at < ninetyDaysAgo) { console.log(`Deleting old app: ${app.name} (ID: ${app.id})`); try { await deleteApp(app.id); } catch (error) { console.error(`Failed to delete ${app.id}:`, error); } } } ``` ### Technical Analysis The example performs an irreversible API deletion for every application in the returned page whose creation timestamp is older than 90 days. The underlying documentation states that deletion permanently removes the application and may also remove associated versions, conversations, or Agent task records. Although application management and deletion are declared Skill capabilities, presenting automatic deletion as part of a complete workflow is an unsafe default. The code provides no dry-run mode, interactive confirmation, explicit allowlist, backup verification, ownership validation beyond server-side authorization, or separate opt-in flag. Age alone is not a reliable indication that an application i ...[truncated 1612 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Make the workflow dry-run-only by default and print the application IDs, names, types, and creation dates that would be deleted. 2. Require an explicit destructive flag such as `--confirm-delete` before issuing any `DELETE` request. 3. Require confirmation for each application or accept a user-supplied allowlist of exact application IDs. 4. Do not treat age as sufficient authorization to delete. Add filters for application type, owner, environment, labels, or an explicit archival marker. 5. Require the user to type a confirmation phrase containing the team or application ID for bulk operations. 6. Verify backups or exports before deleting applications with associated conversations or task records. 7. Separate the destructive cleanup example from the normal list-and-filter workflow and place a prominent irreversible-operation warning immediately before executable code. 8. Prefer a two-phase lifecycle—archive or disable first, then delete after a retention period—if supported by the service. 9. Record an audit log of selected targets and API responses without logging bearer credentials or sensitive document content. ]]>
