T09 · Insecure Skill Coding Practices
- Location
scripts/cpa_warden.py:949- Finding
Management Credentials and Authentication Files Can Be Transmitted over Plaintext HTTP
- Content
View full analysis
dict[str, str]: headers = { "Authorization": f"Bearer {token}", "Accept": "application/json, text/plain, */*", } if include_json: headers["Content-Type"] = "application/json" return headers ``` ```python def fetch_auth_files(base_url: str, token: str, timeout: int) -> list[dict[str, Any]]: LOGGER.info("开始拉取 auth-files 列表") LOGGER.debug("GET %s/v0/management/auth-files", base_url.rstrip("/")) resp = requests.get( f"{base_url.rstrip('/')}/v0/management/auth-files", headers=mgmt_headers(token), timeout=timeout, ) resp.raise_for_status() data = safe_json(resp) files = data.get("files") LOGGER.info("auth-files 拉取完成: %s", len(files) if isinstance(files, list) else 0) return files if isinstance(files, list) else [] ``` ```python if upload_method == "multipart": form = aiohttp.FormData() form.add_field( "file", candidate["content_bytes"], filename=file_name, content_type="application/json", ) req_headers = mgmt_headers(token) request_kwargs: dict[str, Any] = {"data": form} request_url = multipart_upload_url else: req_headers = mgmt_headers(token, include_json=True) request_kwargs = {"data": candidate["content_text"]} request_url = json_upload_url async with session.post( request_url, headers=req_headers, timeout=timeout, **request_kwargs, ) as resp: ``` ### Technical Analysis The example configuration and operational documentation use an `http://` CPA management endpoi ...[truncated 1946 chars]- Remediation
View remediation
