fix(gcp): restrict setup wizard compute permissions by cristim · Pull Request #2122 · LeanerCloud/cloud-commitments-cli · GitHub
Skip to content

fix(gcp): restrict setup wizard compute permissions - #2122

Merged
cristim merged 1 commit into
mainfrom
fix/gcp-least-privilege-1946
Sep 29, 2026
Merged

cristim merged 1 commit into
mainfrom
fix/gcp-least-privilege-1946

Conversation

@cristim

@cristim cristim commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

configure-gcp currently grants full Compute Admin access before minting a service-account key. Replace that grant with Compute Viewer and a project custom role containing only compute.commitments.create.

The wizard validates existing custom roles before binding them and refuses to widen conditional-only membership. It preserves existing grants, including broad grants from older installations, which need separate operator review. Setup documentation distinguishes operator permissions from runtime permissions and notes separate Recommender access requirements.

Validation uses the real wizard coordinator and Google SDK against local HTTP fixtures. The regression fails on the original Compute Admin policy request. Cases cover custom-role reuse and rejection, preserved conditional and broad grants, create conflicts, and partial policy-write failure before key minting. No live IAM mutation or purchase was performed; fixture evidence does not establish live Google IAM propagation.

Verified commit: 1272e721b8d5185634840c9aa9fc7698dd7cb124.

  • Full short/race suite: passed, 468.281 seconds.
  • Final focused regression: passed, 27.920 seconds.
  • Build, Go vet, pinned golangci-lint 2.10.1 and normal commit hooks: passed.
  • Independent adversarial review by gpt-6-astra under the user-approved session substitution: approved this exact SHA, no actionable findings. Independent focused race run passed in 26.000 seconds; unchanged fixture against original production failed on the intended Compute Admin assertion in 3.180 seconds. CodeRabbit was waived for this independent review path.

Closes #1946

Summary by CodeRabbit

  • New Features
    • GCP setup now grants the permissions needed for commitment purchasing without granting the broader Compute Admin role.
    • Setup creates the required project role when it is missing and verifies that an existing role has only the required permission.
  • Bug Fixes
    • Setup now stops when the existing role is incompatible or access is granted only through conditional IAM bindings, rather than broadening access.
  • Documentation
    • Updated the cloud setup guide with the required permissions and behavior when rerunning setup.

Replace the setup wizard's Compute Admin grant with Compute Viewer and
an exact project custom role for compute.commitments.create. Preserve
conditional access and fail rather than silently widening existing grants.

Cover the real SDK policy requests and wizard failure exits with local
HTTP fixtures. Existing broad grants require separate operator review.
@cristim cristim added triaged Item has been triaged priority/p1 Next up; this sprint severity/high Significant harm urgency/this-sprint Within the current sprint impact/many Affects most users effort/s Hours type/security Security finding labels Sep 29, 2026
@coderabbitai

coderabbitai Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/s Hours impact/many Affects most users priority/p1 Next up; this sprint severity/high Significant harm triaged Item has been triaged type/security Security finding urgency/this-sprint Within the current sprint

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sec(cli): the GCP setup wizard grants roles/compute.admin at project scope

1 participant