T09 · Insecure Skill Coding Practices
- Location
clients/auth.py:8- Finding
Unrestricted API Base Override Can Exfiltrate Credentials and Access Tokens
- Content
View full analysis
Tuple[Optional[str], Optional[int], Optional[str]]: url = f"{API_BASE}/open/v1/access_token" body = json.dumps( { "app_id": app_id, "secret_key": secret_key, } ).encode("utf-8") req = urllib.request.Request( url, data=body, headers={"Content-Type": "application/json"}, method="POST", ) try: with urllib.request.urlopen(req, timeout=30) as resp: ``` `clients/tts_client.py:10-25`: ```python API_BASE = os.environ.get("CHANJING_API_BASE", "https://open-api.chanjing.cc") def _post_json(path: str, payload: dict[str, Any], timeout: int = 30) -> dict[str, Any]: token, err = get_token() if err: raise RuntimeError(err) def _once(current_token: str) -> dict[str, Any]: req = urllib.request.Request( f"{API_BASE}{path}", data=json.dumps(payload).encode("utf-8"), headers={"access_token": current_token, "Content-Type": "application/json"}, method="POST", ) with urllib.request.urlopen(req, timeout=timeout) as resp: ``` `clients/ai_creation_client.py:13-46`: ```python API_BASE = os.environ.get("CHANJING_API_BASE", "https://open-api.chanjing.cc") RUNNING_STATUSES = {"Queued", "Ready", "Generating"} SUCCESS_STATUSES = {"Success"} FAILED_STATUSES = {"Error", "Fail"} def _get_access_token() -> str: token, err = get_token() if err: ...[truncated 4368 chars]- Remediation
View remediation
