Google Cloud / Editorial solution guide
Diagnose Permission Denied and Identity Scope
Trace the requesting principal, credential source, permission, resource, and applicable controls before changing access.
Read-only knowledge base · No public comments
Recognize the symptoms
An application receives PERMISSION_DENIED or an HTTP403 while a developer’s interactive action succeeds. Alternatively, a role was granted but the application still fails. Similar symptoms can arise from different principals, wrong resource/project, an inherited deny or condition, organization policy, a service perimeter, or another product-specific requirement. Successful login alone is not authorization evidence.
Understand the likely causes
- The application may use ADC from a different source than the CLI, or impersonate an unexpected account. Local allow bindings may omit ancestor policies, deny rules, conditions, and service controls. A network or resource-configuration problem can also be mistaken for a permission problem. Broadening roles without locating the failed stage can leave the original issue unresolved.
1. Preserve the exact authorization question
Record operation, target resource name, project/number as required, timestamp, relevant request context, and the denied permission when available. Use existing authorized error/audit evidence with secrets redacted. Distinguish metadata access from data access and administrative operations. A role name or screenshot of a successful login is not a substitute for identifying this particular request.
2. Trace the credential source without exposing it
Compare deployer, runtime service account, impersonating actor, and application credential discovery. ADC precedence can select an environment configuration or local file before an attached identity. Do not print a token, key, or credential file to prove which account was selected. Inspect approved identity metadata and library configuration under the organization’s process.
3. Check whether the diagnostic record is complete
The complete offline program parses an invented diagnostic record and lists missing fields. It identifies absent request context rather than guessing that a role is insufficient. This is not a policy evaluator or a parser for every Google error format. Its purpose is to make the next authorized investigation concrete without contacting any account.
import json
record = json.loads('{"principal":"runtime-reader","permission":"storage.objects.get","resource":"synthetic-object","request_context":""}')
required = ["principal", "permission", "resource", "request_context"]
missing = [field for field in required if not record.get(field)]
print("missing evidence", ",".join(missing))
missing evidence request_context
The synthetic record lacks request_context; no real permission or credential is tested.
4. Examine the applicable policy layers
Review the resource hierarchy, inherited allow grants, role permissions, conditions, and supported deny rules for the actual question. Policy Troubleshooter has documented coverage and limitations; it does not diagnose every ACL or VPC Service Controls case. Organization constraints and service-perimeter denials require their own evidence. Do not remove a control merely because a local binding appears correct.
5. Propose the narrow correction and verification
If authorized review confirms a missing permission, choose a justified role and supported narrow resource scope, with owner and removal conditions. If identity or context is wrong, fix that path rather than granting a more powerful account everywhere. Keep change approval, rollback, and expected allowed/forbidden cases explicit. This guide executes no inspection command, policy change, or access test.
Verify the fix
The local program must report missing evidence request_context. A real correction is verified only through approved evidence for the same principal, resource, permission, and context plus relevant negative cases. Record what control layer was responsible and what remains untested. A successful unrelated CLI request does not establish that the application’s credential path is repaired.
Keep it from recurring
- Maintain an identity map, least-privilege role review, explicit resource targets, and documented ADC/impersonation assumptions. Preserve policy and group-membership governance. Keep secrets out of diagnostics, and distinguish authentication, authorization, service restrictions, and network reachability throughout incident handling.