Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion data_provider/baostock_fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def _baostock_session(self) -> Generator:

try:
# 登录 Baostock
login_result = bs.login()
login_result = bs.login(user_id='youngyadoudou', password='uijka443$89@Yndn')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Remove hard-coded Baostock account credentials

This login call now embeds a specific user_id and password directly in source, which both leaks a credential and forces every deployment to use a single external account. If that account is rotated, locked, or rate-limited, Baostock fetching will fail globally instead of using environment-specific/default authentication behavior.

Useful? React with 👍 / 👎.


if login_result.error_code != '0':
raise DataFetchError(f"Baostock 登录失败: {login_result.error_msg}")
Expand Down
6 changes: 5 additions & 1 deletion data_provider/tushare_fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ def __init__(self, rate_limit_per_minute: int = 80):
self._date_list_end: Optional[str] = None # 缓存对应的截止日期,用于跨日刷新

# 尝试初始化 API
self.token = ''
self._init_api()

# 根据 API 初始化结果动态调整优先级
Expand All @@ -163,6 +164,9 @@ def _init_api(self) -> None:
if not config.tushare_token:
logger.warning("Tushare Token 未配置,此数据源不可用")
return
else:
self.token = config.tushare_token
logger.info(f"Tushare Token 配置已生效: *****{config.tushare_token[-5:]}")

try:
self._api = self._build_api_client(config.tushare_token)
Expand Down Expand Up @@ -616,7 +620,7 @@ def get_stock_name(self, stock_code: str) -> Optional[str]:
return name

except Exception as e:
logger.warning(f"Tushare 获取股票名称失败 {stock_code}: {e}")
logger.warning(f"Tushare 获取股票名称失败 {stock_code}, token: {self._api.token[-5:]}: {e}")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Guard token access inside Tushare exception logging

The exception handler dereferences self._api.token[-5:] while already handling a failure; when _api is None (for example, token not configured or client init failed), this raises a new AttributeError and masks the original error, so get_stock_name no longer degrades gracefully to None in that path.

Useful? React with 👍 / 👎.


return None

Expand Down
Empty file modified docs/bot/feishu-bot-config.md
100644 → 100755
Empty file.
Empty file modified sources/dsa_vi/darklogo.iconset/icon_512x512@2x.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.