Support for GCP Application Default Credentials strategy #8375
Labels
enhancement
Enhancement or improvement to existing feature or request
security
Anything security related
v2.12.0
Issues and PRs related to version 2.12.0
Is your feature request related to a problem? Please describe.
Currently, the GoogleCloudStorageService does not support the Application Default Credential strategy of finding the credentials when the credential JSON file is not provided while fetching or creating snapshots in GCP (see the strategy search order here).
During the creation of StorageOptions (in createStorageOptions method) when ServiceAccountCredentials are not found we log a warning message saying "Application Default Credentials are not supported out of the box ....".
In addition to this, the snapshot api GET and PUT requests for snapshots will not work and access denied exception will be thrown when you do not have the credential JSON file.
GET _snapshot/my-opensearch-repo/my-first-snapshot
PUT /_snapshot//
Describe the solution you'd like
Support the use of Application Default Credentials by using the existent google auth library (google-auth-library-oauth2-http-1.7.0.jar). Update the GoogleCloudStorageService to support creating a GCS client using the Application Default Credentials, by fetching those default credentials in a doPrivileged block.
Describe alternatives you've considered
I do not see there will be an alternative solution within the existing Opensearch repository, unless the user has to implement the changes in its own client.
Additional context
We still get the access denied error if the google client is instantiated without being wrapped in a doPrivileged block i.e not using SocketAccess class
OpenSearch log output...
The text was updated successfully, but these errors were encountered: