Skip to main content

종속성 검토 구성

종속성 검토를 사용하여 프로젝트에 추가되기 전에 취약성을 포착할 수 있습니다.

종속성 검토 정보

종속성 검토는 모든 끌어오기 요청에서 종속성 변경 내용과 이러한 변경 내용의 보안 영향을 이해하는 데 도움이 됩니다. 끌어오기 요청의 “변경된 파일” 탭에서 서식 있는 Diff로 종속성 변경 내용을 쉽게 이해할 수 있습니다. 종속성 검토는 다음을 알려줍니다.

  • 릴리스 날짜와 함께 추가, 제거 또는 업데이트된 종속성
  • 이러한 구성 요소를 사용하는 프로젝트 수.
  • 이러한 종속성에 대한 취약성 데이터.

자세한 내용은 "종속성 검토 정보" 및 "끌어오기 요청에서 종속성 변경 검토"을 참조하세요.

종속성 검토 구성 정보

종속성 검토는 모든 제품의 모든 퍼블릭 리포지토리에서 사용할 수 있으며 사용하지 않도록 설정할 수 없습니다. 종속성 검토는 GitHub Enterprise Cloud를 사용하고 GitHub Advanced Security에 대한 라이선스가 있는 조직이 소유한 프라이빗 리포지토리에서 사용할 수 있습니다. 자세한 내용은 GitHub Enterprise Cloud 설명서를 참조하세요.

종속성 검토 작업 구성 정보

종속성 검토 작업은 종속성 변경에 대한 pull request를 검색하고 새로운 종속성에 알려진 약점이 있는 경우 오류를 발생시킵니다. 이 작업은 두 수정 버전 간의 종속성을 비교하고 차이점을 보고하는 API 엔드포인트에서 지원됩니다.

작업 및 API 엔드포인트에 대한 자세한 내용은 dependency-review-action 설명서와 "종속성 검토에 대한 REST API 엔드포인트" 항목을 참조하세요.

다음은 일반적인 구성 옵션 목록입니다. 자세한 내용 및 전체 옵션 목록은 GitHub Marketplace에 대한 종속성 검토를 참조하세요.

옵션필수사용
fail-on-severity심각도 수준(low, moderate, high, critical)에 대한 임계값을 정의합니다.
지정된 심각도 수준 이상의 취약성을 발생시키는 끌어오기 요청에서 작업이 실패합니다.
allow-licenses허용된 라이선스의 목록이 포함됩니다. 이 매개 변수에 대한 가능한 값은 API 설명서의 라이선스 페이지에서 찾을 수 있습니다.
이 작업은 목록과 일치하지 않는 라이선스가 있는 종속성을 도입하는 끌어오기 요청에서 실패합니다.
deny-licenses금지된 라이선스의 목록이 포함됩니다. 이 매개 변수에 대한 가능한 값은 API 설명서의 라이선스 페이지에서 찾을 수 있습니다.
목록과 일치하는 라이선스가 부여된 종속성을 도입하는 끌어오기 요청에서 작업이 실패합니다.
comment-summary-in-pr검토 요약의 보고를 끌어오기 요청의 주석으로 사용하거나 사용하지 않도록 설정합니다. 사용하도록 설정된 경우 워크플로 또는 작업에 pull-requests: write 권한을 부여해야 합니다.
allow-ghsas검색하는 동안 건너뛸 수 있는 GitHub Advisory Database ID 목록이 포함되어 있습니다. 이 매개 변수의 가능한 값은 GitHub Advisory Database에서 확인할 수 있습니다.
config-file구성 파일의 경로를 지정합니다. 구성 파일은 리포지토리 또는 외부 리포지토리에 있는 파일에 대해 로컬일 수 있습니다.

팁: allow-licensesdeny-licenses 옵션은 함께 사용할 수 없습니다.

종속성 검토 작업 구성

종속성 검토 작업을(를) 구성하는 방법은 두 가지가 있습니다.

  • 워크플로 파일의 구성 옵션 인라인
  • 워크플로 파일에서 구성 파일 참조

모든 예제에서는 semver 릴리스 번호(예: v3)가 아닌 작업(v3.0.8)에 짧은 버전 번호를 사용합니다. 이렇게 하면 작업의 최신 부 버전을 사용할 수 있습니다.

