fix: resolve security vulnerabilities, file downloads, Docker build, and Windows script compatibility - #124
Open
AnandkumarMall wants to merge 1 commit into
Conversation
…and Windows script compatibility
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary / 概述
This PR comprehensively resolves multiple reported community issues and security vulnerabilities across backend APIs, file downloads, Docker builds, Windows scripts, and citation parsing.
本 PR 全面修复了社区反馈的安全漏洞、文件下载缺失、Docker 镜像构建中断、Windows 脚本兼容性及参考文献解析问题。
Fixes #60, fixes #61, fixes #62, fixes #64, fixes #65, fixes #73, fixes #83, fixes #86, fixes #87, fixes #88, fixes #89, fixes #90, fixes #95, fixes #100, fixes #110, fixes #114, fixes #118, fixes #120.
1. Security & Path Traversal / 安全与防路径遍历
allow_origins=["*"]withallow_origin_regex=r".*"whenallow_credentials=Trueinbackend/app/main.py. This complies with the CORS specification and prevents browsers from blocking requests with credentials (bug :Invalid and unsafe CORS configuration (allow_origins=["*"] with allow_credentials=True) #90).get_work_dirandcreate_work_dirinbackend/app/utils/common_utils.pyusingensure_safe_task_idand directory containment checks against../../traversal (bug : Path traversal in /files and /open_folder because task_id is not validated #88).basenamefor uploaded files in/modelingand blocked writing outside the task directory (bug: Path traversal in /modeling file upload via unsanitized UploadFile.filename #87)./download_urlpreventing arbitrary file access (issue: Generated task artifacts and task message logs are exposed without authentication #89)./chat/completionsand trailing slashes from API Base URLs during validation and saving (bug : Unauthenticated /save-api-config mutates process-global API settings and breaks multi-user isolation #86).2. File Operations & Broken Downloads / 文件管理与下载修复
/download_all_urlpreviously pointed to/static/{task_id}/all.zipwhich was never created. Added dynamic on-demand zip archiving of the task workspace (文件方面的操作均无法实现。只能手动复制路径去文件资源管理器里看 #110)./download_urlfrom hardcodedlocalhost:8000tosettings.SERVER_HOST.os.path.abspath) for Windowsexplorer, and added cross-platform fallbacks for Linux (xdg-open) and macOS (open).3. Docker & Deployment / 容器构建与历史记录
RUN npm install -g pnpm@10.6.3infrontend/DockerfilematchingpackageManagerinpackage.json, resolvingERR_PNPM_PNPM_ENGINE_IDENTITY_UNVERIFIABLE(Docker 部署 frontend 构建失败:pnpm 新版本与旧 lockfile 不兼容 #118, Docker 部署报错 #83)../backend/logs:/app/logsvolume mounting todocker-compose.ymlso chat history is preserved across container restarts (docker部署版MMA重新启动时会丢失所有历史记录 #64).ENV LANG=C.UTF-8 LC_ALL=C.UTF-8intobackend/Dockerfile(docker不支持中文 #60).4. Windows Scripts & Quality Gates / Windows 脚本与环境兼容
win_start.batto detect bothbackend\venvandbackend\.venv(generated byuv sync), and added checks forredis-serverandpnpm(fix: win_start.bat 兼容 .venv 并增加启动前置检查 #116).writing_check.shanddoctor/SKILL.mdto automatically detect Windows nativepythonwhenpython3is absent (Windows 下 6verity 验收与 doctor 环境检测因 python3 硬编码而失效 #114, fix(skills): Windows 下 python3 硬编码导致 6verity/doctor 失效 #115).writing_check.sh.return 0/return 1codes indoctor/SKILL.mdso the fallback chain works properly.5. Citations & Typst Math / 参考文献与 Typst 语法
user_output.pyto make colons optional ((?::|\s)\s*), aligning with the writer prompt ({[^1] ...}) (fix: 修复参考文献收集失败、编号错乱与标题/条目格式问题 #113).5writing/SKILL.mdand added automated static scanning inwriting_check.shto flag leaked LaTeX macros (\text{},\times,\degree, etc.) in.typfiles (Claude Code使用skill用Typst引擎语法还会有latex语法残留 #100).6. Observability & Usability / 交互与可观测性
SystemMessage) pushed to the frontend on each coder agent turn (希望能够添加聊天次数的实时显示 #65).OPENALEX_EMAILinworkflow.py(MathModel-Skill 的恢复机制会触发已被禁用的 thread/rollback #120).README.md, corrected the sponsor path (./docs/md/sponser.md), and added configuration guides forMAX_CHAT_TURNS,MAX_RETRIES, and API Base URLs (readme.md缺少配置教程 #61, 建议在README.md里添加如何修改最大聊天次数的教程 #62, docs: 修正 README 中失效的目录锚点与文档路径 #122).Verification / 验证
backend/app/tests/test_user_output.pycovering citation collection, reference numbering, path safety, and URL normalization. All 7 tests pass (Ran 7 tests in 0.004s - OK).ruff check app/passed with 0 errors.