Repository navigation
Commit 7d5641d
authored
feat(credentials): keyless Google Workspace domain-wide delegation via IAM signJwt (#9933)
* feat(credentials): domain-wide delegation for keyless Google credentials
A keyless (workload identity federation) google-service-account credential
can now opt into domain-wide delegation with an optional `delegation`
({ user, services }) in its keyless configuration. Runs for a delegated
Workspace service (Gmail, Drive, Docs, Sheets, Calendar) exchange Sim's
token at STS, have IAM signJwt the JWT-bearer assertion for the service
account with sub set to the delegated user, and exchange it at
oauth2.googleapis.com/token. The credential acts only as its own user: a
different Impersonated Account is refused before Google is contacted.
Saving a delegated credential mints a delegated token per service and makes
one cheap read as the user; the stray-subject pin probe also checks signJwt.
Tokens are cached per credential, secret version, delegated user, and scopes.
Credentials saved without delegation store exactly the same secret and
resolve exactly as before; BigQuery and Vertex AI keep the service account
token path.
* feat(integrations): offer keyless domain-wide delegation in the Google service account dialog
The Gmail, Google Drive, Google Docs, Google Sheets, and Google Calendar
integrations now offer the keyless (Workload Identity Federation) mode, with
a Domain-wide delegation picker preselecting the service the dialog was
opened for and a required Workspace user. The dialog lists the scopes to
authorize in the Admin console, and its gcloud commands grant
roles/iam.serviceAccountTokenCreator (which includes signJwt) instead of
roles/iam.workloadIdentityUser when delegation is on. Other Workspace
services keep the JSON key only.
* docs(integrations): document keyless Google domain-wide delegation
* fix(credentials): mint delegated keyless tokens only for authorized scopes
A keyless credential with domain-wide delegation now signs an assertion only
for the scopes its delegated services authorize, and refuses any other scope
before contacting Google (a Gmail read-only connector, the admin directory
scopes, cloud-platform). A requested read-only scope is minted as the
authorized read-write scope that covers it, so the Drive file picker works
for a credential delegated for Drive, Docs, or Sheets.
The delegated assertion is exchanged through the same transport a JSON key
uses (bounded read, retries on 429 and 5xx within a budget), sharing its list
of diagnostic error codes. Saving checks Drive, Docs, and Sheets, which share
scopes and a read, once, and the pin probe signs for every delegated scope.
A stored secret naming a delegated service a later release adds stays
readable: that service authorizes nothing here, and Google Cloud tokens and
the known services keep working. An unreadable secret fails in the shared
service-account codes.
* fix(integrations): keep a keyless Google credential's delegation on reconnect
Preparing a reconnect of a keyless Google credential now returns its stored
Workspace user and delegated services to the credential's admin (neither is
secret), and the dialog opens on them, adding the service it was opened for.
Reconnecting no longer silently drops delegation. A dialog opened for a
delegable service requires that service to be delegated.
* docs(integrations): note keyless delegation scope limits and least-privilege role
* fix(credentials): serve the Gmail label picker and name the right fix for keyless delegation
A read-only Gmail request is minted as the authorized gmail.modify scope, an
Impersonated Account is compared trimmed, and each documented token-endpoint
refusal gets its own copy instead of always pointing at the Admin console.
The stored secret is parsed in one place and the save-time read shares the
POST helper's redirect and timeout guards.
* refactor(credentials): read reconnect fields through the per-provider map
The prepare use case no longer branches on the Google provider: each provider's
reader returns everything a reconnect reopens on. The dialog takes the stored
delegation type from the contract, and one helper says which services a keyless
Google credential serves.
* docs(integrations): describe scope-level keyless delegation and new refusal messages
* fix(integrations): offer Gmail keyless delegation from the Integrations page and chat card
Both entry points pass the OAuth provider id (google-email) where the dialog
compared against service ids (gmail), so Gmail never offered keyless mode
there and a keyless reconnect from chat was refused. The shared helpers and
the dialog now map either id through googleDelegationServiceFor.
* fix(credentials): mint calendar for the Calendar connector's delegated calendar.events.readonly
The Calendar connector requests calendar.events.readonly, whose read-write
sibling calendar.events is not what a Calendar delegation authorizes, so every
keyless delegated Calendar connector token was refused. Map it to calendar,
the authorized scope Google documents as covering it.
* docs(integrations): note the Calendar connector's read-only events scope is served keylessly1 parent 0d77c23 commit 7d5641d
17 files changed
Lines changed: 1684 additions & 173 deletions
File tree
- apps
- docs/content/docs/integrations
- sim
- app/workspace/[workspaceId]/integrations/components/connect-service-account-modal
- lib
- api/contracts
- credentials
- application
- workload-identity
- oauth
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
183 | | - | |
| 183 | + | |
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
| |||
233 | 233 | | |
234 | 234 | | |
235 | 235 | | |
236 | | - | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
237 | 263 | | |
238 | 264 | | |
239 | 265 | | |
240 | 266 | | |
241 | 267 | | |
242 | 268 | | |
243 | 269 | | |
244 | | - | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
57 | | - | |
| 58 | + | |
| 59 | + | |
58 | 60 | | |
59 | 61 | | |
60 | 62 | | |
| |||
180 | 182 | | |
181 | 183 | | |
182 | 184 | | |
183 | | - | |
184 | | - | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
185 | 188 | | |
186 | 189 | | |
187 | 190 | | |
| |||
643 | 646 | | |
644 | 647 | | |
645 | 648 | | |
646 | | - | |
647 | | - | |
648 | | - | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
649 | 653 | | |
650 | 654 | | |
651 | 655 | | |
| |||
670 | 674 | | |
671 | 675 | | |
672 | 676 | | |
673 | | - | |
| 677 | + | |
| 678 | + | |
674 | 679 | | |
675 | 680 | | |
676 | 681 | | |
677 | 682 | | |
678 | 683 | | |
679 | | - | |
| 684 | + | |
680 | 685 | | |
681 | 686 | | |
682 | 687 | | |
| |||
696 | 701 | | |
697 | 702 | | |
698 | 703 | | |
699 | | - | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
700 | 709 | | |
701 | 710 | | |
702 | 711 | | |
| |||
791 | 800 | | |
792 | 801 | | |
793 | 802 | | |
794 | | - | |
| 803 | + | |
795 | 804 | | |
796 | 805 | | |
797 | 806 | | |
| |||
825 | 834 | | |
826 | 835 | | |
827 | 836 | | |
828 | | - | |
| 837 | + | |
829 | 838 | | |
830 | 839 | | |
831 | 840 | | |
| |||
844 | 853 | | |
845 | 854 | | |
846 | 855 | | |
847 | | - | |
848 | | - | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
849 | 859 | | |
850 | 860 | | |
851 | 861 | | |
| |||
0 commit comments