Skip to content

Commit

Permalink
Add Regex timeout to prevent ReDoS attack
Browse files Browse the repository at this point in the history
  • Loading branch information
christiaanderidder committed Aug 27, 2024
1 parent f181c82 commit 674deb7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/QuestPDF.Markdown/ParsedMarkdownDocument.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class ParsedMarkdownDocument
{
private readonly MarkdownDocument _document;
private readonly ConcurrentDictionary<string, ImageWithDimensions> _imageCache = new();
private static readonly Regex DataUri = new(@"data:image\/.+?;base64,(?<data>.+)", RegexOptions.Compiled);
private static readonly Regex DataUri = new(@"data:image\/.+?;base64,(?<data>.+)", RegexOptions.Compiled, TimeSpan.FromMilliseconds(100));

private static readonly HttpClient HttpClient = new();

Expand Down

0 comments on commit 674deb7

Please sign in to comment.