Skip to content

Conversation

@0x2b3bfa0
Copy link

@0x2b3bfa0 0x2b3bfa0 commented Oct 17, 2024

Currently, google.auth.default() always attempts to authenticate using the Google Compute Engine (GCE) metadata service as a fallback. There is no easy way to prevent this behavior, leading to unnecessary delays and unhelpful exceptions, particularly in cases where GCE-based authentication is pointless or undesired.

This pull request introduces a NO_GCE_CHECK environment variable, allowing users to explicitly skip GCE metadata service authentication. This implementation mirrors NO_GCE_CHECK in googleapis/google-auth-library-java:

The following are searched (in order) to find the Application Default Credentials:

[...]

  1. Google Compute Engine built-in credentials
    • Skip this check by setting the environment variable NO_GCE_CHECK=true

Note

Other clouds also provide similar environment variables, such as AWS_EC2_METADATA_DISABLED on AWS.

This change is also tangentially related to the following pull requests:

@0x2b3bfa0 0x2b3bfa0 marked this pull request as ready for review October 17, 2024 03:17
@0x2b3bfa0 0x2b3bfa0 requested review from a team as code owners October 17, 2024 03:17
@shcheklein
Copy link

Hey folks / maintainers, just to bump this up a bit. Would it be possible to merge / release this? What else do we need to do here - please let us know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants