T09 · Insecure Skill Coding Practices
- Location
scripts/chuhaijiang_creator_search.py:29- Finding
Redirectable API Endpoints Can Exfiltrate Authentication Credentials
- Content
View full analysis
str: """Gateway base address: environment override, then production default.""" return (os.environ.get("LINKFOX_TOOL_GATEWAY") or "https://tool-gateway.linkfox.com").rstrip("/") def get_api_key(): key = (os.environ.get("LINKFOX_AGENT_API_KEY") or os.environ.get("LINKFOXAGENT_API_KEY")) if not key: sys.exit(1) return key def call_api(params): global _LAST_CALL_WAS_HTTP_ERROR _LAST_CALL_WAS_HTTP_ERROR = False api_url = get_api_url() api_key = get_api_key() data = json.dumps(params).encode("utf-8") headers = { "Authorization": api_key, "Content-Type": "application/json", "User-Agent": "LinkFox-Skill/2.0", "SESSION_ID": (os.environ.get("SESSION_ID") or "").strip(), "MESSAGE_ID": os.environ.get("MESSAGE_ID", ""), "MODE_ID": os.environ.get("MODE_ID", ""), "APP_NAME": os.environ.get("APP_NAME", ""), } req = Request(api_url, data=data, headers=headers, method="POST") try: with urlopen(req, timeout=150) as response: raw = response.read().decode("utf-8") try: return json.loads(raw) except json.JSONDecodeError: return {"error": "Invalid JSON response", "details": raw[:500]} except HTTPError as e: _LAST_CALL_WAS_HTTP_ERROR = True body = e.read().decode("utf-8", errors="replace") if e.fp else "" try: return json.loads(body) if body else { "error": f"HTTP { ...[truncated 2929 chars]- Remediation
View remediation
