T09 · Insecure Skill Coding Practices
- Location
scripts/miaoda_api.py:965- Finding
Production Publishing Does Not Enforce Explicit User Authorization
- Content
View full analysis
Vulnerability Details
File Location:
scripts/miaoda_api.py, lines 965–981 and 1542–1556
Vulnerability Type: Missing authorization confirmation for a consequential operation
Risk Level: MediumComplete Code Snippet
python def publish_app( base_url: str, api_key: str, app_id: str, app_env: str = "PRODUCE", enable_weapp_mini_program: bool = True, is_release_app_square: bool = False, ) -> dict: """POST /api/v1/app/release — triggers a release, returns releaseId.""" url = f"{base_url.rstrip('/')}/api/v1/app/release" payload = { "appId": app_id, "appEnv": app_env, "enableWeappMiniProgram": enable_weapp_mini_program, "isReleaseAppSquare": is_release_app_square, } resp = requests.post(url, json=payload, headers=auth_headers(api_key), timeout=120) resp.raise_for_status() body = resp.json() if body.get("status") != 0: msg = body.get("msg") or body.get("message") or "" _raise_if_insufficient_credits(msg) raise RuntimeError(f"Publish failed (status={body.get('status')}): {msg}") return bodypython elif args.command == "publish": if args.wait: result = publish_and_wait( args.base_url, args.api_key, args.app_id, args.env, ) print(json.dumps(result, ensure_ascii=False, indent=2)) emit_mcp_app_marker(args.base_url, args.api_key, args.app_id, result) else: result = publish_app( args.base_url, args.api_key, args.app_id, args.env, ) print(json.dumps(result, ensure_ascii=False, indent=2)) emit_mcp_app_marker( args.base_url, args.api_key, args.app_id, result, fetch_detail=False, )Technical Analysis
The Skill documentation states that publishing must occur only after an explicit user request and must never be performed automatically after generation. The executable does not technically enforce that authorization ...[truncated 1881 chars]
- Remediation
View remediation
Remediation Suggestions
-
Require an explicit confirmation control for production publishing, such as:
bash publish --app-id <id> --confirm-publishReject the operation when the flag is absent.
-
Prefer a short-lived confirmation token generated only after the user approves the exact application ID and target environment. Bind the token to:
- The authenticated account.
- The application ID.
- The target environment.
- A short expiration period.
-
Require interactive confirmation when running in a terminal unless a validated confirmation token is supplied.
-
Change the default environment from
PRODUCEto a non-production environment, or require the environment to be specified explicitly. -
Fetch application details before release and enforce valid lifecycle states. Treat this as an additional readiness check, not a replacement for user authorization.
-
Record the approved application ID, environment, timestamp, and confirmation source in an audit log without recording credentials.
-
