T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/test-cli-commands.sh:76
- Finding
- Verification Script Performs Destructive Lifecycle Operations Without Explicit Confirmation<![CDATA[ ## Vulnerability Details **File Location**: `scripts/test-cli-commands.sh`, lines 76–99 **Vulnerability Type**: Missing confirmation and unsafe destructive automation **Risk Level**: High ### Vulnerable Code ```bash if [ -n "$SERVICE_ID" ]; then echo "Test 4: Show service detail" cloudrobo infer show --service-id "$SERVICE_ID" echo "" echo "Test 5: Start service (user must confirm)" echo "WARNING: This starts the service, consuming pool resources. Press Ctrl+C to cancel." sleep 2 cloudrobo infer start --service-id "$SERVICE_ID" || echo "Start may fail if already running" echo "" echo "Test 6: Stop service (user must confirm)" echo "WARNING: This stops the service. Press Ctrl+C to cancel." sleep 2 cloudrobo infer stop --service-id "$SERVICE_ID" || echo "Stop may fail if already stopped" echo "" echo "Test 7: List logs (ms timestamps)" END_MS=$(date +%s%3N 2>/dev/null || echo "0") START_MS=$(( END_MS - 3600000 )) cloudrobo infer list-logs --service-id "$SERVICE_ID" --start-time "$START_MS" --end-time "$END_MS" --limit 50 || echo "Logs may be empty if service never ran" echo "" echo "Test 8: Update service (user must confirm)" echo "WARNING: This updates the service. Press Ctrl+C to cancel." sleep 2 cloudrobo infer update --service-id "$SERVICE_ID" --description "Updated by test" || echo "Update may fail" echo "" echo "Test 9: Delete service (user must confirm)" echo "WARNING: This deletes the service. Press Ctrl+C to cancel." sleep 2 cloudrobo infer delete --service-id "$SERVICE_ID" || echo "Delete may fail if service already gone" echo "" fi ``` ### Technical Analysis When the `SERVICE_ID` environment variable is non-empty, the verification script automatically performs four mutating operations: 1. Starts the selected inference service. 2. Stops the service. 3. Changes its description. 4. Permanently deletes the service. The messa ...[truncated 2104 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Make the script read-only by default. - Require an explicit option such as `--allow-mutations` before running any start, stop, update, or delete test. - Prompt separately before every mutating command and require an affirmative response. - For deletion, require the operator to type the exact service ID: ```bash read -r -p "Type the service ID to confirm deletion: " CONFIRM_ID if [ "$CONFIRM_ID" = "$SERVICE_ID" ]; then cloudrobo infer delete --service-id "$SERVICE_ID" else echo "Deletion cancelled." fi ``` - Use `--dry-run` where supported. - Do not treat a short sleep or “Press Ctrl+C” message as confirmation. - Display the workspace, service name, status, and service ID before requesting approval. - Separate destructive integration testing into a dedicated script intended only for disposable test services. - Require a marker or naming convention proving that the target is a test resource before deletion. ]]>
