T09 · Insecure Skill Coding Practices
- Location
scripts/run_wuying.py:58- Finding
Destructive Cloud Operations Lack an Executable Confirmation Gate
- Content
View full analysis
Vulnerability Details
File Location:
scripts/run_wuying.py:58-86
Vulnerability Type: Missing authorization and confirmation enforcement for destructive operations
Risk Level: HighVulnerable Code
python def main() -> int: command = sys.argv[1:] if command[:1] == ["--"]: command = command[1:] try: aliyun = shutil.which("aliyun") if not aliyun: raise ValueError("official Aliyun CLI is not installed") specs = json.loads((ROOT / "references" / "products.json").read_text(encoding="utf-8")) # The workflow already checks remote updates. This fresh execution gate # intentionally performs only local CLI/plugin/profile checks. checked = subprocess.run( [sys.executable, str(ROOT / "scripts" / "check_environment.py"), "--aliyun-bin", aliyun, "--skip-update-check"], capture_output=True, text=True, check=False, timeout=60, ) if checked.returncode not in {0, 4}: raise ValueError("OAuth/plugin preflight failed; no business request was sent") evidence = json.loads(checked.stdout) validate_request(command, specs, evidence) except (ValueError, OSError, KeyError, TypeError, AttributeError, subprocess.TimeoutExpired) as error: # Do not echo raw CLI diagnostics, argv, profile contents or credentials. detail = str(error) if isinstance(error, ValueError) and not isinstance(error, json.JSONDecodeError) else "preflight evidence unavailable" print(json.dumps({"status": "blocked", "request_sent": False, "reason": detail, "next_action": "stop_business_execution", "credential_fallback_allowed": False, "direct_cli_sdk_http_retry_allowed": False}, ensure_ascii=False)) return 2 return subprocess.run([aliyun, *command[1:]], check=False).returncodeTechnical Analysis
The Skill document ...[truncated 2867 chars]
- Remediation
View remediation
Remediation Suggestions
Enforce the safety policy in the executable entry point rather than relying solely on Agent instructions:
- Classify every requested command using trusted catalog or live plugin metadata before execution.
- Reject mutation and destructive commands by default unless fresh confirmation evidence is supplied.
- Bind confirmation evidence to the exact account/profile, region, product, API version, action, resource identifiers, and material parameter values.
- Make confirmations short-lived and single-use so they cannot be replayed for a different operation or target set.
- Reject destructive requests containing wildcards, empty filters, unresolved identifiers, or account-wide target sets.
- Re-query targets immediately before destructive execution where resource membership may have changed.
- Consider separating read-only and state-changing execution paths, with the latter requiring an authenticated local approval channel or interactive confirmation.
- Add automated tests proving that direct wrapper invocation cannot execute mutation or destructive commands without valid, target-bound approval.
- Preserve the existing OAuth, plugin, product-scope, API-version, and authentication-override checks as defense-in-depth controls.
