fix(security): clean up code scanning and runtime findings#1596
Merged
MaojiaSheng merged 2 commits intomainfrom Apr 21, 2026
Merged
fix(security): clean up code scanning and runtime findings#1596MaojiaSheng merged 2 commits intomainfrom
MaojiaSheng merged 2 commits intomainfrom
Conversation
Harden path and logging boundaries, remove noisy cleanup issues, and keep observability failures from breaking runtime flows.
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨No code suggestions found for the PR. |
Block the remaining path traversal bypass in the werewolf demo, and validate Feishu hosts on the main parse() entry point.
MaojiaSheng
approved these changes
Apr 21, 2026
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.
Description
这次 PR 主要不是做单点修补,而是集中收敛当前一批可以直接落地的 GitHub code scanning 安全项,同时把相关的 Python 运行时稳定性和清理项一起处理掉。整体可以归成三类:
Related Issue
N/A
Type of Change
Changes Made
py/path-injection相关路径访问,覆盖 vectordb 本地project / collection / index的目录恢复与创建逻辑,以及 console / werewolf demo 的文件访问边界。py/clear-text-logging-sensitive-data,去掉主代码、示例脚本和测试脚本中对api_key、root_api_key、headers、完整配置内容的明文输出,改为脱敏或只显示是否已配置。py/reflective-xss和py/bad-tag-filter,对 werewolf 目录 listing 输出做 HTML 转义,并将部分 HTML 处理从正则替换为解析器实现。py/tarslip,为 tar 解包增加路径越界和链接校验。py/incomplete-url-substring-sanitization,将字符串包含判断改为基于urlparse的主机与路径校验。empty except/ 异常吞掉问题,保留必要日志或明确失败语义,降低排障成本。QueueManager未初始化时不再隐式初始化,避免默认状态掩盖问题。pass、default_factory=lambda: ...等低价值噪音问题。TYPE_CHECKING调整,缓解部分循环依赖和导出副作用问题。tests/service/test_session_service_metrics.py,并更新相关测试与脚本,避免这批问题重复出现。Testing
本地执行:
python -m py_compile openviking/storage/vectordb/project/local_project.py openviking/storage/vectordb/project/project_group.py openviking/storage/vectordb/collection/local_collection.py bot/vikingbot/console/web_console.py openviking/utils/agfs_utils.py bot/demo/werewolf/werewolf_server.py openviking/parse/parsers/feishu.py openviking/models/vlm/backends/litellm_vlm.py bot/vikingbot/agent/tools/web.py openviking/parse/parsers/epub.py benchmark/RAG/scripts/download_dataset.py openviking/eval/ragas/__init__.py examples/cloud/alice.py examples/cloud/bob.py tests/api_test/tools/tests/test_simple_startup.py tests/api_test/tools/tests/test_load_config.py tests/api_test/tools/tests/test_lifespan.py tests/api_test/tools/tests/test_headers.py tests/api_test/tools/tests/test_full_startup.py tests/api_test/tools/tests/test_create_app.py tests/api_test/tools/tests/test_config_value.py tests/api_test/tools/tests/test_admin_api.py tests/api_test/tools/config/generate_config.py bot/tests/test_minimax_provider.pypython -m pytest --override-ini addopts='' bot/tests/test_werewolf_server_security.py tests/misc/test_config_validation.py tests/unit/crypto/test_providers_mock.py tests/service/test_session_service_metrics.py -qpython -m pytest --override-ini addopts='' bot/tests/test_minimax_provider.py -qChecklist
Screenshots (if applicable)
N/A
Additional Notes
这次优先处理的是“可以直接修且风险明确”的部分。
py/jinja2/autoescape-false、py/weak-sensitive-data-hashing以及third_party/下的 vendor 告警没有在这个 PR 里一并处理,后续建议单独复核和拆分。