gcp-security-hardening
Skill4 starsChanged 5 months agoMITView on GitHub
GCP security hardening patterns including IAM best practices, Workload Identity Federation (WIF), zero trust architecture, binary authorization, and container security. Use for securing GCP resources, eliminating service account keys, or implementing defense in depth.
In this repository101 other files it gives its agents.
- ai-video-understandingSkill
- apple-foundation-modelsSkill
- arch-dddSkill
- arch-decision-recordsSkill
- arch-diagramsSkill
- arch-eventsSkill
- arch-mvp-roadmapSkill
- arch-python-modernSkill
- aws-app-runnerSkill
- aws-cicd-patternsSkill
- aws-security-hardeningSkill
- azure-functions-python-v2Skill
- azure-identity-m2m-authSkill
- azure-service-bus-messagingSkill
- azure-workflow-execution-modelsSkill
- caddy-tls-proxySkill
- compliance-frameworksSkill
- design-system-workflowSkill
- dev-debugging-strategiesSkill
- dev-standardsSkill
- docker-python-poetrySkill
- docker-pythonSkill
- fastapi-patternsSkill
- ffmpeg-laravel-videoSkill
- formik-yup-react-nativeSkill
- frontend-accessibilitySkill
- frontend-angular-aiSkill
- frontend-angularSkill
- frontend-angular-toolingSkill
- frontend-design-systemsSkill
- frontend-material-chatSkill
- frontend-material-design-3Skill
- frontend-svelteSkill
- gcp-cicd-patternsSkill
- gcp-cloud-runSkill
- gcp-cloudsql-infrastructureSkill
- gcp-finopsSkill
- gcp-observabilitySkill
- github-actions-cicdSkill
- healthkit-biofeedbackSkill
- infra-terraformSkill
- ios-app-qualitySkill
- ios-audio-hapticsSkill
- jest-nestjs-testingSkill
- langchain-azure-openai-patternsSkill
- laravel-auth-hardeningSkill
- laravel-ci-mysqlSkill
- laravel-mix-webpackSkill
- laravel-modern-patternsSkill
- laravel-pint-patternsSkill
- laravel-s3-storageSkill
- laravel-sail-dockerSkill
- mobile-app-deploymentSkill
- mobile-e2e-testingSkill
- mobile-offline-syncSkill
- mobile-push-notificationsSkill
- mobile-video-uploadSkill
- mongodb-asyncmongoclient-patternsSkill
- mongodb-atlas-patternsSkill
- nestjs-patternsSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 50
Key Benefits: No keys to rotate or leak, short-lived tokens (1h default), auditable access, scoped to specific identities.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
GCP Security Hardening
Defense-in-depth security patterns for Google Cloud Platform, emphasizing zero trust architecture and keyless authentication.
Core Principles
| Principle | Implementation |
| Least Privilege | Minimal permissions, scoped to resources |
| Zero Trust | Verify everything, trust nothing |
| Keyless Auth | Workload Identity, no service account keys |
| Defense in Depth | Multiple security layers |
| Audit Everything | Cloud Audit Logs enabled |
IAM Critical Rules
- Primitive roles (Owner, Editor, Viewer) are too broad for production
- Prefer predefined roles over custom when possible
- Grant at resource level — not project level
- Review with IAM Recommender — removes unused permissions
- Enforce MFA — especially for privileged accounts
- Security keys for admins — phishing-resistant 2FA
Service Account Principles
- One per application — dedicated per application, not shared
- No user-managed keys — use Workload Identity
- Disable unused accounts — audit regularly
- Token Creator at project level enables impersonation of any SA
Workload Identity Federation
Eliminate service account keys by federating external identities:
| Source | Use Case |
| GitHub Actions | CI/CD from GitHub |
| GitLab CI | CI/CD from GitLab |
| AWS / Azure AD | Cross-cloud access |
| Kubernetes | GKE Workload Identity |
Key Benefits: No keys to rotate or leak, short-lived tokens (1h default), auditable access, scoped to specific identities.
WIF Validation Hierarchy
Verifying pool existence alone is insufficient — validate the full binding chain:
- Pool exists → 2. Provider exists → 3. Binding exists → 4. IAM roles assigned
Phase 3.5 Checklist Item: "Verify bindings, not just resources" — a pool returning success does NOT mean the binding for your specific provider/repo exists.
Anti-Patterns
| Anti-Pattern | Pattern |
Claiming infrastructure exists based on describe success | Verify exact bindings for the ticket's specific use case (4-step hierarchy) |
| Code complete but binding pending without documentation | Document split-work state explicitly, create follow-up ticket |
| Primitive roles (Owner/Editor/Viewer) | Predefined roles at resource level |
| Service account key files | Workload Identity Federation |
| Public Cloud SQL endpoints | Private IP + VPC connector |
| Single DB user for all operations | Separate migration/app/auth users (see reference.md) |
| Same-origin SHA256 without pinning | Pin expected hashes in repository for higher assurance |
| IAM audit scoped only to DB secrets | Enumerate ALL secrets from staging YAML — JWT, Redis, platform secrets use different prefixes (app-${env}-{type} vs {name}-${env}) |
| Inferring runtime deps from config fields | Verify actual client usage (imports, instantiation) before claiming dependency |
| Trusting ticket blocker counts without validation | Validate against codebase — counts frequently wrong |
Critical Rules
- No service account keys — a leaked key file grants persistent access; use Workload Identity Federation
- Private IPs only — No public endpoints for data stores
- Encrypt at rest — CMEK for sensitive data
- Audit logs enabled — Data Access logs for compliance
- VPC Service Controls — For sensitive projects
Static SPA Least-Privilege
Service accounts for static SPAs (nginx + Angular on Cloud Run) should NOT receive cloudsql.client. Grant only roles/logging.logWriter and roles/artifactregistry.writer. See infra-terraform skill for SA map exclusion pattern.
See reference.md for IAM Permission Hierarchy, Zero Trust/BeyondCorp components, network security, container security, CI binary verification, and least-privilege DB user patterns.
See examples.md for WIF Terraform modules, GitHub Actions workflows, secure Cloud Run, GKE hardening, and IAM audit configuration.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

