Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

SARIF result not uploaded

未关闭
#1,058 11 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
cmake, cpp, github-actions
领域
ci-cd, security

调研方向

从 issue 中所示的 Windows workflow 开始,重点检查 MSVC Code Analysis 步骤和 github/codeql-action/upload-sarif@v2 步骤。检查 run-analysis 的 sarif 输出,并将此上传路径与正常工作的 Ubuntu 配置进行比较。当 MSVC SARIF 结果出现在 repository 的 Code Scanning Alerts 中时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

question

Hi,

I'm trying to setup a basic code analysis in my CI on my project.

I setup CodeQL for Ubuntu, worked first time.

I tried to set up the same for Windows using this :

https://devblogs.microsoft.com/cppblog/microsoft-cpp-code-analysis-with-github-actions/

The workflow started and completed fine, except this :

image

The result of the MSCV check is not displayed in the Code Scanning Alert in the Security tab of my project, the Ubuntu one is.

I can get the SARIF file as an artifact, just not get it to display properly on the project page.

How can I solve this ?
Thanks in advance

The yml code is the basic one :

name: Microsoft C++ Code Analysis

on:
  push:
    branches: [ main, dev, Basic_Protections ]
  pull_request:
    branches: [ main ]
    
env:
  # Path to the CMake build directory.
  build: '${{ github.workspace }}/build'

permissions:
  contents: read

jobs:
  analyze:
    permissions:
      contents: read # for actions/checkout to fetch code
      security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
    name: Analyze
    runs-on: windows-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v3

      - name: Configure CMake
        run: cmake -B ${{ env.build }}

      # Build is not required unless generated source files are used
      # - name: Build CMake
      #   run: cmake --build ${{ env.build }}

      - name: Initialize MSVC Code Analysis
        uses: microsoft/msvc-code-analysis-action@04825f6d9e00f87422d6bf04e1a38b1f3ed60d99
        # Provide a unique ID to access the sarif output path
        id: run-analysis
        with:
          cmakeBuildDirectory: ${{ env.build }}
          # Ruleset file that will determine what checks will be run
          ruleset: NativeRecommendedRules.ruleset

      # Upload SARIF file to GitHub Code Scanning Alerts
      - name: Upload SARIF to GitHub
        uses: github/codeql-action/upload-sarif@v2
        with:
          sarif_file: ${{ steps.run-analysis.outputs.sarif }}

      # Upload SARIF file as an Artifact to download and view
      # - name: Upload SARIF as an Artifact
      #   uses: actions/upload-artifact@v3
      #   with:
      #     name: sarif-file
      #     path: ${{ steps.run-analysis.outputs.sarif }}

The problem happens ath the Upload

主要语言
TypeScript
星标
1.6k
派生
493
平均合并
1 天 13 小时
30 天内合并 PR
44

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

github/codeql-action 的其他 Issue

查看 github/codeql-action 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。