Commit 3c3409e
authored
Fix credentials for groups settings api (#5165)
#### Motivation
In order to call the groups settings API to allow adding external
members to groups, the service account credentials need to contain the
correct scope `'https://www.googleapis.com/auth/apps.groups.settings'`
to verify its admin role in the correspondent Google Workspace
(oss-fuzz.com in this case).
#### Rationale
Calling the get default creds with this scope does not work correctly.
My guess is that the GKE/GCE gets the Application Default Credentials
via its metadata server, which is configured by default to issue tokens
within a limited set of defined scopes (e.g., `cloud-platform`).
An alternative is self-impersonating the service account to generate new
Credentials with the right scopes. This avoids having to deal with
creating a secret containing a new key for the default service account
and then generating the credentials based on this key.
Note: For this to work, the SA must have the `Service Account Token
Creator` role. This is already set for the Compute Engine default
account in all prod environments.
#### Tests
Tested in dev by running the oss_fuzz_cc_groups cronjob with test
groups. logs: https://screenshot.googleplex.com/76a7vJjjKC4NhCe.png
Check complete investigation on: b/4779641281 parent 5e605ee commit 3c3409e
File tree
2 files changed
+32
-1
lines changed- src/clusterfuzz/_internal/google_cloud_utils
2 files changed
+32
-1
lines changedLines changed: 30 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| |||
99 | 101 | | |
100 | 102 | | |
101 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| |||
0 commit comments