PAT redaction from #342 is applied at one call site: `comfy distribution scan` re-leaks the token
维护者通常 1 天内回复
@sundar-svg 已经在做这个了。
开始于 2026年8月21日。
评估
这个 Issue 还没有评估数据。
描述
Summary
Issue #342 ("Automatically erase github personal access token from url") was fixed in PR #376 by adding _strip_url_credentials() and calling it on the remote URL that comfy node init writes into pyproject.toml.
That guard is applied at exactly one call site. comfy distribution scan, added later in comfy_cli/command/distribution.py, reads git remote get-url origin raw and both prints it to stdout and embeds it in the emitted distribution definition. A custom node checked out over HTTPS-with-token therefore leaks the PAT again, in a new command, exactly the way comfy node init did before #342.
This is filed as a closed-bug regression, not as a new vulnerability class: the project already decided this string must be redacted, wrote the redactor, and shipped it. What is missing is the application of the existing rule to a new sink, plus a test that would have caught it.
Where
Redactor, and its only call site:
comfy_cli/registry/config_parser.py:226—def _strip_url_credentials(url: str) -> str:comfy_cli/registry/config_parser.py:248— the one and only call
A repo-wide control grep returns exactly those two hits:
$ git grep -n '_strip_url_credentials' origin/main -- comfy_cli/
comfy_cli/registry/config_parser.py:226:def _strip_url_credentials(url: str) -> str:
comfy_cli/registry/config_parser.py:248: git_remote_url = _strip_url_credentials(git_remote_url)
Unguarded sink, with the full path from read to disclosure:
| Step | Location |
|---|---|
| raw remote URL read, no redaction | comfy_cli/command/distribution.py:196 |
| stored on the node record | comfy_cli/command/distribution.py:201 |
| copied into the distribution definition | comfy_cli/command/distribution.py:480 |
| printed to stdout in the scan table | comfy_cli/command/distribution.py:607 |
Line 196 verbatim:
repository = _git_output(entry, "remote", "get-url", "origin") if is_git else None
A third raw reader exists at comfy_cli/command/outdated.py:382 (used for ls-remote); it does not appear to reach output, so it is noted rather than claimed.
Reproduction
No install required — the leak is a pure string path.
# a custom node cloned with a token in the remote, which is what the PAT-in-URL
# workflow #342 was filed about actually produces
cd "$COMFY/custom_nodes"
git clone https://[email protected]/acme/my-node.git
cd "$COMFY" && comfy distribution scan
Observed: the repository column of the scan table prints
https://[email protected]/acme/my-node.git,
and the same string is written into the definition emitted for the builder.
Expected (the #342 contract): https://github.com/acme/my-node.git.
Control that the redactor is correct and simply not invoked here — _strip_url_credentials returns the stripped form for this exact input; comfy node init in the same working tree emits the redacted URL, comfy distribution scan does not.
Why no test caught it
tests/comfy_cli/registry/test_config_parser.py:914 parametrizes 12 credential shapes, but every case calls _strip_url_credentials directly. Nothing asserts that any particular sink is redacted, so a new sink cannot fail an existing test.
Suggested fix
Route distribution.py:196 (and outdated.py:382) through the existing helper, promoting it out of registry/ to a shared location, then add a sink-level test rather than another unit test of the redactor:
- Layer: unit
- File:
tests/comfy_cli/command/test_distribution.py - Asserts: given a custom-node dir whose
git remote get-url originreturns a token URL, the record produced by the scan and the row rendered at:607both containgithub.com/acme/my-nodeand do not containghp_.
A stronger guard, since this is now the second occurrence of the same miss: assert repo-wide that no get-url result reaches output unredacted.
Related, not duplicate: the redactor itself misses three shapes
Measured by executing the real _strip_url_credentials bytes from origin/main (extracted with git show, no reimplementation, stdlib only), with both a positive and a negative control:
CONTROL https+token -> https://github.com/acme/my-node.git token survives? False
CONTROL plain https -> https://github.com/acme/my-node.git token survives? False
VARIANT scp-style -> [email protected]:acme/my-node.git token survives? True
VARIANT query string-> https://github.com/acme/my-node.git?access_token=... token survives? True
VARIANT ssh://+token-> ssh://[email protected]/acme/my-node.git token survives? True
So even the guarded comfy node init path leaks for these three shapes:
- scp-style remotes have no URL scheme, so
config_parser.py:228(parsed.scheme in ("http", "https")) skips them. This is the most realistic of the three for a git remote. ssh://URLs carry userinfo but fail the same scheme check.- token-in-query-string is not considered at all.
None of the three is in the 12-case parametrize at tests/comfy_cli/registry/test_config_parser.py:914, which is why they are invisible today.
- 主要语言
- Python
- 星标
- 1k
- 派生
- 176
- 平均合并
- 1 天 11 小时
- 30 天内合并 PR
- 87
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Comfy-Org/comfy-cli 的其他 Issue
-
test_file_utils umask tests assert against a umask the code never reads (import-time _UMASK), so they only pass on a 0o022 host可能已有人在做 @neverbiasu 于 10 天前认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 86/100
Comfy-Org/comfy-cli#907 · 1 条评论 ·
维护者通常 1 天内回复
-
bug
难度 1/5 1 小时以内 新手友好度 92/100
Comfy-Org/comfy-cli#781 · 1 条评论 ·
维护者通常 1 天内回复
-
`comfy launch --background` fails with FileNotFoundError when comfy-cli is invoked by path可能已有人在做 @RaphaelFakhri 于 43 天前认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 78/100
Comfy-Org/comfy-cli#691 · 1 条评论 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 68/100
Comfy-Org/comfy-cli#670 · 2 条评论 ·
维护者通常 1 天内回复
查看 Comfy-Org/comfy-cli 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 65/100
StevenBlack/hosts#3299 ·
-
`garak --report` overwrites the input report when its name has no ".report"可能已有人在做 @0z5a 今天认领。 未关闭needs-triage
难度 2/5 半天 新手友好度 72/100
维护者通常 2 天内回复
-
plot_graph crashes when a mesh node has no m2m edge可能已有人在做 @tygvi 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
mllam/neural-lam#883 · 1 条评论 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
future-agi/future-agi#4092 · 1 条评论 ·
维护者通常 1 天内回复
-
transcript analytics: a text whose only protected spans the prose pass redacts is withheld whole未关闭
难度 1/5 1 小时以内 新手友好度 82/100
WingedGuardian/GENesis-AGI#4641 ·
维护者通常 1 天内回复