Note: Secret scanning for organization-owned private repositories is currently in beta and subject to change.
Note: Secret scanning is enabled by default on public repositories and cannot be turned off. You can configure secret scanning for your private repositories only.
Enabling secret scanning for private repositories
-
GitHubで、リポジトリのメインページにアクセスしてください。
-
リポジトリ名の下で Settings(設定)をクリックしてください。
-
左のサイドバーで、Security & analysis(セキュリティと分析)をクリックしてください。
-
If "Secret scanning" is not shown on the page, you need to enable GitHub Advanced Security first. To the right of "GitHub Advanced Security", click Enable.
-
Click Enable GitHub Advanced Security for this repository to confirm the action.
-
When you enable GitHub Advanced Security this may automatically enable secret scanning for the repository (this is controlled by the organization configuration). If "Secret scanning" is shown with an Enable button, you still need to enable secret scanning by clicking Enable. If you see a Disable button, secret scanning is already enabled.
Excluding alerts from secret scanning in private repositories
secret_scanning.yml ファイルを使用して、secret scanning からディレクトリを除外できます。 たとえば、テストまたはランダムに生成されたコンテンツを含むディレクトリを除外できます。
-
GitHubで、リポジトリのメインページにアクセスしてください。
-
Above the list of files, using the Add file drop-down, click Create new file.
-
ファイル名フィールドに、.github/secret_scanning.yml と入力します。
-
[Edit new file] に
paths-ignore:
と入力してから、secret scanning から除外するパスを入力します。paths-ignore: - "foo/bar/*.js"
*
などの特殊文字を使用して、パスをフィルタできます。 フィルタパターンに関する詳しい情報については、「GitHub Actionsのワークフロー構文」を参照してください。ノート:
paths-ignore
に 1,000 以上のエントリがある場合、secret scanning は最初の 1,000 ディレクトリのみをスキャン対象から除外します。- secret_scanning.yml が 1MB 以上ある場合、secret scanning はファイル全体を無視します。
secret scanning からの個々のアラートを無視することもできます。 詳しい情報については、「secret scanning からのアラートを管理する」を参照してください。