Skip to content

Commit bf20433

Browse files
author
StockAnal Admin
committed
fix: Agent分析路由添加股票代码输入验证
/api/start_agent_analysis 端点添加 validate_stock_code 验证 防止非法代码传入Agent分析流程
1 parent fb6274a commit bf20433

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

app/web/web_server.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2063,6 +2063,12 @@ def start_agent_analysis():
20632063
if not stock_code:
20642064
return jsonify({'error': '请提供股票代码'}), 400
20652065

2066+
# 验证股票代码格式
2067+
is_valid, validated_code = validate_stock_code(stock_code, market_type)
2068+
if not is_valid:
2069+
return jsonify({'error': validated_code}), 400
2070+
stock_code = validated_code
2071+
20662072
# 创建新任务
20672073
task_id = generate_task_id()
20682074
task = {

0 commit comments

Comments
 (0)