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

auth: detection of unset EXPERIMENTAL_GOOGLE_API_USE_S2A fails #9670

Closed
quartzmo opened this issue Mar 29, 2024 · 0 comments · Fixed by #9663
Closed

auth: detection of unset EXPERIMENTAL_GOOGLE_API_USE_S2A fails #9670

quartzmo opened this issue Mar 29, 2024 · 0 comments · Fixed by #9663
Assignees
Labels
priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@quartzmo
Copy link
Member

quartzmo commented Mar 29, 2024

Module

auth

Go Environment

go1.22.0 darwin/amd64

Code

Previous:

https://github.com/googleapis/google-api-go-client/blob/v0.172.0/internal/cba.go#L316-L318

	if !isGoogleS2AEnabled() {
		return false
	}

func isGoogleS2AEnabled() bool {
	return strings.ToLower(os.Getenv(googleAPIUseS2AEnv)) == "true"
}

Current:

https://github.com/googleapis/google-cloud-go/blob/auth/v0.1.1/auth/internal/transport/s2a.go#L164-L167

	if b, err := strconv.ParseBool(os.Getenv(googleAPIUseS2AEnv)); err == nil && !b {
		return false
	}

Expected behavior

If EXPERIMENTAL_GOOGLE_API_USE_S2A is not set, returns false.

Actual behavior

If EXPERIMENTAL_GOOGLE_API_USE_S2A is not set, execution continues.

If err and b are captured and logged, values are:

err:  strconv.ParseBool: parsing "": invalid syntax
b:  false

Possible solutions

  1. Remove err == nil && and ignore error?
  2. Restore the previous solution?
@quartzmo quartzmo added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. labels Mar 29, 2024
@quartzmo quartzmo self-assigned this Mar 29, 2024
quartzmo added a commit to quartzmo/google-cloud-go that referenced this issue Mar 29, 2024
quartzmo added a commit to quartzmo/google-cloud-go that referenced this issue Mar 29, 2024
@quartzmo quartzmo changed the title auth: detection of non-true EXPERIMENTAL_GOOGLE_API_USE_S2A fails auth: detection of unset EXPERIMENTAL_GOOGLE_API_USE_S2A fails Mar 29, 2024
quartzmo added a commit to quartzmo/google-cloud-go that referenced this issue Apr 1, 2024
quartzmo added a commit that referenced this issue Apr 2, 2024
…9663)

* add universe domain to grpctransport and endpoint
* replace deprecated DefaultEndpoint usages with DefaultEndpointTemplate
* remove DefaultUniverseDomain usages
* fix EXPERIMENTAL_GOOGLE_API_USE_S2A env var detection

fixes: #9670
gcf-merge-on-green bot pushed a commit that referenced this issue Apr 15, 2024
🤖 I have created a release *beep* *boop*
---


## [0.2.0](https://togithub.com/googleapis/google-cloud-go/compare/auth/v0.1.1...auth/v0.2.0) (2024-04-15)


### Features

* **auth/credentials/externalaccount:** Add default TokenURL ([#9700](https://togithub.com/googleapis/google-cloud-go/issues/9700)) ([81830e6](https://togithub.com/googleapis/google-cloud-go/commit/81830e6848ceefd055aa4d08f933d1154455a0f6))
* **auth:** Add downscope.Options.UniverseDomain ([#9634](https://togithub.com/googleapis/google-cloud-go/issues/9634)) ([52cf7d7](https://togithub.com/googleapis/google-cloud-go/commit/52cf7d780853594291c4e34302d618299d1f5a1d))
* **auth:** Add universe domain to grpctransport and httptransport ([#9663](https://togithub.com/googleapis/google-cloud-go/issues/9663)) ([67d353b](https://togithub.com/googleapis/google-cloud-go/commit/67d353beefe3b607c08c891876fbd95ab89e5fe3)), refs [#9670](https://togithub.com/googleapis/google-cloud-go/issues/9670)
* **auth:** Add UniverseDomain to DetectOptions ([#9536](https://togithub.com/googleapis/google-cloud-go/issues/9536)) ([3618d3f](https://togithub.com/googleapis/google-cloud-go/commit/3618d3f7061615c0e189f376c75abc201203b501))
* **auth:** Make package externalaccount public ([#9633](https://togithub.com/googleapis/google-cloud-go/issues/9633)) ([a0978d8](https://togithub.com/googleapis/google-cloud-go/commit/a0978d8e96968399940ebd7d092539772bf9caac))
* **auth:** Move credentials to base auth package ([#9590](https://togithub.com/googleapis/google-cloud-go/issues/9590)) ([1a04baf](https://togithub.com/googleapis/google-cloud-go/commit/1a04bafa83c27342b9308d785645e1e5423ea10d))
* **auth:** Refactor public sigs to use Credentials ([#9603](https://togithub.com/googleapis/google-cloud-go/issues/9603)) ([69cb240](https://togithub.com/googleapis/google-cloud-go/commit/69cb240c530b1f7173a9af2555c19e9a1beb56c5))


### Bug Fixes

* **auth/oauth2adapt:** Update protobuf dep to v1.33.0 ([30b038d](https://togithub.com/googleapis/google-cloud-go/commit/30b038d8cac0b8cd5dd4761c87f3f298760dd33a))
* **auth:** Fix uint32 conversion ([9221c7f](https://togithub.com/googleapis/google-cloud-go/commit/9221c7fa12cef9d5fb7ddc92f41f1d6204971c7b))
* **auth:** Port sts expires fix ([#9618](https://togithub.com/googleapis/google-cloud-go/issues/9618)) ([7bec97b](https://togithub.com/googleapis/google-cloud-go/commit/7bec97b2f51ed3ac4f9b88bf100d301da3f5d1bd))
* **auth:** Read universe_domain from all credentials files ([#9632](https://togithub.com/googleapis/google-cloud-go/issues/9632)) ([16efbb5](https://togithub.com/googleapis/google-cloud-go/commit/16efbb52e39ea4a319e5ee1e95c0e0305b6d9824))
* **auth:** Remove content-type header from idms get requests ([#9508](https://togithub.com/googleapis/google-cloud-go/issues/9508)) ([8589f41](https://togithub.com/googleapis/google-cloud-go/commit/8589f41599d265d7c3d46a3d86c9fab2329cbdd9))
* **auth:** Update protobuf dep to v1.33.0 ([30b038d](https://togithub.com/googleapis/google-cloud-go/commit/30b038d8cac0b8cd5dd4761c87f3f298760dd33a))

---
This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant