usage

GitHub CLI 2.106.0

工具與目錄
在這頁

修正 1 項

01

修補七項安全漏洞並強化憑證管理

常用 GitHub CLI 的話,請盡快升到 v2.106.0。新版修補七項漏洞,過濾指令與記錄裡的終端機控制字元,並防範更新同名 skill 與 Codespace 外洩本機服務。

gh auth logout 會先撤銷 OAuth token(授權令牌),再刪除本機與 Git 憑證輔助工具裡的憑證。想保留 token 只登出本機,可加 --no-revoke。

低於 3.23 版的 GitHub Enterprise Server 要求有時限憑證時,會印出警告並改用不設期限的備援 token:

```bash # 安全漏洞修正(含 HTTP 詳細與 API 除錯記錄過濾請求與回應控制字元) gh repo read-file / gh api # 識別 C1 控制字元,避免未過濾輸出進入終端機 gh codespace ports # 不再印出通訊埠標籤的終端機控制字元 gh agent-task view --log # 不再印出工具呼叫名稱與參數的控制字元 gh skill install / gh skill search # 不再印出遠端 skill 文字的控制字元 gh skill update # 防止從其他儲存庫安裝沿用同名的 skill gh codespace jupyter # 防止連向惡意 Codespace 時外洩本機 Cookie 與本機開發服務

# 登出與低於 3.23 版 GitHub Enterprise Server 憑證備援 gh auth logout # 先撤銷所選帳號的 GitHub CLI OAuth token 再刪本機憑證 gh auth logout --no-revoke # 維持舊版只登出本機,保留 token 有效 gh auth login / gh auth refresh # 低於 3.23 版改用不設期限的備援 token,適用 expiring_credentials 設定 ```

打個比方

像飯店退房以前只收走你手上的房卡,外面備份還能刷;現在會同步註銷帳號權限,並封住假名牌與外洩漏洞。

官方原文

## Security

Seven security vulnerabilities have been identified and fixed in this release. Users are advised to update gh to version v2.106.0 as soon as possible.

1. The terminal escape-sequence check used by gh repo read-file, gh api, and other commands did not recognize C1 control characters, allowing untrusted output to reach a terminal without neutralization.

See https://github.com/cli/cli/security/advisories/GHSA-45h6-2fh4-pr93 for more information.

2. Verbose and API-debug HTTP logging could print untrusted terminal control characters from request and response data.

See https://github.com/cli/cli/security/advisories/GHSA-4946-22jg-pg7m for more information.

3. gh codespace ports could print untrusted terminal control characters from port labels.

See https://github.com/cli/cli/security/advisories/GHSA-5v78-vjjq-j2fj for more information.

4. gh agent-task view --log could print untrusted terminal control characters from tool-call names and arguments.

See https://github.com/cli/cli/security/advisories/GHSA-3j6c-526c-w465 for more information.

5. gh skill update could install a skill from a different repository that reused the installed skill's name.

See https://github.com/cli/cli/security/advisories/GHSA-q2rq-2r2v-2jm5 for more information.

6. gh skill install and gh skill search could print untrusted terminal control characters from remote skill text.

See https://github.com/cli/cli/security/advisories/GHSA-mjfw-qpmw-c8p9 for more information.

7. gh codespace jupyter could expose localhost cookies and local development services when connecting to a malicious Codespace.

See https://github.com/cli/cli/security/advisories/GHSA-mrhx-xw2w-4289 for more information.

## Improved authentication security on logout

gh auth logout now revokes the selected account's GitHub CLI OAuth token before removing local credentials. Use --no-revoke to preserve the legacy local-only logout, leaving the token valid.

gh now also removes saved HTTPS credentials for the host from Git credential helpers.

## Make expiring tokens more reliable

On GitHub Enterprise Server before 3.23, requests for expiring credentials now fall back to a non-expiring token with a warning instead of failing with invalid_scope. This applies to gh auth login, gh auth refresh, and the expiring_credentials setting.