The signing keys of an authentication issuer may be fetched over plain HTTP
What it finds
JWT bearer and OpenID Connect authentication download the signing keys of the token issuer from its metadata address. RequireHttpsMetadata = false allows that download over plain HTTP, where anyone on the path can hand over keys of their own and then sign tokens the application accepts. Assignments inside a check for the development environment are left alone.
From the rule's source, https_metadata_not_required.rs.
using Microsoft.AspNetCore.Authentication.JwtBearer;using Microsoft.Extensions.Hosting; class Auth{ void Configure(JwtBearerOptions options, IHostEnvironment env) { options.RequireHttpsMetadata = false;tx0 reports: the issuer's signing keys may be fetched over plain HTTP if (env.IsDevelopment()) { options.RequireHttpsMetadata = false; } options.RequireHttpsMetadata = true; options.RequireHttpsMetadata = !env.IsDevelopment(); }} Turn it on, off or suppress it
The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/csharp:https-metadata-not-required" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/csharp:https-metadata-not-required] reason="..."tx0 explain tx0/csharp:https-metadata-not-required shows the same in the terminal. Found a false positive? Report it.