T09 · Insecure Skill Coding Practices
- Location
scripts/animate_anyone.py:38- Finding
Authentication credentials can be redirected to attacker-controlled endpoints
- Content
View full analysis
dict: key = os.environ.get("DASHSCOPE_API_KEY") if not key: raise RuntimeError("DASHSCOPE_API_KEY not set") h = { "Authorization": f"Bearer {key}", "Content-Type": "application/json", } if async_mode: h["X-DashScope-Async"] = "enable" return h r = requests.post( f"{BASE_URL}/api/v1/services/aigc/image2video/aa-detect", headers=_headers(async_mode=False), json={"model": "animate-anyone-detect-gen2", "input": {"image_url": image_url}}, timeout=60, ) ``` Representative OSS implementation: ```python auth = oss2.Auth( os.environ["ALIBABA_CLOUD_ACCESS_KEY_ID"], os.environ["ALIBABA_CLOUD_ACCESS_KEY_SECRET"], ) bucket_name = os.environ["OSS_BUCKET"] endpoint = os.environ.get( "OSS_ENDPOINT", "oss-cn-beijing.aliyuncs.com", ) endpoint = endpoint.replace("https://", "").replace("http://", "").rstrip("/") bucket = oss2.Bucket(auth, f"https://{endpoint}", bucket_name) bucket.put_object_from_file(key, local_path) url = bucket.sign_url("GET", key, expires) ``` LingMou has an equivalent configurable endpoint: ```python config = open_api_models.Config( access_key_id=os.environ["ALIBABA_CLOUD_ACCESS_KEY_ID"], access_key_secret=os.environ["ALIBABA_CLOUD_ACCESS_KEY_SECRET"], endpoint=os.environ.get( "LINGMOU_ENDPOINT", "lingmou.cn-beijing.aliyuncs.c ...[truncated 2820 chars]- Remediation
View remediation
