סקירה כללית
כשבדיקת נקודות חולשה מזהה סוד, Artifact Analysis יוצר אירוע מסוג סוד עם פרטים על הסוד. התכונה 'ניתוח ארטיפקטים' יכולה לזהות את הסודות הבאים:
סודות
- מפתחות אדמין של Anthropic
- מפתחות API של Anthropic
- טוקני גישה של Azure
- טוקנים של מזהים ב-Azure
- טוקנים אישיים של גישה ל-Docker Hub
- אסימוני רענון של אפליקציית GitHub
- טוקנים של אפליקציית GitHub מסוג server-to-server
- טוקנים של אפליקציית GitHub מסוג user-to-server
- טוקני גישה אישיים קלאסיים ב-GitHub
- טוקנים של גישה אישית עם הרשאות מפורטות ב-GitHub
- טוקנים של OAuth ב-GitHub
- Google Cloud זוגות של OAuth2 (מזהה לקוח וסוד)
- Google Cloud טוקני גישה מסוג OAuth2
- Google Cloud מפתחות של חשבונות שירות
- Google Cloud מפתחות API
- מפתחות API של Hugging Face
- מפתחות API של OpenAI
- מפתחות API של Perplexity
- מפתחות מוגבלים של Stripe
- מפתחות סודיים של Stripe
- סודות של Stripe webhook
מידע מפורט על הסוגים השונים של סודות בדוחות על מקרים מופיע במאמרי העזרה של Artifact Analysis API בנושא SecretKind.
ניתוח ארטיפקטים יכול לזהות רק סודות שמאוחסנים כקבצי טקסט. אלו סיומות הקבצים שנתמכות:
.cer.cfg.crt.der.env.html.key.ipynb.json.log.md.pem.py.pypirc.textproto.toml.txt.xml.yaml
לפני שמתחילים
- נכנסים לחשבון Google Cloud . אנחנו ממליצים למשתמשים חדשים ב- Google Cloud ליצור חשבון כדי שיוכלו להעריך את הביצועים של המוצרים שלנו בתרחישים מהעולם האמיתי. לקוחות חדשים מקבלים בחינם גם קרדיט בשווי 300$ להרצה, לבדיקה ולפריסה של עומסי העבודה.
-
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 theresourcemanager.projects.createpermission. Learn how to grant roles.
-
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.
-
Verify that billing is enabled for your Google Cloud project.
Enable the Artifact Registry and Container Scanning APIs, if any are not already enabled.
Roles required to enable APIs
To enable APIs, you need the
serviceusage.services.enablepermission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.-
Install the Google Cloud CLI.
-
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
-
To initialize the gcloud CLI, run the following command:
gcloud init -
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 theresourcemanager.projects.createpermission. Learn how to grant roles.
-
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.
-
Verify that billing is enabled for your Google Cloud project.
Enable the Artifact Registry and Container Scanning APIs, if any are not already enabled.
Roles required to enable APIs
To enable APIs, you need the
serviceusage.services.enablepermission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.-
Install the Google Cloud CLI.
-
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
-
To initialize the gcloud CLI, run the following command:
gcloud init
הפעלת ה-API הזה מפעילה גם סריקה של חבילות שפה ב-Artifact Registry. סוגי החבילות הנתמכים
התפקידים הנדרשים
כדי לקבל את ההרשאות שדרושות לסריקת תמונות לאיתור סודות במהלך בדיקות נקודות חולשה, צריך לבקש מהאדמין להקצות לכם את תפקידי ה-IAM הבאים בפרויקט:
- Artifact Registry Writer (
roles/artifactregistry.writer) - Container Analysis Occurrences Viewer (
roles/containeranalysis.occurrences.viewer)
להסבר על מתן תפקידים, ראו איך מנהלים את הגישה ברמת הפרויקט, התיקייה והארגון.
יכול להיות שאפשר לקבל את ההרשאות הנדרשות גם באמצעות תפקידים בהתאמה אישית או תפקידים מוגדרים מראש.
הצגת סודות
כדי לראות את הסודות אחרי סריקת נקודות חולשה:
מחכים לסיום סריקת הפגיעות.
מריצים את הפקודה הבאה כדי להציג את המופעים של הסודות בתמונה שנסרקה:
$ 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 מיקומי קבצים לכל מופע.
- יכול להיות שיהיו תוצאות חיוביות כוזבות לגבי סודות שזוהו. חשוב תמיד לאמת כל סוד שזוהה לפני שמבצעים פעולה כלשהי בתמונות.