Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: honor NO_GCE_CHECK environment variable #1610

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

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
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.

1 participant