Skip to content

Commit b286086

Browse files
authored
Supress CodeQL warnings, update build agents (#484)
1 parent c853999 commit b286086

File tree

13 files changed

+20
-20
lines changed

13 files changed

+20
-20
lines changed

azure-pipelines.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ stages:
6969
pool:
7070
${{ if eq(variables['System.TeamProject'], 'public') }}:
7171
name: NetCore-Public
72-
demands: ImageOverride -equals Build.Windows.10.Amd64.VS2019.Pre.Open
72+
demands: ImageOverride -equals 1es-windows-2019-open
7373
${{ if ne(variables['System.TeamProject'], 'public') }}:
7474
name: NetCore1ESPool-Internal
75-
demands: ImageOverride -equals Build.Windows.10.Amd64.VS2019.Pre
75+
demands: ImageOverride -equals 1es-windows-2019
7676
${{ if eq(variables.runCodeQL3000, 'true') }}:
7777
# Component governance and SBOM creation are not needed here. Disable what Arcade would inject.
7878
disableComponentGovernance: true

src/Microsoft.Owin.Host.SystemWeb/SystemWebChunkingCookieManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ public void AppendResponseCookie(IOwinContext context, string key, string value,
193193
// Normal cookie
194194
if (!ChunkSize.HasValue || ChunkSize.Value > prefix.Length + escapedValue.Length + suffix.Length + (quoted ? 2 : 0))
195195
{
196-
var cookie = new HttpCookie(escapedKey, escapedValue);
196+
var cookie = new HttpCookie(escapedKey, escapedValue); // CodeQL [SM03822] False positive, this is an abstraction and the values are determined elsewhere.
197197
SetOptions(cookie, options, domainHasValue, pathHasValue, expiresHasValue);
198198

199199
webContext.Response.AppendCookie(cookie);

src/Microsoft.Owin.Security.ActiveDirectory/WsFedCachingSecurityKeyProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public WsFedCachingSecurityKeyProvider(string metadataEndpoint, ICertificateVali
4545
{
4646
throw new InvalidOperationException(Properties.Resources.Exception_ValidatorHandlerMismatch);
4747
}
48-
webRequestHandler.ServerCertificateValidationCallback = backchannelCertificateValidator.Validate;
48+
webRequestHandler.ServerCertificateValidationCallback = backchannelCertificateValidator.Validate; // CodeQL [SM03786] False positive, not disabled by default. Used for testing and extensibility.
4949
}
5050

5151
RetrieveMetadata();

src/Microsoft.Owin.Security.ActiveDirectory/WsFedMetadataRetriever.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ internal static class WsFedMetadataRetriever
2020

2121
public static IssuerSigningKeys GetSigningKeys(string metadataEndpoint, TimeSpan backchannelTimeout, HttpMessageHandler backchannelHttpHandler)
2222
{
23-
using (var metadataRequest = new HttpClient(backchannelHttpHandler, false))
23+
using (var metadataRequest = new HttpClient(backchannelHttpHandler, false))// CodeQL [SM02185] Enabling certificate revocation would be a breaking change. Customers can enable it.
2424
{
2525
metadataRequest.Timeout = backchannelTimeout;
2626
using (HttpResponseMessage metadataResponse = metadataRequest.GetAsync(metadataEndpoint).Result)

src/Microsoft.Owin.Security.Facebook/FacebookAuthenticationMiddleware.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public FacebookAuthenticationMiddleware(
6161
Options.SignInAsAuthenticationType = app.GetDefaultSignInAsAuthenticationType();
6262
}
6363

64-
_httpClient = new HttpClient(ResolveHttpMessageHandler(Options));
64+
_httpClient = new HttpClient(ResolveHttpMessageHandler(Options)); // CodeQL [SM02185] Enabling certificate revocation would be a breaking change. Customers can enable it.
6565
_httpClient.Timeout = Options.BackchannelTimeout;
6666
_httpClient.MaxResponseContentBufferSize = 1024 * 1024 * 10; // 10 MB
6767
}
@@ -89,7 +89,7 @@ private static HttpMessageHandler ResolveHttpMessageHandler(FacebookAuthenticati
8989
{
9090
throw new InvalidOperationException(Resources.Exception_ValidatorHandlerMismatch);
9191
}
92-
webRequestHandler.ServerCertificateValidationCallback = options.BackchannelCertificateValidator.Validate;
92+
webRequestHandler.ServerCertificateValidationCallback = options.BackchannelCertificateValidator.Validate; // CodeQL [SM03786] False positive, not disabled by default. Used for testing and extensibility.
9393
}
9494

9595
return handler;

src/Microsoft.Owin.Security.Google/GoogleOAuth2AuthenticationMiddleware.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public GoogleOAuth2AuthenticationMiddleware(
6363
Options.SignInAsAuthenticationType = app.GetDefaultSignInAsAuthenticationType();
6464
}
6565

66-
_httpClient = new HttpClient(ResolveHttpMessageHandler(Options));
66+
_httpClient = new HttpClient(ResolveHttpMessageHandler(Options)); // CodeQL [SM02185] Enabling certificate revocation would be a breaking change. Customers can enable it.
6767
_httpClient.Timeout = Options.BackchannelTimeout;
6868
_httpClient.MaxResponseContentBufferSize = 1024 * 1024 * 10; // 10 MB
6969
}
@@ -91,7 +91,7 @@ private static HttpMessageHandler ResolveHttpMessageHandler(GoogleOAuth2Authenti
9191
{
9292
throw new InvalidOperationException(Resources.Exception_ValidatorHandlerMismatch);
9393
}
94-
webRequestHandler.ServerCertificateValidationCallback = options.BackchannelCertificateValidator.Validate;
94+
webRequestHandler.ServerCertificateValidationCallback = options.BackchannelCertificateValidator.Validate; // CodeQL [SM03786] False positive, not disabled by default. Used for testing and extensibility.
9595
}
9696

9797
return handler;

src/Microsoft.Owin.Security.MicrosoftAccount/MicrosoftAccountAuthenticationMiddleware.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public MicrosoftAccountAuthenticationMiddleware(
6161
Options.SignInAsAuthenticationType = app.GetDefaultSignInAsAuthenticationType();
6262
}
6363

64-
_httpClient = new HttpClient(ResolveHttpMessageHandler(Options));
64+
_httpClient = new HttpClient(ResolveHttpMessageHandler(Options)); // CodeQL [SM02185] Enabling certificate revocation would be a breaking change. Customers can enable it.
6565
_httpClient.Timeout = Options.BackchannelTimeout;
6666
_httpClient.MaxResponseContentBufferSize = 1024 * 1024 * 10; // 10 MB
6767
}
@@ -89,7 +89,7 @@ private static HttpMessageHandler ResolveHttpMessageHandler(MicrosoftAccountAuth
8989
{
9090
throw new InvalidOperationException(Resources.Exception_ValidatorHandlerMismatch);
9191
}
92-
webRequestHandler.ServerCertificateValidationCallback = options.BackchannelCertificateValidator.Validate;
92+
webRequestHandler.ServerCertificateValidationCallback = options.BackchannelCertificateValidator.Validate; // CodeQL [SM03786] False positive, not disabled by default. Used for testing and extensibility.
9393
}
9494

9595
return handler;

src/Microsoft.Owin.Security.OpenIdConnect/OpenIdConnectAuthenticationMiddleware.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public OpenIdConnectAuthenticationMiddleware(OwinMiddleware next, IAppBuilder ap
6969

7070
if (Options.Backchannel == null)
7171
{
72-
Options.Backchannel = new HttpClient(ResolveHttpMessageHandler(Options));
72+
Options.Backchannel = new HttpClient(ResolveHttpMessageHandler(Options)); // CodeQL [SM02185] Enabling certificate revocation would be a breaking change. Customers can enable it.
7373
Options.Backchannel.DefaultRequestHeaders.UserAgent.ParseAdd("Microsoft ASP.NET Core OpenIdConnect middleware");
7474
Options.Backchannel.Timeout = Options.BackchannelTimeout;
7575
Options.Backchannel.MaxResponseContentBufferSize = 1024 * 1024 * 10; // 10 MB
@@ -133,7 +133,7 @@ private static HttpMessageHandler ResolveHttpMessageHandler(OpenIdConnectAuthent
133133
throw new InvalidOperationException(Resources.Exception_ValidatorHandlerMismatch);
134134
}
135135

136-
webRequestHandler.ServerCertificateValidationCallback = options.BackchannelCertificateValidator.Validate;
136+
webRequestHandler.ServerCertificateValidationCallback = options.BackchannelCertificateValidator.Validate; // CodeQL [SM03786] False positive, not disabled by default. Used for testing and extensibility.
137137
}
138138

139139
return handler;

src/Microsoft.Owin.Security.Twitter/TwitterAuthenticationHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ private static string GenerateTimeStamp()
359359

360360
private static string ComputeSignature(string consumerSecret, string tokenSecret, string signatureData)
361361
{
362-
using (var algorithm = new HMACSHA1())
362+
using (var algorithm = new HMACSHA1()) // CodeQL [SM02200] Required by protocol.
363363
{
364364
algorithm.Key = Encoding.ASCII.GetBytes(
365365
string.Format(CultureInfo.InvariantCulture,

src/Microsoft.Owin.Security.Twitter/TwitterAuthenticationMiddleware.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public TwitterAuthenticationMiddleware(
6767
Options.SignInAsAuthenticationType = app.GetDefaultSignInAsAuthenticationType();
6868
}
6969

70-
_httpClient = new HttpClient(ResolveHttpMessageHandler(Options));
70+
_httpClient = new HttpClient(ResolveHttpMessageHandler(Options)); // CodeQL [SM02185] Enabling certificate revocation would be a breaking change. Customers can enable it.
7171
_httpClient.Timeout = Options.BackchannelTimeout;
7272
_httpClient.MaxResponseContentBufferSize = 1024 * 1024 * 10; // 10 MB
7373
_httpClient.DefaultRequestHeaders.Accept.ParseAdd("*/*");
@@ -100,7 +100,7 @@ private static HttpMessageHandler ResolveHttpMessageHandler(TwitterAuthenticatio
100100
}
101101
else if (options.BackchannelCertificateValidator != null)
102102
{
103-
webRequestHandler.ServerCertificateValidationCallback = options.BackchannelCertificateValidator.Validate;
103+
webRequestHandler.ServerCertificateValidationCallback = options.BackchannelCertificateValidator.Validate; // CodeQL [SM03786] False positive, not disabled by default. Used for testing and extensibility.
104104
}
105105

106106
return handler;

0 commit comments

Comments
 (0)