[错误] 对 CVE-2026-73034 的修复不完整: 未验证的 `user-id` 路径组件在 /api/v1/examples/use 中存活
作者: MAXI8594创建于 2026年9月10日更新于 2026年9月10日
packages/dbgpt-app/src/dbgpt_app/openapi/api_v1/examples_api.py in use_example_file() (POST /api/v1/examples/use, registered at dbgpt_server.py:63):
user_id = user_token.user_id or "default" # from the user-id header, unvalidated
...
upload_dir = os.path.join(base_dir, "python_uploads", user_id) # user_id is a path component
os.makedirs(upload_dir, exist_ok=True) # creates the escaped directory
target_name = _validate_example_filename(example["name"]) # validates the NAME only
target_path = os.path.join(upload_dir, target_name)
shutil.copy2(source_path, target_path) # writes into the escaped directory这两个语句正是 e0c741b 在 python_upload_api.py 中所替换的两个语句。_validate_example_filename() 正确地限制了文件的名称;不受限制的是从头中提取的目录组件。user_token 来自 get_user_from_headers (packages/dbgpt-serve/src/dbgpt_serve/utils/auth.py:25),正如原始报告所述的那样,它完全信任 user-id 头并为任何请求返回 role="admin"。PR #3143 ("将模拟头替换为可撤销的会话") 关闭了,因此在 main 中仍然采用此行为。
内容来源: eosphoros-ai/DB-GPT