Upload-sarif action doesn't seem to respect "uriBaseId" in SARIF files

オープン
#2,215 コメント 9 件 リアクション 2 件 担当者 0 名 GitHub で見る

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
42/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
github-actions, typescript
領域
ci-cd, security

調査の方向性

まず Android Lint SARIF の例で問題を再現し、v2 upload-sarif action がアーティファクトの場所をどのように解決するかを追跡します。originalUriBaseIds と uriBaseId の処理を確認し、次に解決されたパスに設定済みのベースディレクトリが含まれていること、および fingerprinting と code scanning がソースファイルを特定することを確認します。

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

説明

We're using "Android Lint" to generate a sarif file. The sarif locations use this pattern:

            "originalUriBaseIds": {
                "%SRCROOT%": {
                    "uri": "file:///runner/_work/myrepo/myrepo/some/repo/dir/"
                }
            },
            ...
                             "physicalLocation": {
                                "artifactLocation": {
                                    "uriBaseId": "%SRCROOT%",
                                    "uri": "src/main/kotlin/Foo.kt"
                                },

The artifact location is relative to this uriBaseId. This is a reference to originalUriBaseIds, which the SARIF spec says should be used by consumers to find the absolute path.

However, the upload-sarif action debug logs show lines such as this:

##[debug]Unable to compute fingerprint for non-existent file: /runner/_work/myrepo/myrepo/src/main/kotlin/Foo.kt

which shows that it's not resolving paths using that %SRCROOT% path -- the correct path would be /runner/_work/myrepo/myrepo/some/repo/dir/src/main/kotlin/Foo.kt. We also see that the code scanning page says src/main/kotlin/Foo.kt can't be found in our repo ("Sorry, we couldn't find this file in the repository.").

(Caveat: we're using v2 because we can't use node20 in our private runners yet)

主要言語
TypeScript
スター
1.6k
フォーク
493
平均マージ
1日 13時間
マージ済み PR(30日)
44

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

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

github/codeql-action のほかの issue

github/codeql-action の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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