Skip to content

fix(auth): Deprecate insecure credential loading methods#3035

Closed
robertvoinescu-work wants to merge 2 commits intogoogleapis:mainfrom
robertvoinescu-work:users/robervoinescu/windy_eagle_mitigation
Closed

fix(auth): Deprecate insecure credential loading methods#3035
robertvoinescu-work wants to merge 2 commits intogoogleapis:mainfrom
robertvoinescu-work:users/robervoinescu/windy_eagle_mitigation

Conversation

@robertvoinescu-work
Copy link
Contributor

Deprecates the generic GoogleCredential.From... methods in favor of credential-type-specific loading methods to mitigate security risks.

The generic From... methods could load any credential type, which could be a security risk if the credential configuration is sourced from an untrusted location. For example, a malicious actor could provide a configuration that points to a malicious URL to fetch tokens.

This change:

  • Marks GoogleCredential.FromStream, FromStreamAsync, FromFile, FromFileAsync, FromJson, and FromJsonParameters as [Obsolete].
  • Adds detailed deprecation messages explaining the security risk and recommending the use of credential-specific methods (e.g., ServiceAccountCredential.FromServiceAccountData).
  • Adds warnings to ExternalAccountCredential.Initializer and ImpersonatedCredential.Initializer to advise users to validate credential configurations from untrusted sources.

This encourages safer credential handling by forcing developers to be explicit about the type of credential they are loading.

…y risks

The 'GoogleCredential.From...' methods for loading credentials from streams, files, or JSON do not perform any validation on the credential configuration. This poses a security risk when the configuration is sourced from an untrusted external source, as it could contain malicious URLs or other unexpected data.

This change deprecates these methods and adds detailed warnings explaining the potential security vulnerability. It also updates the remarks in 'ExternalAccountCredential' and 'ImpersonatedCredential' to include similar warnings.

Developers are encouraged to use credential-type-specific loading methods (e.g., 'ServiceAccountCredential.FromServiceAccountData') to ensure that only expected credential types are loaded, and to always validate credential configurations from untrusted sources.

The build is configured to suppress warnings for the use of these deprecated methods so that the project continues to build without errors.
@robertvoinescu-work robertvoinescu-work requested a review from a team September 9, 2025 17:33
It is safer to inline the pragma inline ignore instead of a project wide
setting. See comment for details.
@robertvoinescu-work robertvoinescu-work marked this pull request as draft September 10, 2025 21:31
@amanda-tarafa
Copy link
Contributor

Closing in favor of #3043

@robertvoinescu-work robertvoinescu-work deleted the users/robervoinescu/windy_eagle_mitigation branch October 20, 2025 21:02
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