T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/test-cli-commands.sh:58
- Finding
- Functional Test Script Dispatches a Real Robot Task Without Affirmative Confirmation<![CDATA[ ## Vulnerability Details **File Location**: `scripts/test-cli-commands.sh`, lines 58-73 **Vulnerability Type**: Missing confirmation gate for a safety-critical operation **Risk Level**: High ### Vulnerable Code ```bash # Test 5: Create task (mutating, needs confirmation) if [ -z "$TASK_ID" ]; then if [ -n "$ROBOT_ID" ] && [ -n "$EXEC_MODEL_ID" ]; then echo "Test 5: Create task (mutating)" echo "WARNING: This creates a dispatcher task. Press Ctrl+C to cancel." sleep 2 CREATE_RESULT=$(cloudrobo dispatch create-task \ --session-id "$SESSION_ID" \ --name "test-task-$(date +%s)" \ --task "Move forward 1 meter and report position" \ --constraints-json "{\"model\":{\"exec_model_id\":\"$EXEC_MODEL_ID\"},\"robot_id\":\"$ROBOT_ID\",\"exec_constraints\":{\"max_run_time\":10,\"max_iter_num\":100}}") echo "$CREATE_RESULT" TASK_ID=$(echo "$CREATE_RESULT" | python3 -c "import sys, json; print(json.load(sys.stdin).get('task_id',''))" 2>/dev/null || echo "") echo "Task ID: $TASK_ID" echo "" ``` The script is recommended as a normal verification command in `SKILL.md`: ```bash bash scripts/test-cli-commands.sh ``` ### Technical Analysis The test script labels task creation as requiring confirmation, but it never requests or validates affirmative user consent. It only prints a warning, waits for two seconds, and proceeds automatically unless the user interrupts it. When `SESSION_ID`, `ROBOT_ID`, and `EXEC_MODEL_ID` are configured and `TASK_ID` is empty, running the documented test command submits the fixed instruction `Move forward 1 meter and report position` to the selected robot. This behavior contradicts the Skill's stated safety policy that mutating operations must be confirmed before execution. A short cancellation window is not equivalent to an explicit confirmation gate. It also fails open in unattended or non-interactive environments, wher ...[truncated 1820 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Make all automated tests non-mutating by default and use `--dry-run` for task creation. 2. Require an explicit opt-in flag, such as `--execute-mutating-tests`, before any real task can be submitted. 3. Add an affirmative interactive confirmation that displays: - Session and workspace ID - Robot ID - Execution model ID - Exact task instruction - Runtime and iteration limits 4. Require an exact response such as `CREATE TASK` rather than treating a timeout or lack of interruption as consent. 5. Fail closed when standard input is not an interactive terminal unless a separate, deliberate CI authorization mechanism is supplied. 6. Consider requiring the operator to re-enter the target robot ID to prevent accidental dispatch to the wrong robot. 7. Separate read-only smoke tests from physical lifecycle tests so the documented default command cannot activate hardware. 8. Update `SKILL.md` to clearly distinguish safe verification from explicitly authorized live-robot testing. A safer pattern would be: ```bash if [ "${EXECUTE_MUTATING_TESTS:-false}" != "true" ]; then cloudrobo dispatch create-task \ --session-id "$SESSION_ID" \ --name "dry-run-test" \ --task "Move forward 1 meter and report position" \ --constraints-json "$CONSTRAINTS_JSON" \ --dry-run exit 0 fi if [ ! -t 0 ]; then echo "ERROR: Live robot tests require an interactive terminal." exit 1 fi printf 'Type CREATE TASK to dispatch this instruction: ' read -r CONFIRMATION [ "$CONFIRMATION" = "CREATE TASK" ] || exit 1 ``` ]]>
