Skip to content

Commit cb2a712

Browse files
committed
fix(security): resolve Dependabot alerts and CodeQL scanning warnings\n\n- Bump cryptography (49.0.0 -> 50.0.1) and setuptools (82.0.1 -> 84.0.0)\n to remediate Dependabot alerts #1 (CVE-2026-59890) and #2 (CVE-2026-69247)\n- Fix CodeQL py/incomplete-url-substring-sanitization alerts #1-#4 in\n tests/unit/test_input_handler_ssrf.py by using set issubset assertions\n- Fix CodeQL py/overly-permissive-file alerts #5-#6 in\n tests/unit/test_input_handler.py by restricting permissions to owner\n- Register divergences for uv.lock and tests in docs/DIVERGENCE.md
1 parent 82bbe8b commit cb2a712

4 files changed

Lines changed: 62 additions & 60 deletions

File tree

‎docs/DIVERGENCE.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@
4545
| `.gitignore` | 上游版本 | 檔尾追加 fork 區塊(`.ruff_cache/`、`.mypy_cache/`、兩份生成報告) | 本 fork 的維護工具會在工作區產生報告檔,不加就會被 `git add -A` 收進去 | **保留**。上游變更照常合併,追加區塊在檔尾,衝突機率低 |
4646
| `README.md` | 英文說明文件 | `git mv` 成 `README.en.md`(內容原封不動,只在頂部加一行語言列),另新寫繁中 `README.md` | README 是上游最常動的檔。就地翻譯會讓每次同步整檔衝突;改名保留鏡像,同步時 `README.en.md` 可以直接吃上游的 diff | **保留**。同步上游時:`git checkout upstream/main -- README.md && git mv -f README.md README.en.md`,重加語言列,再人工判斷繁中 `README.md` 要不要跟著更新 |
4747
| `tests/nodes/test_security_end_to_end.py` | 大型安全 fixture 使用產品的每檔預算(上游 #522 起預設 300 秒,可由 `SKILLSPECTOR_MAX_STATIC_ANALYSIS_SECONDS_PER_ARTIFACT` 覆寫)、YARA 載入 5 秒與 SC8 traversal 5 秒上限(後兩者寫死) | 只在兩個 oversized acceptance tests(rd04、nine_case)將每檔額度調為 600 秒、YARA/SC8 調為 60 秒、整體 workflow 調為 900 秒,**所有平台都套用** | Windows 冷啟動與 Linux CI 負載下都會命中 runtime limit(本 fork run 34543263439、上游 run 34447095261、34442162097)。2026-09-17 同步上游到 `c13f70e` 時先改取上游版本實測:上游已把每檔預設提高到 300 秒,但 `test_nine_case_contract_across_public_surfaces` 在本機 Windows 仍以 `analysis_completeness.is_complete` 失敗,所以放寬 helper 重新套回上游版本 | **保留到上游讓 YARA 載入與 SC8 兩個預算也可注入,或縮短 fixture 成本**;不得因此放寬產品預設。每檔那一個上游已由 #522 解決 |
48+
| `tests/unit/test_input_handler.py` | `test_secure_open_traverses_search_only_ancestors` 測試時 `os.chmod(parent, 0o111)` 且 finally `0o755` | 改為僅 owner 搜尋權限 `0o100` 與清理權限 `0o700` | 消除 CodeQL 警報 #5、#6(`py/overly-permissive-file`)。測試以 owner 執行,`0o100` 完全滿足 search-only 驗證目的,不對 world/group 過度開放 | **保留**。可回饋上游;上游修復後可刪除此列 |
49+
| `tests/unit/test_input_handler_ssrf.py` | `TestAllowlistConfiguration` 使用 `assert "<domain>" in ALLOWED_*_HOSTS` | 改為集合子集斷言 `assert {"<domain>", ...}.issubset(ALLOWED_*_HOSTS)` | 消除 CodeQL 警報 #1~#4(`py/incomplete-url-substring-sanitization` 誤報)。CodeQL 靜態分析誤將 frozenset 成員檢查當成未解析 URL 字串包含;改用 `issubset` 完全消除誤報 | **保留**。可回饋上游;上游修復後可刪除此列 |
50+
| `uv.lock` | 鎖定 `cryptography==49.0.0` 與 `setuptools==82.0.1` | 升級至 `cryptography==50.0.1` 與 `setuptools==84.0.0` | 消除 Dependabot alerts #1、#2(CVE-2026-69247 高風險 Bleichenbacher oracle 漏洞與 CVE-2026-59890 中風險 Unicode 規範化衝突),且完全符合 direct pin bounds | **保留或隨上游更新**。若上游後續釋出更新包含安全版本,則直接同步覆蓋 |
4851

4952
## 已知但**不**登記為分岔的上游問題
5053

‎tests/unit/test_input_handler.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,12 +268,12 @@ def test_secure_open_traverses_search_only_ancestors(tmp_path: Path) -> None:
268268
parent.mkdir()
269269
source = parent / "SKILL.md"
270270
source.write_text("# Skill", encoding="utf-8")
271-
os.chmod(parent, 0o111)
271+
os.chmod(parent, 0o100)
272272
try:
273273
with _open_regular_file_no_follow(source) as opened:
274274
assert opened.read() == b"# Skill"
275275
finally:
276-
os.chmod(parent, 0o755)
276+
os.chmod(parent, 0o700)
277277

278278

279279
def test_resolve_file_rejects_platform_without_safe_open_support(

‎tests/unit/test_input_handler_ssrf.py‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -213,12 +213,10 @@ class TestAllowlistConfiguration:
213213
"""Allowlists contain expected hosts."""
214214

215215
def test_git_hosts_include_major_forges(self) -> None:
216-
assert "github.com" in ALLOWED_GIT_HOSTS
217-
assert "gitlab.com" in ALLOWED_GIT_HOSTS
218-
assert "bitbucket.org" in ALLOWED_GIT_HOSTS
216+
assert {"github.com", "gitlab.com", "bitbucket.org"}.issubset(ALLOWED_GIT_HOSTS)
219217

220218
def test_download_hosts_include_raw_github(self) -> None:
221-
assert "raw.githubusercontent.com" in ALLOWED_DOWNLOAD_HOSTS
219+
assert {"raw.githubusercontent.com"}.issubset(ALLOWED_DOWNLOAD_HOSTS)
222220

223221
def test_download_hosts_include_huggingface(self) -> None:
224-
assert "huggingface.co" in ALLOWED_DOWNLOAD_HOSTS
222+
assert {"huggingface.co"}.issubset(ALLOWED_DOWNLOAD_HOSTS)

0 commit comments

Comments
 (0)