Works with the AI Agents you already use
GCP IAM Policy Security Audit
by CashonlyTian
Stop granting excessive permissions before they are deployed.
$7
GCP IAM Policy Security Audit
Example session with this skill installed
Run a security audit on the GCP IAM policies in the 'infrastructure/prod-iam' folder. The project is 'fintech-main-prod' and our domain is 'fintech.example'. Use accent color #0D9488.
- Read your context and instructions
- Compiled the gcp iam policy
- Generated the document
I have completed the security audit for project
fintech-main-prod. The scan analyzed IAM bindings, service account keys, and custom roles found in the infrastructure/prod-iam directory.
Score: 7/100
Grade: F
Risk Level: CRITICAL
Found 48 findings.
Audit Results
| Check Category | Score | Status | Key Findings |
|---|---|---|---|
| Primitive Roles | 0/15 | FAIL | Found 3 roles/owner bindings. |
| Public Access | 15/15 | PASS | No public access detected. |
| Impersonation | 0/10 | FAIL | serviceAccountTokenCreator granted to a group. |
| Admin Roles | 5/10 | WARN | securityAdmin role assigned to a dev user. |
| SA Keys | 10/10 | PASS | No expired or committed keys found. |
| External Members | 8/10 | WARN | 2 gmail.com addresses in Secret Manager roles. |
| Custom Roles | 10/10 | PASS | No dangerous permissions in custom roles. |
| Secret Manager | 10/10 | PASS | Access restricted to specific service accounts. |
| IAM Conditions | 5/5 | PASS | Sensitive bindings use IAM conditions. |
| Logging & Policy | 5/5 | PASS | Audit logs and org policy constraints active. |
Top 3 Recommended Fixes:
1.
Remove Primitive Roles: Replace roles/owner for the 3 identified users with specific predefined roles like roles/compute.admin or roles/storage.admin.
2.
Restrict Impersonation: Scope the serviceAccountTokenCreator grant to specific service accounts rather than granting it at the project level to a group.
3.
Clean External Access: Remove the gmail.com accounts from the Secret Manager Secret Accessor role; move these users to the fintech.example organization.
Files Generated:
- Report:
scan-report.md - Visual Scorecard:
scan-2024-05-20.png
Next steps
- Review
scan-report.mdfor the exact line numbers of theroles/ownerviolations. - Apply the least-privilege role changes in your Terraform files.
- Re-run the audit to confirm the score increases above 80.
Clean demo (demo-project-clean): Score: 100/100, Grade: A, 0 findings.
scan-2024-05-20.png
PDF · document
Example file from a real run - the skill writes it into your workspace.
Connects securely to your tools. The creator never sees your data.
About this skill
Stop granting excessive permissions before they are deployed. This skill audits GCP IAM policy documents, Terraform files, and service account keys to identify security gaps that lead to project takeover. It moves beyond basic linting by scoring your security posture across ten specific risk vectors, including impersonation chains and external member leaks.
What it does
- Primitive Role Detection Flags
roles/ownerandroles/editorbindings that violate least-privilege principles. - Impersonation Chain Analysis Identifies grants like
serviceAccountTokenCreatorthat allow members to assume high-privilege service account roles. - External Member Auditing Detects gmail.com, free-mail, or non-org domain accounts with access to sensitive resources.
- Custom Role Inspection Scans for dangerous permissions such as
actAs,getAccessToken, andsetIamPolicywithin custom definitions. - Secret Manager Review Flags broad
secretAccessorpermissions granted to groups, public users, or impersonatable accounts. - Scorecard Generation Produces a shareable PNG scorecard and a prioritized Markdown report with a 0-100 security grade.
How it works
- Prepare Data Use the provided
scripts/gcp_fetch.pyorgcloudcommands to export IAM policies, service account keys, and org policies to a local folder. - Execute Scan Run the audit against the local directory. The skill analyzes JSON and Terraform files without making network calls or accessing the GCP API.
- Review Report Inspect the generated
scan-report.mdfor a ranked list of findings, starting with the highest risk items. - Fix and Re-scan Apply recommended fixes to the policy files and re-run the scan to verify the new security grade.
Frameworks & tools
This skill works with GCP IAM JSON exports, Terraform (.tf) files containing IAM resources, and local Google Cloud CLI outputs. It utilizes a local Python-based scanning engine.
Why this beats prompting it yourself
Generic prompts often miss complex impersonation chains and don't provide a quantitative security score. This skill uses a structured 10-point rubric to ensure every audit is consistent, measurable, and free of sensitive data leaks through automatic masking.
Use cases
- Audit IAM bindings generated by other AI agents before applying them to production.
- Perform security due diligence when onboarding a third-party or legacy GCP project.
- Generate visual security scorecards for stakeholder reporting or compliance reviews.
- Detect expired or committed service account keys hidden in project repositories.
Known limitations
Audits local files only and cannot detect manual changes made in the GCP Console not reflected in saved files. Does not resolve Terraform data sources or complex variables.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for LLM Ops.
Audits saved files only, not live GCP state. Does not resolve Terraform variables or data sources. Requires org_domain input to flag non-public external domains. Files over 2MB are skipped.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 4 days ago
- Software
Python 3Pillow