T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/config-preflight-validator.py:43
- Finding
- Schema Validation Fails Open When No Schema Is Available<![CDATA[ ## Vulnerability Details **File Location**: `scripts/config-preflight-validator.py`, lines 43-66 **Vulnerability Type**: Fail-open security validation **Risk Level**: Medium ### Vulnerable Code ```python try: import jsonschema if schema: jsonschema.validate(instance=patch_data, schema=schema) return True, [] ``` ```python # Basic manual validation for a limited number of fields if "plugins" in patch_data: p = patch_data["plugins"] if "allow" in p and not isinstance(p["allow"], list): errors.append("Error: 'plugins.allow' must be an array of strings") if "deny" in p and not isinstance(p["deny"], list): errors.append("Error: 'plugins.deny' must be an array of strings") if "channels" in patch_data: if not isinstance(patch_data["channels"], dict): errors.append("Error: 'channels' must be an object") return len(errors) == 0, errors ``` ### Technical Analysis Full JSON Schema validation is performed only when a schema is available. If retrieval of the live schema fails and no valid cached schema exists, execution falls through to manual validation covering only `plugins.allow`, `plugins.deny`, and `channels`. Any invalid field outside this narrow set produces no error. The function consequently returns `True` when the `errors` list remains empty, causing the command to report successful validation even though no comprehensive schema validation occurred. This is a fail-open design in a tool intended to provide configuration safety guarantees. Although the command prints an informational message when no schema exists, its successful return status can still be interpreted by users or automation as authorization to apply the configuration. ### Attack Path 1. An attacker or environmental failure prevents `openclaw gateway config.schema` from returning a usable schema. 2. The local schema cache is absent, unreadable, or contains invalid JSON. 3. The attacker supplies a configuration or pa ...[truncated 959 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Fail closed when neither a live nor cached schema is available: ```python if schema is None: return False, ["A valid schema is required for configuration validation."] ``` 2. Provide limited manual validation only through an explicit option such as `--allow-basic-validation`. 3. Use a distinct nonzero exit status for incomplete validation so automated workflows cannot mistake it for successful schema validation. 4. Clearly differentiate the following outcomes: - Full schema validation passed. - Full schema validation failed. - Validation could not be completed. 5. Validate that the top-level input is an object before accessing configuration fields. 6. If offline use is required, package a reviewed baseline schema and verify cached schema integrity and format before use. ]]>
