Skip to main content

Configuring advanced setup for code scanning

You can configure advanced setup for a repository to find security vulnerabilities in your code using a highly customizable code scanning configuration.

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

리포지토리 소유자, 조직 소유자, 보안 관리자 및 관리자 역할이 있는 사용자

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

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

참고 항목

사이트 관리자가 먼저 code scanning을 사용하도록 설정해야 이 기능을 사용할 수 있습니다. GitHub Actions를 사용하여 코드를 스캔하려면 사이트 관리자도 GitHub Actions를 사용하도록 설정하고 필요한 인프라를 설정해야 합니다. 자세한 내용은 어플라이언스에 대한 코드 검사 구성을(를) 참조하세요.

About advanced setup for code scanning

Advanced setup for code scanning is helpful when you need to customize your code scanning. By creating and editing a workflow file, you can define how to build compiled languages, choose which queries to run, select the languages to scan, use a matrix build, and more. You also have access to all the options for controlling workflows, for example: changing the scan schedule, defining workflow triggers, specifying specialist runners to use. For more information about GitHub Actions workflows, see 워크플로.

Your site administrator can also make third-party actions available to users for code scanning, by setting up GitHub Connect. For more information, see 어플라이언스에 대한 코드 검사 구성.

여러 구성을 사용하여 코드 검사를 실행할 때 경고의 분석 원본이 여러 개 있는 경우가 가끔 있습니다. 경고에 여러 분석 원본이 있는 경우 경고 페이지에서 각 분석 원본에 대한 경고 상태를 볼 수 있습니다. 자세한 내용은 코드 검사 경고 정보을(를) 참조하세요.

참고 항목

이 문서에서는 이 GitHub Enterprise Server 버전의 초기 릴리스에 포함된 CodeQL 작업과 관련 CodeQL CLI 번들의 버전에서 사용할 수 있는 기능을 설명합니다. 엔터프라이즈에서 더 최신 버전의 CodeQL 작업을 사용하는 경우, 최신 기능에 대한 자세한 내용은 이 문서의GitHub Enterprise Cloud 버전을 참조하세요. 최신 버전 사용에 대한 자세한 내용은 어플라이언스에 대한 코드 검사 구성을(를) 참조하세요.

If you do not need a highly customizable code scanning configuration, consider using default setup for code scanning. For more information on eligibility for default setup, see Configuring default setup for code scanning.

Prerequisites

Your repository is eligible for advanced setup if it meets these requirements.

  • It uses CodeQL-supported languages or you plan to generate code scanning results with a third-party tool.
  • GitHub Actions가 사용됩니다.
  • GitHub Code Security가 사용됩니다.

If the server on which you are running GitHub Enterprise Server is not connected to the internet, your site administrator can enable CodeQL code scanning by making the CodeQL analysis bundle available on the server. For more information, see 어플라이언스에 대한 코드 검사 구성.

Configuring advanced setup for code scanning with CodeQL

You can customize your CodeQL analysis by creating and editing a workflow file. Selecting advanced setup generates a basic workflow file for you to customize using standard workflow syntax and specifying options for the CodeQL action. See 워크플로 and Customizing your advanced setup for code scanning.

  1. GitHub에서 리포지토리의 기본 페이지로 이동합니다.

  2. 리포지토리 이름 아래에서 Settings를 클릭합니다. "설정" 탭이 표시되지 않으면 드롭다운 메뉴를 선택한 다음 설정을 클릭합니다.

    탭을 보여 주는 리포지토리 헤더의 스크린샷. "설정" 탭이 진한 주황색 윤곽선으로 강조 표시됩니다.

  3. 사이드바의 "Security" 섹션에서 Advanced Security 를 클릭합니다.

  4. Scroll down to "Code Security", in the "CodeQL analysis" row select Set up , then click Advanced.

    참고 항목

    If you are switching from default setup to advanced setup, in the "CodeQL analysis" row, select , then click Switch to advanced. In the pop-up window that appears, click Disable CodeQL.

    Screenshot of the "Code Security" section of "Advanced Security" settings. The "Advanced setup" button is highlighted with an orange outline.

  5. To customize how code scanning scans your code, edit the workflow.

    Generally, you can commit the CodeQL 분석 워크플로 without making any changes to it. However, many of the third-party workflows require additional configuration, so read the comments in the workflow before committing.

    For more information, see Customizing your advanced setup for code scanning and CodeQL code scanning for compiled languages.

  6. Click Commit changes... to display the commit changes form.

    Screenshot of the form to create a new file. To the right of the file name, a green button, labeled "Commit changes...", is outlined in dark orange.

  7. In the commit message field, type a commit message.

  8. Choose whether you'd like to commit directly to the default branch, or create a new branch and start a pull request.

  9. Click Commit new file to commit the workflow file to the default branch or click Propose new file to commit the file to a new branch.

  10. If you created a new branch, click Create pull request and open a pull request to merge your change into the default branch.

In the suggested CodeQL 분석 워크플로, code scanning is configured to analyze your code each time you either push a change to the default branch or any protected branches, or raise a pull request against the default branch. As a result, code scanning will now commence.

The on:pull_request and on:push triggers for code scanning are each useful for different purposes. See Customizing your advanced setup for code scanning and 워크플로 트리거.

For information on bulk enablement, see 대규모 CodeQL 코드 스캔을 위한 고급 설정 구성.

Next steps

After your workflow runs successfully at least once, you are ready to start examining and resolving code scanning alerts. For more information on code scanning alerts, see 코드 검사 경고 정보 and 리포지토리에 대한 코드 검사 경고 평가.

Learn how code scanning runs behave as checks on pull requests, see 끌어오기 요청에서 코드 검사 경고 심사.

You can find detailed information about your code scanning configuration, including timestamps for each scan and the percentage of files scanned, on the tool status page. For more information, see About the tool status page for code scanning.

Further reading