Repository navigation
feat(googlecloud): report missing IAM roles on permission errors and preserve client error types - #1190
Merged
Conversation
…preserve client error types
kyasbal
requested review from
K53,
RyuSA,
jyane,
kkuchima and
renamoo
as code owners
October 29, 2026 02:17
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a new error wrapping utility, WrapPermissionDenied, in pkg/api/googlecloud/permission_error.go to annotate Google Cloud permission errors with missing permissions and recommended IAM roles. Various log, metric, and asset fetchers are updated to wrap their permission-denied errors using this utility. The review feedback suggests that the custom permissionDeniedError struct should explicitly implement GRPCStatus() *status.Status and HTTPCode() int methods to ensure seamless integration with standard gRPC and HTTP error-handling utilities.
kyasbal
commented
Oct 29, 2026
kyasbal
enabled auto-merge
October 29, 2026 02:55
Merged
via the queue into
GoogleCloudPlatform:main
with commit Oct 29, 2026
99e2a3a
17 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1121
Summary
Google Cloud API permission errors (
codes.PermissionDeniedand HTTP 403 responses) previously surfaced raw RPC descriptions without identifying which IAM role was needed on which project or resource. This change enriches permission-denied errors at the Google Cloud API boundary with the denied permission, target resource or quota project, and recommended IAM role(s) (roles/logging.viewer,roles/logging.privateLogViewer,roles/logging.viewAccessor,roles/monitoring.viewer,roles/cloudasset.viewer,roles/compute.viewer,roles/container.viewer, androles/serviceusage.serviceUsageConsumer) while preserving the underlying error chain viaUnwrap()and leaving non-IAM 403 reasons (SERVICE_DISABLED,BILLING_DISABLED,ACCESS_TOKEN_SCOPE_INSUFFICIENT) untouched. Because both MCP tool outputs and Web UI banners render the error string directly, the actionable role guidance appears across all inspection and autocomplete surfaces without MCP-specific error codes.In addition, structured log estimation now joins Cloud Logging and Cloud Monitoring client initialization errors with
errors.Joinand%winstead of formatting them with%v, ensuring callers retain the underlying authentication and client error types viaerrors.As.UI / Output Changes