보안 비밀 스캔

Artifact Analysis 취약점 스캔은 스캔된 이미지에 저장된 서비스 계정 키 및 API 키와 같은 보안 비밀을 식별할 수 있습니다. 취약점 검사의 발생 보고서에서 이러한 보안 비밀에 관한 정보를 확인하고 민감한 정보가 노출되지 않도록 조치를 취할 수 있습니다.

개요

취약점 스캔에서 보안 비밀을 감지하면 Artifact Analysis는 보안 비밀에 관한 세부정보가 포함된 보안 비밀 유형 발생을 만듭니다. 아티팩트 분석은 다음 보안 비밀을 감지할 수 있습니다.

보안 비밀

  • Anthropic 관리자 키
  • Anthropic API 키
  • Azure 액세스 토큰
  • Azure ID 토큰
  • Docker Hub 개인 액세스 토큰
  • GitHub 앱 갱신 토큰
  • GitHub 앱 서버 간 토큰
  • GitHub 앱 사용자-서버 토큰
  • GitHub 기본 개인 액세스 토큰
  • GitHub 세분화된 개인 액세스 토큰
  • GitHub OAuth 토큰
  • Google Cloud OAuth2 (클라이언트 ID 및 보안 비밀번호) 쌍
  • Google Cloud OAuth2 액세스 토큰
  • Google Cloud 서비스 계정 키
  • Google Cloud API 키
  • Huggingface API 키
  • OpenAI API 키
  • Perplexity API 키
  • Stripe 제한된 키
  • Stripe 보안 비밀 키
  • Stripe 웹훅 보안 비밀

발생 보고서의 다양한 유형의 비밀에 관한 자세한 내용은 Artifact Analysis API 문서의 SecretKind을 참고하세요.

아티팩트 분석은 텍스트 파일로 저장된 보안 비밀만 감지할 수 있습니다. 다음 파일 확장자가 지원됩니다.

  • .cer
  • .cfg
  • .crt
  • .der
  • .env
  • .html
  • .key
  • .ipynb
  • .json
  • .log
  • .md
  • .pem
  • .py
  • .pypirc
  • .textproto
  • .toml
  • .txt
  • .xml
  • .yaml

시작하기 전에

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  3. 이 가이드에 기존 프로젝트를 사용하는 경우 이 가이드를 완료하는 데 필요한 권한이 있는지 확인합니다. 새 프로젝트를 만든 경우 필요한 권한이 이미 있습니다.

  4. Verify that billing is enabled for your Google Cloud project.

  5. Enable the Artifact Registry and Container Scanning APIs.

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains the serviceusage.services.enable permission. Learn how to grant roles.

    Enable the APIs

  6. Install the Google Cloud CLI.

  7. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

  8. To initialize the gcloud CLI, run the following command:

    gcloud init
  9. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  10. 이 가이드에 기존 프로젝트를 사용하는 경우 이 가이드를 완료하는 데 필요한 권한이 있는지 확인합니다. 새 프로젝트를 만든 경우 필요한 권한이 이미 있습니다.

  11. Verify that billing is enabled for your Google Cloud project.

  12. Enable the Artifact Registry and Container Scanning APIs.

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains the serviceusage.services.enable permission. Learn how to grant roles.

    Enable the APIs

  13. Install the Google Cloud CLI.

  14. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

  15. To initialize the gcloud CLI, run the following command:

    gcloud init

이 API를 사용 설정하면 Artifact Registry의 언어 패키지 스캔도 사용 설정됩니다. 지원되는 패키지 유형을 참고하세요.

필요한 역할

취약점 검사 중에 이미지에서 비밀을 검사하는 데 필요한 권한을 얻으려면 관리자에게 프로젝트에 대한 다음 IAM 역할을 부여해 달라고 요청하세요.

역할 부여에 대한 자세한 내용은 프로젝트, 폴더, 조직에 대한 액세스 관리를 참조하세요.

커스텀 역할이나 다른 사전 정의된 역할을 통해 필요한 권한을 얻을 수도 있습니다.

보안 비밀 보기

취약점 스캔 후 보안 비밀을 보려면 다음 단계를 따르세요.

  1. Artifact Registry에 Docker 이미지 푸시

  2. 취약점 검사가 완료될 때까지 기다립니다.

  3. 다음 명령어를 실행하여 스캔한 이미지의 비밀 발생을 나열합니다.

    $ curl -G -H "Content-Type: application/json"   -H "Authorization: Bearer $(gcloud auth print-access-token)" --data-urlencode "filter=(kind=\"SECRET\" AND resourceUrl=\"RESOURCE_URL\")" https://containeranalysis.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/occurrences
    

    각 항목의 의미는 다음과 같습니다.

    • PROJECT_ID는 Google Cloud 콘솔 프로젝트 ID입니다.
    • LOCATION은 저장소의 리전 또는 멀티 리전 위치입니다.
    • RESOURCE_URL은 스캔된 이미지의 URL이며 형식은 https://LOCATION-docker.pkg.dev/PROJECT_ID/REPOSITORY/IMAGE_ID입니다.

    다음 샘플 응답은 가능한 결과를 보여줍니다. 이 경우 my_api_key.yaml이라는Google Cloud API 키가 이미지의 documents 디렉터리에서 식별되었습니다. secret 속성은 검색된 보안 비밀에 관한 정보를 표시합니다.

    {
      "occurrences": [
        {
          "name": "projects/my-project/locations/us-east1/occurrences/45619d23-66b1-4f5b-9b12-9060d7f97ff3",
          "resourceUri": "https://us-east1-docker.pkg.dev/my-project/my-images/test-image-0106@sha256:73cf5b9a788dc391c40e9cf1599144d03875b5d2dc935988ebfef8260bd2678e",
          "noteName": "projects/my-project/locations/us-east1/notes/secret_kind_gcp_api_key",
          "kind": "SECRET",
          "createTime": "2026-01-06T21:16:14.905851Z",
          "updateTime": "2026-01-06T21:16:14.905851Z",
          "secret": {
            "kind": "SECRET_KIND_GCP_API_KEY",
            "locations": [
              {
                "fileLocation": {
                  "filePath": "documents/my_api_key.yaml",
                  "layerDetails": {
                    "index": 2,
                    "diffId": "7b76df10d6d90391830392eac96b0ef2d2d43822c6ff4754aa6daea0fe14a8c5",
                    "command": "COPY . . # buildkit",
                    "chainId": "sha256:75df0c59982f47cc38e730e1a122b67fceaaf7797d91e1fa17ffffc5cfe7ff59"
                  }
                }
              }
            ]
          }
        }
      ]
    }
    

제한사항

  • Secret Scanning이 공개 미리보기로 제공되는 동안에는 Secret 유형 어커런스를 Container Analysis API에서만 볼 수 있습니다.
  • Artifact Analysis 보안 비밀 스캔은 이미지당 보안 비밀당 최대 하나의 어커런스를 보고합니다. 발생당 최대 1,000개의 파일 위치가 반환됩니다.
  • 식별된 보안 비밀에서 오탐이 발생할 수 있습니다. 이미지에 대해 조치를 취하기 전에 항상 식별된 각 보안 비밀을 확인하세요.