bug: 已有 upstream 时直接 git push 会绕过受保护分支和远端校验

オープン
#375 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
git, markdown
領域
devtools

調査の方向性

Read .agents/skills/git-push/SKILL.md around line 19, then compare the upstream checks in the resolve-pr entry point and docs/local-development-flow.md around line 28. Trace how the skill chooses a push target when an upstream is set and how push.default affects it. Done means the documented push flow validates the remote and target branch and cannot push to a protected or shared branch implicitly.

索引モデルが issue の本文から書いたものです。

説明

area:skills bug repro:high triaged

问题位置

.agents/skills/git-push/SKILL.md:19

触发条件

在 fork 或多 remote 仓库中,当前功能分支的同名 upstream 指向 canonical 仓库的 upstream/,或 upstream 指向 origin/main 且用户配置了 push.default=upstream 或 matching;用户执行 $git-push。

实际影响

无 refspec 的 git push 会按 upstream 或 push.default 推送到非预期 remote/ref:可能把功能提交直接快进到 canonical 仓库或 main 等共享分支,而技能只按当前分支名拒绝 main/master/develop,实际目标分支的保护被绕过。

核实依据

第 11 行要求检查 upstream,但第 12 行只拒绝当前分支名;第 16-20 行发现 upstream 后直接执行 git push,没有验证 upstream 指向的 remote 是否可写、目标 ref 是否为受保护或共享分支,也没有显式指定 /。Git 的 push.default=upstream 会让功能分支推送到其 upstream(例如 origin/main),matching 还会更新同名分支。项目内 resolve-pr 第 22-25 行会先确认 upstream 指向可写 remote;docs/local-development-flow.md 第 28 行也宣称 git-push 应避免误推共享分支,因此这里存在明确的安全缺口。

扫描提交:e777f60106e401b086925270af317a4b36722be0;扫描日期:2026-11-29(北京时间);轮巡分片:59/90。

主要言語
Python
スター
171
フォーク
24
平均マージ
3時間 13分
マージ済み PR(30日)
13

環境構築

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Terry-Mao/AICodingFlow のほかの issue

Terry-Mao/AICodingFlow の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。