elastic / elastic/connectors

[Google Drive Connector] Support OAuth 2.0 Client Credentials and Workload Identity Federation as alternatives to Service Account JSON

Open
#4,083 1 comment 0 reactions 0 assignees View on GitHub
community-driven enhancement sdh-driven team:extract-and-transform
Dominant language
Python
Stars
133
Forks
205
Avg merge
16h 3m
Merged PRs (30d)
102

Description

**[Google Drive Connector] Support OAuth 2.0 Client Credentials and Workload Identity Federation as alternatives to Service Account JSON**

Describe the feature request:
The Google Drive connector currently requires a Service Account JSON key file (containing an RSA private key) as the only authentication method. This is blocked in many enterprise environments where GCP organisation policy explicitly forbids the creation of service account keys (e.g. via constraints/iam.disableServiceAccountKeyCreation).The connector exposes an auth_type: "oauth2" config option but the underlying code (datasource.py, google.py) calls service_account.Credentials.from_service_account_info() regardless, making OAuth 2.0 Client ID/Secret non-functional.

Requested alternatives:
1. OAuth 2.0 Client Credentials with domain-wide delegationSupport client_id + client_secret + subject (impersonation) as a fully functional auth path — without requiring a private key.
2. Workload Identity FederationAllow the connector to pick up credentials from the GCP metadata server when running on GCP infrastructure (GKE, Compute Engine, Cloud Run), so no key file is ever generated or stored.

Current behaviour:
`google.auth.exceptions.InvalidValue: None could not be converted to bytes
`
The connector fails at _helpers.to_bytes(key) because no private key is present — even when auth_type: "oauth2" is explicitly set in config.yml.

Expected behaviour:
The connector should authenticate successfully using OAuth 2.0 Client Credentials or ambient GCP credentials without requiring a Service Account JSON key file.

Environment:

- Connector service version: 9.4.2
- Deployment: Self-managed Docker / Kibana-managed
- Google Drive connector: google_drive

Why this matters:
Enterprise GCP organisations commonly enforce constraints/iam.disableServiceAccountKeyCreation as a security baseline. This policy makes the Google Drive connector completely unusable in those environments. Supporting keyless authentication would unblock a significant number of enterprise customers.

Contributor guide

Open the contributing guide

Research direction

Start by reading datasource.py and google.py, especially the auth_type handling and the call to service_account.Credentials.from_service_account_info(). Reproduce the oauth2 configuration failure, then trace how ambient GCP credentials could be selected. Done means the Google Drive connector authenticates through client credentials or workload identity without requiring a service account private key.

Written by the indexing model from the issue text.

Assessment

Tech stack
gcp, google-cloud, python
Domain
authentication, backend, cloud
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.