T09 · Insecure Skill Coding Practices
- Location
scripts/ts_data.py:10- Finding
Hardcoded API Token Transmitted to a Custom Plaintext HTTP Endpoint
- Content
View full analysis
pd.DataFrame | None: # 方法1: tushare try: df = get_quote_history_ts(code, start_date='20200101', end_date='20500101') if df is not None and len(df) >= 60: return df except Exception: pass ``` The primary scanner calls that fetcher for each stock: ```python try: df = fetch_stock_data(code) time.sleep(REQUEST_DELAY) if df is None or len(df) < 60: continue except: time.sleep(REQUEST_DELAY) continue ``` ### Technical Analysis The source code embeds a reusable API token and assigns it to a Tushare client. It then overrides private client fields so that requests are sent to `http://140.143.209.128:5000`. Because the endpoint uses plaintext HTTP rather than authenticated HTTPS, the connection does not provide transport confidentiality, server authentication, or integrity protection. A network-positioned attacker may be able to observe the token and query parameters, replay the credential, redirect traffic, or modify returned market data. Use of a bare IP address and private Tushare client attributes also bypasses the normal provider configuration and makes the endpoint harder to authenticate and audit. The path is active: `screen.py` calls `fetch_stock_data()`, which attempts this Tushare ...[truncated 1616 chars]- Remediation
View remediation
