ASP.NET Core (.NET 8), intentionally outdated NuGet packages (Newtonsoft.Json 12.0.2, Microsoft.Data.SqlClient 2.0.0) for SCA demo. CWE-89, CWE-327, CWE-798, CWE-22, CWE-330 in LegacyReports.cs.
22 lines
581 B
C#
22 lines
581 B
C#
var builder = WebApplication.CreateBuilder(args);
|
|
var app = builder.Build();
|
|
|
|
var items = new[]
|
|
{
|
|
new { Id = 1, Name = "Rack server R740", Stock = 12 },
|
|
new { Id = 2, Name = "Switch 48p PoE", Stock = 31 },
|
|
new { Id = 3, Name = "UPS 3000VA", Stock = 7 },
|
|
};
|
|
|
|
app.MapGet("/health", () => Results.Json(new { status = "healthy" }));
|
|
|
|
app.MapGet("/api/items", () => Results.Json(items));
|
|
|
|
app.MapGet("/api/items/{id:int}", (int id) =>
|
|
{
|
|
var item = items.FirstOrDefault(i => i.Id == id);
|
|
return item is null ? Results.NotFound() : Results.Json(item);
|
|
});
|
|
|
|
app.Run();
|