Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

[Windows] 插件安装管线文本模式写入 vendor 资源:CRLF 注入致 sha256 全失配与渲染损坏(visualize 0.1.0 实证)

Offen
#109 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
74/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
node.js, python
Bereich
desktop-dev, tooling

Rechercherichtung

Trace the Windows plugin vendor extraction and file-writing path around ~/.zcode/cli/plugins/cache/zcode-plugins-official/visualize/0.1.0/skills/visualize/assets/vendor/, then ensure resources are written as binary data without newline conversion. Use the issue’s Python SHA-256 script to compare installed files with manifest.json, and reproduce against the preserved .backup-crlf-20261016/ sample. Done means restored LF resources match their manifest hashes and installation-time hash verification reports mismatches.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

环境
  • Windows 11 ARM64(10.0.26200)
  • ZCode Desktop(GLM 桌面版)
  • 插件:visualize 0.1.0(zcode-plugins-official 官方市场安装)
  • 路径:~/.zcode/cli/plugins/cache/zcode-plugins-official/visualize/0.1.0/skills/visualize/assets/vendor/
现象

插件 vendor 资源安装后,实际文件 sha256 与该目录 manifest.json 内声明的 sha256 全部不匹配(8/8 MISMATCH),官方导出(render 管线)产物损坏无法渲染。

根因取证(损坏安装产物 vs npm tarball 恢复版)

损坏产物中 所有 LF 行尾被写为 CRLF(文本模式写入的典型特征);从 npm 原版 tarball(sha512 验真)恢复后 8/8 哈希全部 OK:

文件 损坏态字节 恢复态字节 损坏态 CRLF 数 恢复态 CRLF 数
lucide-1.17.0.js 621,166 601,680 19,521 0
d3-7.9.0.min.js 279,708 279,706 2 0
floating-ui-core-1.7.3.min.js 12,530 12,529 1 0
floating-ui-dom-1.7.4.min.js 10,252 10,251 1 0
(4 个 *.LICENSE 同样 100% CRLF,如 MIT LICENSE 20 处)

首个差异字节示例(d3-7.9.0.min.js @ byte 59):

损坏: ...Mike Bostock\r\n!function(t,n){"ob
恢复: ...Mike Bostock\n!function(t,n){"obj

npm 发布的原版资源均为纯 LF;损坏态把每一个 \n 都变成了 \r\n(lucide.js 19,521 行全部命中,膨胀 19.5KB),manifest.json 的 sha256 因此全部失配。

推断与建议
  • 推断:Windows 安装管线在解包/落盘 vendor 资源时走了文本模式(换行转换)而非二进制流写入。
  • 建议:①vendor 资源写入统一走二进制(Buffer/stream,不做 newline 转换);②安装完成后对 manifest 声明的 sha256 做一次自检,失配即重装/告警,避免损坏静默累积到运行期。
  • 现场保留:损坏样本已备份于该 vendor 目录下 .backup-crlf-20261016/,如需原始样本可提供。
最小复现/校验脚本
import hashlib, json
from pathlib import Path
V = Path.home() / ".zcode/cli/plugins/cache/zcode-plugins-official/visualize/0.1.0/skills/visualize/assets/vendor"
m = json.loads((V / "manifest.json").read_text(encoding="utf-8"))
for e in m["resources"]:
    f = V / e["file"]
    actual = hashlib.sha256(f.read_bytes()).hexdigest()
    print(e["file"], "OK" if actual == e["sha256"] else "MISMATCH")

(恢复方法:从 npm registry 拉 tarball,sha512 验真后覆盖 vendor 文件,哈希即全部对上。)

Vorherrschende Sprache
Python
Sterne
103
Forks
78
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus zai-org/zcode-plugins

Alle Issues in zai-org/zcode-plugins

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.