ドキュメントには頻繁に更新が加えられ、その都度公開されています。本ページの翻訳はまだ未完成な部分があることをご了承ください。最新の情報については、英語のドキュメンテーションをご参照ください。本ページの翻訳に問題がある場合はこちらまでご連絡ください。

Managing code scanning alerts for your repository

From the security view, you can view, fix, or close alerts for potential vulnerabilities or errors in your project's code.

If you have write permission to a repository you can manage code scanning alerts for that repository.

Code scanning is available if you have an Advanced Security license.

ここには以下の内容があります:

ノート: Code scanningは現在ベータで、変更されることがあります。 For more information about taking part in the beta, sign up here.

code scanning からのアラートについて

You can set up code scanning to check the code in a repository using the default CodeQL analysis, a third-party analysis, or multiple types of analysis. When the analysis is complete, the resulting alerts are displayed alongside each other in the security view of the repository. Results from third-party tools or from custom queries may not include all of the properties that you see for alerts detected by GitHub's default CodeQL analysis. デフォルトの code scanning ワークフローは、on.push イベントを使用して、ワークフローファイルを含むブランチへのプッシュごとにコードスキャンをトリガーします。

By default, code scanning analyzes your code periodically on the default branch and during pull requests. For information about managing alerts on a pull request, see "Triaging code scanning alerts in pull requests."

About alerts details

Each alert highlights a problem with the code and the name of the tool that identified it. アラートをトリガーしたコード行と、アラートのプロパティ(問題の重要度や性質など)を確認できます。 アラートは、問題が最初に発生したときにも通知します。 For alerts identified by CodeQL analysis, you will also see information on how to fix the problem.

code scanning からのアラートの例

If you enable code scanning using CodeQL, this can also detect data-flow problems in your code. Data-flow analysis finds potential security issues in code, such as: using data insecurely, passing dangerous arguments to functions, and leaking sensitive information.

code scanning がデータフローアラートを報告すると、GitHub はデータがコードを通してどのように移動するかを示します。 Code scanning allows you to identify the areas of your code that leak sensitive information, and that could be the entry point for attacks by malicious users.

Viewing the alerts for a repository

Anyone with read permission for a repository can see code scanning annotations on pull requests. For more information, see "Triaging code scanning alerts in pull requests."

You need write permission to view a summary of all the alerts for a repository on the Security tab. By default, alerts are shown for the default branch.

  1. GitHub Enterprise Serverで、リポジトリのメインページにアクセスしてください。
  2. リポジトリ名の下で Security(セキュリティ)をクリックしてください。
    セキュリティのタブ
  3. 左のサイドバーで、Code scanning alerts(コードスキャンニングアラート)をクリックしてください。 あるいは、利用しているコードスキャンニングツールを選択してください。
    "コードスキャンニングアラート"タブ
  4. Under "Code scanning," click the alert you'd like to explore.
    Summary of alerts
  5. Optionally, if the alert highlights a problem with data flow, click Show paths to display the path from the data source to the sink where it's used.
    The "Show paths" link on an alert
  6. Alerts from CodeQL analysis include a description of the problem. Click Show more for guidance on how to fix your code.
    Details for an alert

Fixing an alert

Anyone with write permission for a repository can fix an alert by committing a correction to the code. If the repository has code scanning scheduled to run on pull requests, it's best to raise a pull request with your correction. This will trigger code scanning analysis of the changes and test that your fix doesn't introduce any new problems. For more information, see "Configuring code scanning" and "Triaging code scanning alerts in pull requests."

If you have write permission for a repository, you can view fixed alerts by viewing the summary of alerts and clicking Closed. For more information, see "Viewing the alerts for a repository." The "Closed" list shows fixed alerts and alerts that users have closed.

Alerts may be fixed in one branch but not in another. You can use the "Branch" drop-down menu, on the summary of alerts, to check whether an alert is fixed in a particular branch.

Filtering alerts by branch

アラートを閉じる

Closing an alert is a way to resolve an alert that you don't think needs to be fixed. For example, an error in code that's used only for testing, or when the effort of fixing the error is greater than the potential benefit of improving the code.

  1. GitHub Enterprise Serverで、リポジトリのメインページにアクセスしてください。

  2. リポジトリ名の下で Security(セキュリティ)をクリックしてください。

    セキュリティのタブ

  3. 左のサイドバーで、Code scanning alerts(コードスキャンニングアラート)をクリックしてください。 あるいは、利用しているコードスキャンニングツールを選択してください。

    "コードスキャンニングアラート"タブ

  4. Under "Code scanning," click the alert you'd like to explore.

    code scanningからのアラートのリスト

  5. Select the Close drop-down menu and click a reason for closing the alert.

    Choosing reason for closing the alert via the Close drop-down

If you close a CodeQL alert as a false positive result, for example because the code uses a sanitization library that isn't supported, consider contributing to the CodeQL repository and improving the analysis. For more information about CodeQL, see "Contributing to CodeQL."

参考リンク

Did this doc help you?

Privacy policy

Help us make these docs great!

All GitHub docs are open source. See something that's wrong or unclear? Submit a pull request.

Make a contribution

OR, learn how to contribute.