T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/planning_validator.py:21
- Finding
- Fail-Open Plan Validator Provides False Security Assurance## Vulnerability Details **File Location**: `scripts/planning_validator.py:21-44` **Vulnerability Type**: Ineffective validation and unconditional security approval **Risk Level**: Medium ### Vulnerable Code ```python def validate_plan(self, plan_data): """Validate a plan structure""" errors = [] # Check required fields for field in self.required_fields: if field not in plan_data: errors.append(f"Missing required field: {field}") # Check tool availability for step in plan_data.get('steps', []): if 'tool' not in step: errors.append("Step missing tool field") return {'valid': len(errors) == 0, 'errors': errors} def check_reality(self, plan_data): """Check if plan is realistic""" return {'realistic': True, 'confidence': 0.95} def main(): parser = argparse.ArgumentParser(description="Planning Validator") parser.add_argument("--plan", help="Plan JSON file") parser.add_argument("--test", action="store_true", help="Run tests") args = parser.parse_args() validator = PlanningValidator() ``` ### Technical Analysis The validator checks only whether top-level fields exist and whether each step contains a `tool` key. Despite the comment stating “Check tool availability,” it does not confirm that a named tool exists, supports the requested operation, or is authorized for the caller. It also does not validate input types, permissions, dependencies, execution constraints, or plan feasibility. The `check_reality()` method unconditionally returns `realistic: True` with a fixed confidence of `0.95`, regardless of the supplied plan. This creates a fail-open security decision and reports unsupported confidence as if a substantive feasibility check had occurred. In addition, the command-line interface declares a `--plan` argument but does not open, parse, or validate the referenced JSON fil ...[truncated 1923 chars]
- Remediation
- ## Remediation Suggestions 1. Read the file supplied through `--plan`, parse it with `json.load()`, and return a nonzero exit status when reading, parsing, or validation fails. 2. Enforce a strict schema: - Require the root value to be an object. - Require `steps` and `tools` to be lists and `goal` to be a nonempty string. - Require every step to be an object with a valid tool name and explicitly defined action. - Reject unknown fields where appropriate. 3. Resolve every requested tool and action against an authoritative capability registry rather than checking only for key presence. 4. Verify required permissions, authentication state, dependencies, and resource constraints before approving a plan. 5. Replace the unconditional `check_reality()` result with evidence-based checks. Return an indeterminate or failed result when feasibility cannot be established. 6. Fail closed: missing registries, unavailable dependencies, malformed plans, unknown tools, and unverified permissions must prevent approval. 7. Return structured evidence for each validation decision, including the check performed, its result, and the source of capability or permission information. 8. Add tests covering malformed JSON, incorrect data types, unknown tools, unsupported actions, missing permissions, unavailable dependencies, excessive resource requests, and attempts to bypass checks using empty or deceptive values. 9. Ensure downstream callers require successful results from every mandatory check rather than trusting a standalone boolean or fixed confidence score.
