The developer exception page is enabled without checking that the app runs in development
What it finds
UseDeveloperExceptionPage shows stack traces, source lines and request details to whoever triggers an error. Outside a check of IsDevelopment(), it is also enabled in production. Recent ASP.NET Core templates enable it in development by themselves.
From the rule's source, unguarded_developer_exception_page.rs.
using Microsoft.AspNetCore.Builder;using Microsoft.AspNetCore.Hosting; class Startup{ void Configure(IApplicationBuilder app, IWebHostEnvironment env) { app.UseDeveloperExceptionPage();tx0 reports: UseDeveloperExceptionPage is enabled in every environment if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } }} 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:unguarded-developer-exception-page" = "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:unguarded-developer-exception-page] reason="..."tx0 explain tx0/csharp:unguarded-developer-exception-page shows the same in the terminal. Found a false positive? Report it.