fix(security): Resolve SonarQube security hotspots
SonarQube Analysis / sonarqube (pull_request) Successful in 3m9s
SonarQube Analysis / sonarqube (pull_request) Successful in 3m9s
Introduce a default regex match timeout across the library to prevent potential ReDoS attacks (SonarQube rule S6444). Implement `[OnDeserialized]` methods to re-establish object invariants and validate state after deserialization, addressing SonarQube rule S5766.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Text.RegularExpressions;
|
||||
using Strata.SqlTools.SqlBreakdown.Utilities;
|
||||
|
||||
namespace Strata.SqlTools.SqlBreakdown.Extensions;
|
||||
|
||||
@@ -119,7 +120,7 @@ public static class StringExtensions
|
||||
public static bool IsGUID(this string aString)
|
||||
{
|
||||
const string pattern = "^[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}$";
|
||||
var match = Regex.Match(aString, pattern);
|
||||
var match = Regex.Match(aString, pattern, RegexOptions.None, RegexDefaults.MatchTimeout);
|
||||
return match.Success;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user