Skip to content

Commit cfa4478

Browse files
committed
Related to #250 - Timeout for regex
This prevents DoS via runaway regex evaluation. 100ms is more than generous for stripping non-alpahnumeric characters from a date.
1 parent 08a674d commit cfa4478

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

CSF.Screenplay.Selenium/Tasks/EnterTheDate.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ namespace CSF.Screenplay.Selenium.Actions
3232
public class EnterTheDate : IPerformable, ICanReport
3333
{
3434
const string nonNumericPattern = @"\D";
35-
static readonly Regex nonNumeric = new Regex(nonNumericPattern, RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
35+
static readonly Regex nonNumeric = new Regex(nonNumericPattern,
36+
RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant,
37+
TimeSpan.FromMilliseconds(100));
3638

3739
readonly DateTime? date;
3840
readonly ITarget target;

0 commit comments

Comments
 (0)