Skip to content

Commit

Permalink
fix Bug 65922
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelbannov committed Jan 17, 2024
1 parent e216cef commit 37045a7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion common/ASC.Webhooks.Core/DbWorker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ public async Task<WebhooksConfig> AddWebhookConfig(string uri, string name, stri

var restrictions = _configuration.GetSection("webhooks:blacklist").Get<List<string>>() ?? new List<string>();

if (Uri.TryCreate(uri, UriKind.Absolute, out var parsedUri) && restrictions.Any(r => IPAddressRange.MatchIPs(parsedUri.Host, r)))
if (Uri.TryCreate(uri, UriKind.Absolute, out var parsedUri) &&
System.Net.IPAddress.TryParse(parsedUri.Host, out _) &&
restrictions.Any(r => IPAddressRange.MatchIPs(parsedUri.Host, r)))
{
throw new SecurityException();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public class WebhooksConfigRequestsDto

/// <summary>URI</summary>
/// <type>System.String, System</type>
[Url]
public string Uri { get; set; }

/// <summary>Secret key</summary>
Expand Down

0 comments on commit 37045a7

Please sign in to comment.