CI: dotnet.yml expands GitVersion outputs directly into bash run scripts

オープン 初心者向け
#7,229 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

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

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
csharp, github-actions
領域
ci-cd, security

調査の方向性

.github/workflows/dotnet.ymlを読み、GitVersionの処理方法を.github/workflows/aot.ymlと比較してください。issueによると、後者ではすでにより安全なパターンが使われています。指定された2つのステップを更新し、ステップレベルのenv:を通じてoutputsを渡してシェル変数を使うようにしてください。説明にあるとおり、Buildステップの重複した-p:引数を削除してください。両方のスクリプトでGitVersionのoutputsをシェルソースに補間せず、workflowが引き続き同じバージョン値をエクスポートしてビルドできれば完了です。

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

説明

bug github_actions P2

What: .github/workflows/dotnet.yml interpolates GitVersion outputs straight into shell source with ${{ steps.gitversion.outputs.* }}, in two places:

  • the "Export version env vars" step (echo "InformationalVersion=${{ steps.gitversion.outputs.informationalVersion }}" and four siblings)
  • the "Build" step ("-p:InformationalVersion=${{ steps.gitversion.outputs.informationalVersion }}" and four siblings)

InformationalVersion carries branch-derived metadata. workflow_dispatch lets a user pick the branch, and GitVersion only replaces / with - in it, so a branch name containing $(...) would run as command substitution in the runner shell. Only users with write access can dispatch, so the risk is low, but the fix is cheap.

Where found: CodeRabbit flagged the same pattern in the new .github/workflows/aot.yml on PR #7226, which fixed it there (commit 00bb8b0fc8). dotnet.yml was left alone to keep that PR in scope.

Expected: pass the outputs through step-level env: and reference them as $VAR in the scripts, as aot.yml now does. The Build step can drop its -p: arguments entirely, because the export step already puts the same values in GITHUB_ENV and MSBuild binds them as global properties.

主要言語
C#
スター
4k
フォーク
139
平均マージ
7時間 16分
マージ済み PR(30日)
355

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

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

thomhurst/TUnit のほかの issue

thomhurst/TUnit の issue をすべて見る

似ている issue

C# の issue をもっと見る

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

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