iam-helper-for-policy-simulator
ما الذي تفعله
تفحص هذه المهارة تغيير سياسة IAM قبل أن يصبح فعليًا، حتى لا تحجب وصولًا يستخدمه الناس اليوم. وهي مخصصة للمسؤولين الذين يريدون التأكد من أن التغيير آمن.
متى تستخدمها
- ✓عندما تخطط لتغيير سياسة IAM للسماح من الإصدار الأول على مشروع أو مجلد أو مؤسسة.
- ✓عندما تريد التحقق مما إذا كان تغيير دور مقترح سيمنع وصولًا سابقًا.
- ✓عندما تحتاج إلى طريقة آمنة لتطبيق تغييرات IAM دون كسر أحمال العمل الفعلية.
رابط المهارة
https://github.com/google/skills/blob/main/skills/cloud/iam-helper-for-policy-simulator/SKILL.mdانسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.
طريقة الاستخدام
أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.
رسالة جاهزة للصق
لـ Claude Code أو Codex أو Cursor: شغّله داخل مجلد مشروعك وستُثبَّت المهارة.
نزّل ملف SKILL.md وضعه في مجلد مهارات وكيلك.
مثال على ما تطلبه من الذكاء الاصطناعي
“قبل أن أزيل دور المحرر من هذه المجموعة، تحقق بالمحاكي مما إذا كان أحد سيفقد وصولًا يستخدمه.”
5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.
كيف تعمل
تحفظ السياسة الحالية، وتشغّل Policy Simulator لإعادة تشغيل سجلات الوصول الحديثة على التغيير المقترح، ثم تبلّغ عن أي وصول سابق سيُحجب. وبعد ذلك فقط تساعد في تطبيق التغيير.
المحتوى التقني (ملف SKILL.md الأصلي)
النص الأصلي من المؤلف، مباشرة من GitHub.
IAM Policy Simulator (v1 Allow)
You are an advanced security assistant helping users safely modify IAM policies. You must NEVER apply a modifying policy change without first running a Policy Simulation to ensure existing workloads are not disrupted. You must only use standard public gcloud commands.
Usage Attribution
MUST READ: Before executing any gcloud, REST API, or MCP command, you
MUST read and follow the instructions in
Usage Attribution.
Core Concepts & Prerequisites
- IAM v1 (Allow Policies): Specifies who has access (a role) to a resource.
- Policy Simulator: Replays the last 90 days of access logs against a proposed policy to verify if any historical access would be blocked by the change.
- Required Permissions: The execution environment must have
roles/policysimulator.admin,roles/cloudasset.viewer, and the appropriate IAM Admin roles for the target resource. - Resource Scope: Changes can target Projects, Folders, or Organizations.
Execution Workflow: Plan, Simulate, Analyze, Apply
Step 1: Retrieve Current Policy (Plan)
Fetch the baseline IAM v1 policy for the target resource (Project, Folder, or
Organization) and save it to the /tmp/ directory:
For Projects:
gcloud projects get-iam-policy TARGET_PROJECT_ID --format=json > /tmp/current_policy.json
For Folders:
gcloud resource-manager folders get-iam-policy TARGET_FOLDER_ID --format=json > /tmp/current_policy.json
For Organizations:
gcloud organizations get-iam-policy TARGET_ORG_ID --format=json > /tmp/current_policy.json
CRUCIAL SAFETY GATE: Verify that the policy was successfully retrieved. If the command fails or the resulting JSON is empty, you MUST terminate the workflow immediately and inform the user. Do not proceed to prepare or simulate an empty or partial policy.
Step 2: Prepare Proposed Policy
Create a /tmp/proposed_policy.json file. Modify /tmp/current_policy.json by
adding or removing role bindings in the bindings array to match the requested
change.
CRUCIAL NO-OP CHECK: Compare the proposed policy to the current policy. If no changes were actually made (e.g., you are trying to remove a role the user doesn't hold, or add a role they already have), you MUST inform the user that no changes are necessary and terminate the workflow immediately. Do not run a simulation.
Step 3: Run Policy Simulation
Run the simulator to replay the last 90 days of access logs against the proposed policy change. Execute the exact command for your resource type:
For Projects:
gcloud iam simulator replay-recent-access //cloudresourcemanager.googleapis.com/projects/TARGET_PROJECT_ID /tmp/proposed_policy.json --project=TARGET_PROJECT_ID --format=json > /tmp/simulation_results.json
For Folders:
gcloud iam simulator replay-recent-access //cloudresourcemanager.googleapis.com/folders/TARGET_FOLDER_ID /tmp/proposed_policy.json --format=json > /tmp/simulation_results.json
For Organizations:
gcloud iam simulator replay-recent-access //cloudresourcemanager.googleapis.com/organizations/TARGET_ORG_ID /tmp/proposed_policy.json --format=json > /tmp/simulation_results.json
(Note: If the Policy Simulator API is not enabled, it will prompt you to enable it. Select Yes. Do not use placeholders verbatim; replace TARGET_PROJECT_ID, TARGET_FOLDER_ID, or TARGET_ORG_ID with the actual resource ID).
CRUCIAL SAFETY GATE: Verify the command exited successfully. If the simulator command crashes, times out, or returns a non-zero exit code, you MUST NOT treat the failure as a "safe" result. Terminate the workflow immediately and report the simulator failure to the user.
Step 4: Analyze Simulation Results
Analyze the contents of /tmp/simulation_results.json using the provided helper
script. Do not write custom scripts on the fly. You MUST execute the following
command:
python3 scripts/analyze_simulation.py
- SAFE (No Breakage): If the script outputs
REVOKED_COUNT=0, the change is safe. - UNSAFE (Breakage): If the script outputs
REVOKED_COUNT> 0 (meaning the logs containACCESS_REVOKEDorACCESS_MAYBE_REVOKED):- Identify the
principal,permission, andfullResourceNamefrom the printed JSON. - Do NOT apply the policy.
- The change will break an active workload. In
- Identify the
الأسئلة الشائعة
إلى أي مدى يبحث المحاكي؟
يعيد تشغيل سجلات الوصول للأيام الـ90 الماضية.
هل تطبّق التغييرات دون اختبار؟
لا. لا تطبّق أي تغيير دون تشغيل محاكاة أولًا.
هل تغطي سياسات المنع؟
لا. تحليل سياسات المنع في IAM الإصدار الثاني خارج نطاقها.
التفاصيل
الوصف الأصلي من المؤلف
Safely simulates and applies Identity and Access Management (IAM) v1 (Allow) policy changes on Google Cloud. Uses the Policy Simulator to replay historical access logs against proposed policies to prevent breaking active workloads before applying the changes. Use when simulating or applying IAM v1 allow policies across Projects, Folders, or Organizations. Don't use for analyzing IAM v2 deny policies, VPC Service Controls, or performing general policy troubleshooting.
repo: google/skills
الشعبية
- نجوم GitHub
- 22k
- الترتيب
- #10339
- الترخيص
- Apache-2.0
- آخر تحديث
- 2/11/2026
التعليقات
- …
المزيد من المهارات من هذا المستودع
finding-google-skills
22kيساعد وكيلك على إيجاد أدلة Google المناسبة لمهمة إعداد، مثل الاستضافة وقواعد البيانات والتخزين وتسجيل الدخول وتقديم نماذج الذكاء الاصطناعي.
gcloud
22kيساعد وكيلك على كتابة أوامر gcloud الخاصة بـ Google Cloud والتحقق منها، والاطلاع على الصيغة الدقيقة قبل تشغيل أي شيء حتى لا يخمّن الخيارات.
google-cloud-recipe-auth
22kيرشد وكيلك خلال هوية Google Cloud والوصول إليها، بما في ذلك طريقة دخول الأشخاص والخدمات والأذونات التي يحصلون عليها.
google-cloud-recipe-onboarding
22kيرشد مطورًا جديدًا خلال الخطوات الأولى في Google Cloud، ويشمل اختيار المشروع وربط الفوترة ونشر أول مورد.
مهارات مشابهة
reverse-engineer-anything
422kيساعد وكيلك على فحص التطبيقات والحزم المنشورة من الداخل ليشرح الميزات ويقارن الإصدارات ويرشد إلى إعادة البناء، باستخدام أداة REA.
1password
394kيساعد وكيلك على إعداد واجهة سطر أوامر 1Password وتسجيل الدخول، وقراءة الأسرار أو حقنها دون طباعة قيمها في المحادثة.
healthcheck
394kيساعد وكيلك على تدقيق جهاز OpenClaw أو خادمه أمنيًا، مثل SSH والجدار الناري والتحديثات، ويقترح إصلاحات آمنة قابلة للتراجع.