Skip to content

Commit

Permalink
fix(sonar): remove security issue with regex timespan
Browse files Browse the repository at this point in the history
  • Loading branch information
followynne committed Sep 1, 2023
1 parent 0fc9064 commit d961636
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Serilog.Ui.Web/SerilogUiMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Serilog.Ui.Web.Endpoints;
using System;
using System.Reflection;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
Expand Down Expand Up @@ -63,6 +64,6 @@ private StaticFileMiddleware CreateStaticFileMiddleware(
}

private bool CheckPath(string currentPath, string OnPath)
=> Regex.IsMatch(currentPath, $"^/{Regex.Escape(_options.RoutePrefix)}{OnPath}$", RegexOptions.IgnoreCase);
=> Regex.IsMatch(currentPath, $"^/{Regex.Escape(_options.RoutePrefix)}{OnPath}$", RegexOptions.IgnoreCase, TimeSpan.FromSeconds(5));
}
}

0 comments on commit d961636

Please sign in to comment.