feat: Deprecate unsafe credential loading methods and options (Windy Eagle Mitigation)#3043
Conversation
Src/Support/Google.Apis.Auth.Tests/OAuth2/GoogleCredentialTests.cs
Outdated
Show resolved
Hide resolved
Src/Support/Google.Apis.Auth.Tests/OAuth2/GoogleCredentialTests.cs
Outdated
Show resolved
Hide resolved
518d25a to
9351a40
Compare
42a6560 to
7160ca2
Compare
7160ca2 to
0a05b66
Compare
amanda-tarafa
left a comment
There was a problem hiding this comment.
Mostly name changes and a little bit more of simplification. Thanks!
Src/Support/Google.Apis.Auth/OAuth2/UrlSourcedExternalAccountCredential.cs
Outdated
Show resolved
Hide resolved
Src/Support/Google.Apis.Auth/OAuth2/ServiceAccountCredential.cs
Outdated
Show resolved
Hide resolved
eeec372 to
5e2d08a
Compare
amanda-tarafa
left a comment
There was a problem hiding this comment.
See comment on removing duplicate methods.
5e2d08a to
72332ca
Compare
amanda-tarafa
left a comment
There was a problem hiding this comment.
A few more tweaks but looking great.
2cde44e to
98b17cf
Compare
98b17cf to
4c7e591
Compare
aaa6477 to
26b6c29
Compare
Src/Support/Google.Apis.Auth/OAuth2/UrlSourcedExternalAccountCredential.cs
Outdated
Show resolved
Hide resolved
Src/Support/Google.Apis.Auth/OAuth2/ProgrammaticExternalAccountCredential.cs
Outdated
Show resolved
Hide resolved
Src/Support/Google.Apis.Auth/OAuth2/AwsExternalAccountCredential.cs
Outdated
Show resolved
Hide resolved
Src/Support/Google.Apis.Auth/OAuth2/ExternalAccountCredential.cs
Outdated
Show resolved
Hide resolved
c39bb24 to
2947315
Compare
amanda-tarafa
left a comment
There was a problem hiding this comment.
LGTM, just a few styling nits.
| JsonCredentialParameters credentialParameters; | ||
| try | ||
| { | ||
| credentialParameters = await NewtonsoftJsonSerializer.Instance.DeserializeAsync<JsonCredentialParameters>(stream, cancellationToken).ConfigureAwait(false); | ||
| } | ||
| catch (Exception e) | ||
| { | ||
| throw new InvalidOperationException("Error deserializing JSON credential data.", e); | ||
| } | ||
|
|
||
| return FromJsonParameters<T>(credentialParameters); |
There was a problem hiding this comment.
| JsonCredentialParameters credentialParameters; | |
| try | |
| { | |
| credentialParameters = await NewtonsoftJsonSerializer.Instance.DeserializeAsync<JsonCredentialParameters>(stream, cancellationToken).ConfigureAwait(false); | |
| } | |
| catch (Exception e) | |
| { | |
| throw new InvalidOperationException("Error deserializing JSON credential data.", e); | |
| } | |
| return FromJsonParameters<T>(credentialParameters); | |
| try | |
| { | |
| return await NewtonsoftJsonSerializer.Instance.DeserializeAsync<JsonCredentialParameters>(stream, cancellationToken).ConfigureAwait(false); | |
| } | |
| catch (Exception e) | |
| { | |
| throw new InvalidOperationException("Error deserializing JSON credential data.", e); | |
| } |
There was a problem hiding this comment.
I've merged all into one line as suggested.
| } | ||
|
|
||
| CheckCompatibility(targetType, typeof(UserCredential)); |
There was a problem hiding this comment.
| } | |
| CheckCompatibility(targetType, typeof(UserCredential)); | |
| } | |
| CheckCompatibility(targetType, typeof(UserCredential)); |
But also, there's a lot of blank lines after. I think this may be your editor configuration, but it makes the code look longer than it actually is.
(This all can be done in a separate PR).
There was a problem hiding this comment.
I made sure to remove the extra space introduced around check compatibility.
Introduces `CredentialFactory` to enable the safe creation of specific `IGoogleCredential` types (e.g., `UserCredential`, `ServiceAccountCredential`) from various sources.
…s as obsolete and add warnings to XML docs and incorporate CredentialFactory.
2947315 to
4a7d0b3
Compare
Security related fix: - googleapis#3043 Depracate vulnerable credential loading mechanisms. See https://cloud.google.com/docs/authentication/client-libraries#external-credentials for more information.
Security related fix: - #3043 Depracate vulnerable credential loading mechanisms. See https://cloud.google.com/docs/authentication/client-libraries#external-credentials for more information.
Mitigating the "Windy Eagle" Credential Vulnerability
Services accepting external credential configurations with our auth libraries are vulnerable to malicious configurations that allow an attacker to exfiltrate data. This critical vulnerability exposes services and their host machines to data and token theft, undermining our security posture. This pull request mitigates the risk by deprecating unsafe loading methods and introducing a strict
CredentialFactorythat requires developers to explicitly define the expected credential type. Adopting this new pattern closes the credential exfiltration attack vector and provides a clear, secure standard for all developers.Key Changes
CredentialFactory: A secure, type-safe way to create credentials.FromJson,FromFile,FromStream, andFromJsonParametersare now obsolete.CredentialFactory.