T09 · Insecure Skill Coding Practices
- Location
scripts/generate_workflow_blueprint.py:16- Finding
Dry-run Mode Performs Unrestricted Filesystem Writes
- Content
View full analysis
argparse.Namespace: parser = argparse.ArgumentParser(description="Generate a workflow automation blueprint.") parser.add_argument("--input", required=False, help="Path to JSON input.") parser.add_argument("--output", required=True, help="Path to output artifact.") parser.add_argument("--format", choices=["json", "md", "csv"], default="json") parser.add_argument("--dry-run", action="store_true", help="Run without side effects.") return parser.parse_args() def render(result: dict, output_path: Path, fmt: str) -> None: output_path.parent.mkdir(parents=True, exist_ok=True) if fmt == "json": output_path.write_text(json.dumps(result, indent=2), encoding="utf-8") return if fmt == "md": details = result["details"] lines = [ f"# {result['summary']}", "", f"- status: {result['status']}", f"- workflow_name: {details['workflow_name']}", f"- trigger: {details['trigger']}", "", "## Steps", ] for step in details["steps"]: lines.append(f"- {step['order']}. {step['name']} ({step['type']})") output_path.write_text("\n".join(lines) + "\n", encoding="utf-8") return with output_path.open("w", newline="", encoding="utf-8") as handle: writer = csv.DictWriter(handle, fieldnames=["order", "name", "type", "on_failure"]) writer.writeheader() writer.writerows(result["details"]["steps"]) ``` ```python result = { "status": "ok" if normalized_steps else "warning", "summary": ( f"Generated workflow blueprint with {len(normalized_steps)} steps" ...[truncated 3147 chars]- Remediation
View remediation
