Skip to main content

More Info:

Restrict IAM permissions so only required users and service accounts have write access to container image repositories. Broad storage-admin roles allow tampering with image content.

Risk Level

Medium

Address

Security

Compliance Standards

  • CIS GKE

Triage and Remediation

Remediation

Manual Steps

  1. Identify over-privileged principals at the project level
    • Run on any machine with gcloud access:
    • For each returned member, document which applications, CI pipelines, or teams depend on that access and whether they truly need write or admin rights to container images.
  2. Review and adjust project-level IAM for GCR/AR access
    • If a principal does not require broad storage admin or legacy write roles, update the project IAM policy file instead of editing individual bindings ad hoc.
    • Export the current policy:
    • Edit /tmp/${PROJECT_ID}-iam-policy.yaml and remove or narrow any bindings that grant:
      • roles/storage.admin
      • roles/storage.objectAdmin
      • roles/storage.objectCreator
      • roles/storage.legacyBucketOwner
      • roles/storage.legacyBucketWriter
      • roles/storage.legacyObjectOwner
        where they are not strictly required for image publishing/management.
    • Re-apply the policy:
  3. Tighten GCR bucket-level permissions (if using GCR)
    • Determine the GCR bucket name, typically: artifacts.${PROJECT_ID}.appspot.com.
    • Show current IAM on the bucket:
    • For any principal that only needs read access, first grant a read-only role if not already present, for example:
    • Then remove over-privileged roles from the bucket:
    • Adjust user: to serviceAccount: and the role string as appropriate for each principal you identified.
  4. Restrict Artifact Registry repository IAM (if using AR)
    • List repositories to identify which hold container images:
      (Repeat with other locations as needed.)
    • For each repository that stores container images, get its current IAM policy:
    • Review bindings and ensure only the minimal required users/service accounts have write or admin roles (for example, CI/CD or image promotion jobs). Remove wide groups or general-purpose accounts that do not need image write access.
    • After editing /tmp/${REPO_NAME}-iam-policy.yaml, apply it:
  5. Confirm remaining write access is justified and scoped
    • For each principal that still has write or admin access (project-level, bucket-level, or AR repo-level), document:
      • What pipeline or workload uses it (e.g., image build, promotion, security scanning).
      • Why write access cannot be further reduced (e.g., needs only artifactregistry.repoAdmin on a single repo instead of project-level storage admin).
    • Where possible, replace direct user accounts with dedicated service accounts scoped to a single project or repository and used only from CI/CD or automation.
  6. Re-run the audit to verify reduction of broad roles
    • Run again on any machine with gcloud access:
    • Confirm that:
      • No general-purpose users, broad groups, or unrelated service accounts retain these roles.
      • Any remaining use of these roles is explicitly reviewed and accepted as a justified exception.
kubectl cannot be used to change IAM permissions on Google Cloud container image repositories; these settings are managed at the cloud project / Artifact Registry / GCR level via gcloud, gsutil, or IaC. Perform the remediation in the cloud provider configuration instead, following the guidance in the Manual Steps section.