fix(cli): trim auth login client credential env vars#2537
Conversation
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🟢 require-ready-label-and-ciWonderful, this rule succeeded.
|
Greptile SummaryThis PR adds
Confidence Score: 5/5Safe to merge; the change is a narrow whitespace-normalization fix on the env-var fallback path with no impact on flag-supplied credentials or the token storage format. The template change is minimal — two lines swapping bare os.Getenv for strings.TrimSpace. The strings package is already imported in every generated file, so there is no risk of compile failures. The empty-after-trim case (env var set to all whitespace) falls through to the existing 'client ID and secret required' error, which is correct behavior. The golden file and all relevant test assertions are updated consistently. The new runtime test exercises the actual trim-then-POST path end-to-end against a mock server, giving strong behavioral coverage. No files require special attention. Important Files Changed
|
Merge Queue Status
This pull request spent 23 minutes in the queue, including 14 minutes 42 seconds running CI. Required conditions to merge
|
Summary
OAuth2 client-credentials
auth loginnow trims env-derived client ID and secret values before POSTing to token endpoints. This keeps copied credentials with leading or trailing whitespace from producing upstreaminvalid_clienterrors while preserving explicit flag behavior and the existing credential flow.Closes #2423.
Verification
go test ./internal/generator -run 'TestClientCredentials(AuthLoginTrimsEnvCredentials|EnvVarsSkipTenantSetupInput|LegacyEnvVarsSubstituteTenantTokenURL|TenantPrefixDoesNotHideClientCredentials|MixedKindEnvVarsPreserveClientRoles)'scripts/golden.sh verifyscripts/verify-generator-output.sh generate-golden-api-oauth2-ccgo build -o ./cli-printing-press ./cmd/cli-printing-pressgo test ./...fmt,golangci-lint