T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/test-cli-commands.sh:7
- Finding
- Automated verification can unintentionally actuate real robot hardware<![CDATA[ ## Vulnerability Details **File Location**: `scripts/test-cli-commands.sh:7-8, 13-14, 35-45, 75-81, 96-104` **Vulnerability Type**: Unsafe test configuration and missing physical-actuation safeguards **Risk Level**: High ### Vulnerable Code ```bash # Environment variables: # BUNDLE_PATH - Path to credential bundle zip (for client tests) # ROBOT_CONFIG - Path to robot config YAML (default: config/robot_dummy_config.yaml) # DURATION - Test duration in seconds (default: 10) BUNDLE_PATH=${BUNDLE_PATH:-} ROBOT_CONFIG=${ROBOT_CONFIG:-config/robot_dummy_config.yaml} DURATION=${DURATION:-10} ``` Test 1 is described as a dummy-adapter test, but it accepts the caller-controlled configuration without validating the adapter type or forcing dry-run mode: ```bash # Test 1: Client startup with dummy adapter (requires bundle) echo "Test 1: Start R2C client (dummy adapter, ${DURATION}s)" if [ -n "$BUNDLE_PATH" ] && [ -f "$BUNDLE_PATH" ]; then echo " Starting client for ${DURATION}s..." timeout "$DURATION" cloudrobo r2c client \ --bundle "$BUNDLE_PATH" \ --robot-config "$ROBOT_CONFIG" \ --duration "$DURATION" \ --log-level INFO 2>&1 || true echo " Client test completed." else echo " Skipping: BUNDLE_PATH not set or file not found" echo " Set BUNDLE_PATH env var to test client startup" fi ``` The recording and logging tests reuse the same unrestricted configuration: ```bash # Test 3: Observation recording test if [ -n "$BUNDLE_PATH" ] && [ -f "$BUNDLE_PATH" ]; then echo " Recording observations for ${DURATION}s..." timeout "$DURATION" cloudrobo r2c client \ --bundle "$BUNDLE_PATH" \ --robot-config "$ROBOT_CONFIG" \ --duration "$DURATION" \ --record /tmp/r2c_test_observations.pkl \ --log-level INFO 2>&1 || true ``` ```bash # Test 5: Log file test if [ -n "$BUNDLE_PATH" ] && [ -f "$BUNDLE_PATH" ]; then LOG_FILE="/tmp/r2c_test.log" timeout 5 cloudrobo r2c cl ...[truncated 2546 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Generate a dedicated test configuration instead of accepting an unrestricted production robot configuration. 2. Parse and validate the YAML before every client invocation: - Require `hardware.type: dummy` for automated verification. - Require `runtime.dry_run: true`. - Abort if either condition is not met. 3. Force dry-run mode for Tests 1, 3, and 5 rather than relying on the input configuration. 4. Add a separate explicit option such as `--allow-real-hardware`, disabled by default, for controlled integration testing. 5. Before accepting that option, display the adapter type, endpoint, robot identity, and actuation status and require affirmative confirmation. 6. Do not suppress unexpected failures with unconditional `|| true`. Capture the exit code and fail the test when startup, validation, or shutdown does not behave as expected. 7. Require physical safety controls for real-hardware tests, including an emergency stop, cleared operating area, joint and velocity limits, and operator supervision. ]]>
