Skip to main content
Skip to content

코드 검사 병합 보호 설정

검사에 실패한 code scanning 끌어오기 요청을 차단하여 코드베이스를 보호합니다.

누가 이 기능을 사용할 수 있나요?

관리자 역할이 있는 조직 소유자, 보안 관리자 및 조직 구성원

Code scanning은 다음 리포지토리 유형에서 사용할 수 있습니다.

  • GitHub.com에 대한 퍼블릭 리포지토리
  • GitHub Team, GitHub Enterprise Cloud 또는 GitHub Enterprise Server에 대한 조직 소유의 리포지토리로, GitHub Code Security 가 활성화되어 있습니다.

Creating a merge protection ruleset for a repository

  1. On GitHub, navigate to the main page of the repository.

  2. Under your repository name, click Settings. If you cannot see the "Settings" tab, select the dropdown menu, then click Settings.

    Screenshot of a repository header showing the tabs. The "Settings" tab is highlighted by a dark orange outline.

  3. In the left sidebar, under "Code, planning, and automation", click Rulesets, then click Rulesets.

  4. Click New ruleset.

  5. To create a ruleset targeting branches, click New branch ruleset.

  6. Under "Ruleset name," type a name for the ruleset.

  7. Optionally, to change the default enforcement status, click Disabled and select an enforcement status.

  8. Under "Branch protections", select Require code scanning results.

  9. Under "Required tools and alert thresholds", click Add tool and select a code scanning tool with the dropdown. For example, "CodeQL".

  10. Next to the name of a code scanning tool:

    • Click Alerts and select one of: None, Errors, Errors and Warnings or All.
    • Click Security alerts and select one of: None, Critical, High or higher, Medium or higher, or All.

    Screenshot of the "Required tools and alert thresholds" section of "Rulesets" settings.

For more information about alert severity and security severity levels, see 코드 검사 경고.

For more information about managing rulesets in a repository, see 리포지토리에 대한 규칙 세트 관리.

Creating a merge protection ruleset for all repositories in an organization

  1. In the upper-right corner of GitHub, click your profile picture, then click Organizations.

  2. Select an organization by clicking on it.

  3. Under your organization name, click Settings. If you cannot see the "Settings" tab, select the dropdown menu, then click Settings.

    Screenshot of the tabs in an organization's profile. The "Settings" tab is outlined in dark orange.

  4. In the sidebar, under "Code, planning, and automation", click Repository, then click Rulesets.

  5. Click New ruleset.

  6. To create a ruleset targeting branches, click New branch ruleset.

  7. Under "Ruleset name," type a name for the ruleset.

  8. Optionally, to change the default enforcement status, click Disabled and select an enforcement status.

  9. Under "Branch protections", select Require code scanning results.

  10. Under "Required tools and alert thresholds", click Add tool and select a code scanning tool with the dropdown. For example, "CodeQL".

  11. Next to the name of a code scanning tool:

    • Click Alerts and select one of: None, Errors, Errors and Warnings or All.
    • Click Security alerts and select one of: None, Critical, High or higher, Medium or higher, or All.

    Screenshot of the "Required tools and alert thresholds" section of "Rulesets" settings.

For more information about alert severity and security severity levels, see 코드 검사 경고.

For more information about managing rulesets for repositories in an organization, see 조직의 리포지토리에 대한 규칙 집합 관리.

Creating a merge protection ruleset with the REST API

You can use the REST API to create a ruleset with the code_scanning rule, which allows you to define specific tools and set alert thresholds. For more information, see 규칙에 대한 REST API 엔드포인트.