인라인 구성을 사용하여 종속성 검토 작업 설정

  1. 새로운 YAML 워크플로를 .github/workflows 폴더에 추가합니다.

    YAML
    name: 'Dependency Review'
    on: [pull_request]
    
    permissions:
      contents: read
    
    jobs:
      dependency-review:
        runs-on: ubuntu-latest
        steps:
         - name: 'Checkout Repository'
           uses: actions/checkout@v4
         - name: Dependency Review
           uses: actions/dependency-review-action@v4
    
  2. 설정을 지정합니다.

    이 종속성 검토 작업 예제 파일은 사용 가능한 구성 옵션을 사용하는 방법을 보여 줍니다.

    YAML
    name: 'Dependency Review'
    on: [pull_request]
    
    permissions:
      contents: read
    
    jobs:
      dependency-review:
        runs-on: ubuntu-latest
        steps:
        - name: 'Checkout Repository'
          uses: actions/checkout@v4
        - name: Dependency Review
          uses: actions/dependency-review-action@v4
          with:
            # Possible values: "critical", "high", "moderate", "low"
            fail-on-severity: critical
    
            
            # You can only include one of these two options: `allow-licenses` and `deny-licenses`
            # ([String]). Only allow these licenses (optional)
            # Possible values: Any SPDX-compliant license identifiers or expressions from https://spdx.org/licenses/
            allow-licenses: GPL-3.0, BSD-3-Clause, MIT
            # ([String]). Block the pull request on these licenses (optional)
            # Possible values: Any SPDX-compliant license identifiers or expressions from https://spdx.org/licenses/
            deny-licenses: LGPL-2.0, BSD-2-Clause
            
            # ([String]). Skip these GitHub Advisory Database IDs during detection (optional)
            # Possible values: Any valid GitHub Advisory Database ID from https://github.com/advisories
            allow-ghsas: GHSA-abcd-1234-5679, GHSA-efgh-1234-5679
            
            # ([String]). Block pull requests that introduce vulnerabilities in the scopes that match this list (optional)
            # Possible values: "development", "runtime", "unknown"
            fail-on-scopes: development, runtime
            
    

구성 파일을 사용하여 종속성 검토 작업 설정

  1. .github/workflows 폴더에 새 YAML 워크플로를 추가하고 config-file을 사용하여 구성 파일을 사용 중임을 지정합니다.

    YAML
    name: 'Dependency Review'
    on: [pull_request]
    
    permissions:
     contents: read
    
    jobs:
      dependency-review:
        runs-on: ubuntu-latest
        steps:
        - name: 'Checkout Repository'
          uses: actions/checkout@v4
        - name: Dependency Review
          uses: actions/dependency-review-action@v4
          with:
           # ([String]). Representing a path to a configuration file local to the repository or in an external repository.
           # Possible values: An absolute path to a local file or an external file.
           config-file: './.github/dependency-review-config.yml'
           # Syntax for an external file: OWNER/REPOSITORY/FILENAME@BRANCH
           config-file: 'github/octorepo/dependency-review-config.yml@main'
    
           # ([Token]) Use if your configuration file resides in a private external repository.
           # Possible values: Any GitHub token with read access to the private external repository.
           external-repo-token: 'ghp_123456789abcde'
    
  2. 지정한 경로에 구성 파일을 만듭니다.

    이 YAML 예제 파일은 사용 가능한 구성 옵션을 사용하는 방법을 보여 줍니다.

    YAML
      # Possible values: "critical", "high", "moderate", "low"
      fail-on-severity: critical
    
      # You can only include one of these two options: `allow-licenses` and `deny-licenses`
      # ([String]). Only allow these licenses (optional)
      # Possible values: Any SPDX-compliant license identifiers or expressions from https://spdx.org/licenses/
      allow-licenses:
        - GPL-3.0
        - BSD-3-Clause
        - MIT
       # ([String]). Block the pull request on these licenses (optional)
       # Possible values: Any SPDX-compliant license identifiers or expressions from https://spdx.org/licenses/
      deny-licenses:
        - LGPL-2.0
        - BSD-2-Clause
    
       # ([String]). Skip these GitHub Advisory Database IDs during detection (optional)
       # Possible values: Any valid GitHub Advisory Database ID from https://github.com/advisories
      allow-ghsas:
        - GHSA-abcd-1234-5679
        - GHSA-efgh-1234-5679
    
       # ([String]). Block pull requests that introduce vulnerabilities in the scopes that match this list (optional)
       # Possible values: "development", "runtime", "unknown"
      fail-on-scopes:
        - development
        - runtime
    
    

구성 옵션에 대한 자세한 내용은 dependency-review-action를 참조하세요.