identityplatform: mark OAuth client_secret as sensitive (#15574)#76
Open
jbbqqf wants to merge 11 commits into
Open
identityplatform: mark OAuth client_secret as sensitive (#15574)#76jbbqqf wants to merge 11 commits into
jbbqqf wants to merge 11 commits into
Conversation
…latform#15574) google_identity_platform_tenant_default_supported_idp_config (and the parallel default_supported_idp_config / oauth_idp_config / tenant_oauth_idp_config resources) accept an OAuth client secret. The mmv1 schema does not flag clientSecret as sensitive, so terraform plan / apply prints the secret in plain text in stdout and CI logs. This change adds sensitive: true to clientSecret on all four IdentityPlatform resources that expose it. Terraform will now mask the value in plan output and console-rendered diffs while still storing it in state (matching behaviour of existing patterns like firebaseappcheck.RecaptchaV3Config and alloydb.Cluster.initial_user.password). Fixes hashicorp/terraform-provider-google#15574 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Mark the OAuth
clientSecretfield assensitive: trueon the fourIdentity Platform resources that expose it:
google_identity_platform_default_supported_idp_configgoogle_identity_platform_tenant_default_supported_idp_config(theresource the original issue is filed against)
google_identity_platform_oauth_idp_configgoogle_identity_platform_tenant_oauth_idp_configWithout this flag,
terraform planandterraform applyprint thesecret in plain text in stdout and CI logs.
Fixes hashicorp/terraform-provider-google#15574 — see hashicorp/terraform-provider-google#15574
Why
Identity Platform supports configuring third-party OAuth IdPs (Google,
Apple, Facebook, etc.) by storing the IdP's OAuth client ID and client
secret on a
*IdpConfigresource. The client secret is a credential —the API treats it as one (the
clientSecretfield is sent on POST/PATCHand is not returned on GET responses for several variants).
Currently the schema for all four resources defines
clientSecretas aplain
Stringwith no extra flags, so:This leaks the secret to anyone reading CI logs, terraform output, or a
shared shell. The standard Terraform fix is to add
sensitive: truetothe schema, which is exactly the pattern followed by:
mmv1/products/firebaseappcheck/RecaptchaV3Config.yaml(siteSecret)mmv1/products/firebaseappcheck/DeviceCheckConfig.yaml(privateKey)mmv1/products/iamworkforcepool/WorkforcePoolProvider.yaml(OIDCclient.secret.value.plain_text)mmv1/products/alloydb/Cluster.yaml(initial_user.password)This change does not touch the value persisted in state (no
write_onlyor
ignore_read); it only marks the field for redaction in plan/applyoutput. That's the minimum-surface fix that closes the immediate
information-disclosure path requested by the issue, without changing
import / round-trip semantics.
GCP API reference:
What changed
Pure mmv1 schema annotation:
Each diff adds one line —
sensitive: true— under the existingclientSecretproperty block.After regen, the generated TPG schema acquires
Sensitive: true,on theclient_secretfield of all four resources.terraform planwill showclient_secret = (sensitive value)instead of the raw string.Edge cases tested
client_secret = "GOCSPX-real-secret"(sensitive value). Before: prints the raw secret.Sensitive: truepresent in generated schema (verified in regenerated TPG output)client_secret = "GOCSPX-new"(was"GOCSPX-old")~ client_secret = (sensitive value). Both old and new redacted.sensitiveschema behavior — exercised by regenerated unit testsoutput "secret" { value = google_identity_platform_tenant_default_supported_idp_config.x.client_secret }sensitive = trueon output block, otherwise terraform errors and the user gets a clear message instead of leaking)sensitivepropagation — see https://developer.hashicorp.com/terraform/language/values/outputs#sensitive-suppressing-values-in-cli-outputTest protocol
yq eval .) on all 4 filesmake build OUTPUT_PATH=... VERSION=ga(mmv1 regen)go build ./google/services/identityplatform/...on regenerated TPGgo build ./...on full regenerated TPGSensitive: trueis the redacted plan output, which is fully determined by terraform-core given the schema flag.A reviewer can verify the redaction behavior end-to-end by running any
existing TenantDefaultSupportedIdpConfig acceptance test (e.g.
TestAccIdentityPlatformTenantDefaultSupportedIdpConfig_basic) againstthe regenerated provider with
TF_LOG=INFO terraform plan: the secretwill appear as
(sensitive value)in the plan diff.Resources
sensitive: trueon aStringproperty:
firebaseappcheck.RecaptchaV3Config,firebaseappcheck.DeviceCheckConfig,iamworkforcepool.WorkforcePoolProvider,alloydb.Cluster.initial_user.password.Disclosure
This PR was drafted with assistance from Claude Code as part of a focused
contribution batch on TPG security/UX schema fixes. The diff was reviewed
manually against the GCP REST API documentation and the existing
sensitive: trueprecedents inmmv1/products/. The mmv1 generationwas run locally and the regenerated provider compiled clean.
The author (a human) reviewed the diff and the regenerated schema before
opening this PR.