fix(auth): Deprecate insecure credential loading methods#3035
Closed
robertvoinescu-work wants to merge 2 commits intogoogleapis:mainfrom
Closed
fix(auth): Deprecate insecure credential loading methods#3035robertvoinescu-work wants to merge 2 commits intogoogleapis:mainfrom
robertvoinescu-work wants to merge 2 commits intogoogleapis:mainfrom
Conversation
…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.
It is safer to inline the pragma inline ignore instead of a project wide setting. See comment for details.
Contributor
|
Closing in favor of #3043 |
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.
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:
GoogleCredential.FromStream,FromStreamAsync,FromFile,FromFileAsync,FromJson, andFromJsonParametersas[Obsolete].ServiceAccountCredential.FromServiceAccountData).ExternalAccountCredential.InitializerandImpersonatedCredential.Initializerto 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.