סריקה לאיתור סודות

בדיקות לאיתור נקודות חולשה ב-Artifact Analysis יכולות לזהות סודות, כמו מפתחות של חשבונות שירות ומפתחות API, שמאוחסנים בתמונות שנסרקו. בדוח המקרים של סריקת הפגיעות אפשר לראות מידע על הסודות האלה ולנקוט פעולות כדי למנוע חשיפה של מידע רגיש.

סקירה כללית

כשסריקת פגיעויות מזהה סוד, Artifact Analysis יוצר אירוע מסוג סוד עם פרטים על הסוד. הכלי Artifact Analysis יכול לזהות את הסודות הבאים:

סודות

  • מפתחות אדמין של Anthropic
  • מפתחות API של Anthropic
  • טוקנים של גישה ל-Azure
  • אסימונים מזהים של Azure
  • טוקנים אישיים של גישה ב-Docker Hub
  • טוקנים לרענון של אפליקציית GitHub
  • טוקנים של אפליקציית GitHub מסוג server-to-server
  • טוקנים של אפליקציית GitHub מסוג user-to-server
  • טוקנים קלאסיים לגישה אישית ב-GitHub
  • טוקנים של גישה אישית עם הרשאות מפורטות ב-GitHub
  • טוקנים של GitHub OAuth
  • Google Cloud זוגות של OAuth2 (מזהה לקוח וסוד)
  • ‫Google Cloud אסימוני גישה מסוג OAuth2
  • Google Cloud מפתחות של חשבונות שירות
  • Google Cloud מפתחות API
  • מפתחות API של Huggingface
  • מפתחות API של OpenAI
  • מפתחות API של Perplexity
  • מפתחות מוגבלים של Stripe
  • מפתחות סודיים של Stripe
  • סודות של webhook ב-Stripe

מידע מפורט על הסוגים השונים של סודות בדוחות על מקרים מופיע במאמרי העזרה של SecretKind Artifact Analysis API.

הכלי Artifact Analysis יכול לזהות רק סודות שמאוחסנים כקבצי טקסט. אלו סיומות הקבצים שנתמכות:

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

לפני שמתחילים

  1. נכנסים לחשבון Google Cloud . אם אתם משתמשים חדשים ב- Google Cloud, צרו חשבון כדי שתוכלו להעריך את הביצועים של המוצרים שלנו בתרחישים מהעולם האמיתי. לקוחות חדשים מקבלים בחינם גם קרדיט בשווי 300$ להרצה, לבדיקה ולפריסה של עומסי העבודה.
  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. If you're using an existing project for this guide, verify that you have the permissions required to complete this guide. If you created a new project, then you already have the required permissions.

  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. התקינו את ה-CLI של Google Cloud.

  7. אם אתם משתמשים בספק זהויות חיצוני (IdP), קודם אתם צריכים להיכנס ל-CLI של gcloud באמצעות המאגר המאוחד לניהול זהויות.

  8. כדי לאתחל את ה-CLI של gcloud, הריצו את הפקודה הבאה:

    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. If you're using an existing project for this guide, verify that you have the permissions required to complete this guide. If you created a new project, then you already have the required permissions.

  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. התקינו את ה-CLI של Google Cloud.

  14. אם אתם משתמשים בספק זהויות חיצוני (IdP), קודם אתם צריכים להיכנס ל-CLI של gcloud באמצעות המאגר המאוחד לניהול זהויות.

  15. כדי לאתחל את ה-CLI של gcloud, הריצו את הפקודה הבאה:

    gcloud init

הפעלת ה-API הזה מפעילה גם סריקה של חבילות שפה ב-Artifact Registry. סוגי החבילות הנתמכים

התפקידים הנדרשים

כדי לקבל את ההרשאות שדרושות לסריקת תמונות לאיתור סודות במהלך סריקות פגיעות, צריך לבקש מהאדמין להקצות לכם את תפקידי ה-IAM הבאים בפרויקט:

להסבר על מתן תפקידים, ראו איך מנהלים את הגישה ברמת הפרויקט, התיקייה והארגון.

יכול להיות שאפשר לקבל את ההרשאות הנדרשות גם באמצעות תפקידים בהתאמה אישית או תפקידים מוגדרים מראש.

הצגת סודות

כדי לראות סודות אחרי סריקת פגיעויות:

  1. איך מעבירים בדחיפה קובץ אימג' של Docker ל-Artifact Registry

  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
    • LOCATION הוא המיקום האזורי או המיקום במספר אזורים של המאגר.
    • RESOURCE_URL היא כתובת ה-URL של התמונה הסרוקה, בפורמט https://LOCATION-docker.pkg.dev/PROJECT_ID/REPOSITORY/IMAGE_ID.

    בדוגמה הבאה מוצגת תגובה אפשרית. במקרה הזה, זוההGoogle Cloud מפתח API בשם my_api_key.yaml בספרייה 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"
                  }
                }
              }
            ]
          }
        }
      ]
    }
    

מגבלות

  • במהלך תקופת ה-Public Preview של סריקת סודות, אפשר לראות מקרים של סוגי סודות רק ב-Container Analysis API.
  • דוחות סריקת סודות של Artifact Analysis מדווחים על מקרה אחד לכל היותר לכל סוד לכל תמונה. מוחזרים לכל היותר 1,000 מיקומי קבצים לכל מופע.
  • יכול להיות שיהיו תוצאות חיוביות כוזבות לגבי סודות מזוהים. חשוב תמיד לאמת כל סוד שזוהה לפני שמבצעים פעולה כלשהי בתמונות.