diff --git a/SampleProjects/VulnerableRunTimeWebApp/Program.cs b/SampleProjects/VulnerableRunTimeWebApp/Program.cs index 48b40cd..48dd35b 100644 --- a/SampleProjects/VulnerableRunTimeWebApp/Program.cs +++ b/SampleProjects/VulnerableRunTimeWebApp/Program.cs @@ -4,9 +4,15 @@ using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore; +using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; +using Serilog; +using Serilog.Formatting.Compact; +using Serilog.Sinks.SystemConsole.Themes; namespace VulnerableRunTimeWebApp { @@ -19,6 +25,15 @@ public static void Main(string[] args) public static IWebHostBuilder CreateWebHostBuilder(string[] args) => WebHost.CreateDefaultBuilder(args) - .UseStartup(); + .ConfigureServices((app, services) => + { + services.AddRetireRuntimeHostedService(); + }) + .Configure(app => app.UseRuntimeVulnerabilityReport()) + .UseSerilog((hostingContext, loggerConfiguration) => + loggerConfiguration + .ReadFrom.Configuration(hostingContext.Configuration) + .WriteTo.Console(new CompactJsonFormatter())); + } } diff --git a/SampleProjects/VulnerableRunTimeWebApp/Startup.cs b/SampleProjects/VulnerableRunTimeWebApp/Startup.cs deleted file mode 100644 index 2ef0467..0000000 --- a/SampleProjects/VulnerableRunTimeWebApp/Startup.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.DependencyInjection; - -namespace VulnerableRunTimeWebApp -{ - public class Startup - { - // This method gets called by the runtime. Use this method to add services to the container. - // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 - public void ConfigureServices(IServiceCollection services) - { - services.AddRetireRuntimeHostedService(); - } - - // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IWebHostEnvironment env) - { - app.UseRuntimeVulnerabilityReport(); - } - } -} diff --git a/SampleProjects/VulnerableRunTimeWebApp/VulnerableRunTimeWebApp.csproj b/SampleProjects/VulnerableRunTimeWebApp/VulnerableRunTimeWebApp.csproj index 8b0b649..0dc6687 100644 --- a/SampleProjects/VulnerableRunTimeWebApp/VulnerableRunTimeWebApp.csproj +++ b/SampleProjects/VulnerableRunTimeWebApp/VulnerableRunTimeWebApp.csproj @@ -1,18 +1,21 @@ - netcoreapp3.1;net5.0 + netcoreapp3.1 - - + + + + - - + + + diff --git a/src/RetireNet.Runtimes.BackgroundServices/RetireRuntimeBackgroundService.cs b/src/RetireNet.Runtimes.BackgroundServices/RetireRuntimeBackgroundService.cs index 5f86ee5..5a48e2f 100644 --- a/src/RetireNet.Runtimes.BackgroundServices/RetireRuntimeBackgroundService.cs +++ b/src/RetireNet.Runtimes.BackgroundServices/RetireRuntimeBackgroundService.cs @@ -38,7 +38,7 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken) var report = await _reportGenerator.GetReport(AppRunTimeDetails.Build()); if (report.IsVulnerable.HasValue && report.IsVulnerable.Value) { - _logger.LogWarning("Running on vulnerable runtime {appruntime}. Security release {securityrelease}", report.AppRuntimeDetails.AppRuntimeVersion, report.SecurityRelease.RuntimeVersion); + _logger.LogWarning("Running on vulnerable runtime {VulnerableRuntime}. Security release {SecurityPatch}", report.AppRuntimeDetails.AppRuntimeVersion, report.SecurityRelease.RuntimeVersion); } await Task.Delay(optionsCheckInterval, stoppingToken);