Archive
This commit is contained in:
@ -35,8 +35,8 @@ public class InboundController : ControllerBase
|
||||
{
|
||||
public bool Success { get; set; }
|
||||
public long HeaderID { get; set; }
|
||||
public List<string> Errors { get; set; }
|
||||
public List<string> Warnings { get; set; }
|
||||
public List<string>? Errors { get; set; }
|
||||
public List<string>? Warnings { get; set; }
|
||||
}
|
||||
|
||||
// this is the main endpoint, it accepts a JSON message that contains both the header and data records together
|
||||
@ -86,7 +86,7 @@ public class InboundController : ControllerBase
|
||||
else
|
||||
r.Errors.Add("Invalid json");
|
||||
|
||||
if (r.Errors.Count == 0)
|
||||
if (r.Errors.Count == 0 && jsonbody is not null)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -147,14 +147,14 @@ public class InboundController : ControllerBase
|
||||
if (string.IsNullOrWhiteSpace(_AppSettings.InboundApiAllowedIPList))
|
||||
return true;
|
||||
|
||||
System.Net.IPAddress remoteIP = HttpContext.Connection.RemoteIpAddress;
|
||||
byte[] remoteIPBytes = remoteIP.GetAddressBytes();
|
||||
System.Net.IPAddress? remoteIP = HttpContext.Connection.RemoteIpAddress;
|
||||
byte[]? remoteIPBytes = remoteIP?.GetAddressBytes();
|
||||
|
||||
string[] allowedIPs = _AppSettings.InboundApiAllowedIPList.Split(';');
|
||||
foreach (string ip in allowedIPs)
|
||||
{
|
||||
System.Net.IPAddress parsedIP;
|
||||
if (System.Net.IPAddress.TryParse(ip, out parsedIP))
|
||||
System.Net.IPAddress? parsedIP;
|
||||
if (remoteIPBytes is not null && System.Net.IPAddress.TryParse(ip, out parsedIP))
|
||||
{
|
||||
if (parsedIP.GetAddressBytes().SequenceEqual(remoteIPBytes))
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user