More security!
All checks were successful
Build Docker Images / test (map[name:Morska plugin_project:DiunaBI.Plugins.Morska]) (push) Successful in 1m25s
Build Docker Images / test (map[name:PedrolloPL plugin_project:DiunaBI.Plugins.PedrolloPL]) (push) Successful in 1m25s
Build Docker Images / build-and-push (map[image_suffix:morska name:Morska plugin_project:DiunaBI.Plugins.Morska]) (push) Successful in 1m41s
Build Docker Images / build-and-push (map[image_suffix:pedrollopl name:PedrolloPL plugin_project:DiunaBI.Plugins.PedrolloPL]) (push) Successful in 1m40s
All checks were successful
Build Docker Images / test (map[name:Morska plugin_project:DiunaBI.Plugins.Morska]) (push) Successful in 1m25s
Build Docker Images / test (map[name:PedrolloPL plugin_project:DiunaBI.Plugins.PedrolloPL]) (push) Successful in 1m25s
Build Docker Images / build-and-push (map[image_suffix:morska name:Morska plugin_project:DiunaBI.Plugins.Morska]) (push) Successful in 1m41s
Build Docker Images / build-and-push (map[image_suffix:pedrollopl name:PedrolloPL plugin_project:DiunaBI.Plugins.PedrolloPL]) (push) Successful in 1m40s
This commit is contained in:
@@ -2,6 +2,7 @@ using DiunaBI.API.Services;
|
||||
using DiunaBI.Domain.Entities;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.RateLimiting;
|
||||
|
||||
namespace DiunaBI.API.Controllers;
|
||||
|
||||
@@ -15,6 +16,7 @@ public class AuthController(
|
||||
: ControllerBase
|
||||
{
|
||||
[HttpPost("apiToken")]
|
||||
[EnableRateLimiting("auth")]
|
||||
public async Task<IActionResult> ApiToken([FromBody] string idToken)
|
||||
{
|
||||
try
|
||||
|
||||
@@ -64,10 +64,20 @@ public class DataInboxController : Controller
|
||||
}
|
||||
|
||||
// check if datainbox.data is base64 encoded value
|
||||
if (!string.IsNullOrEmpty(dataInbox.Data) && !IsBase64String(dataInbox.Data))
|
||||
if (!string.IsNullOrEmpty(dataInbox.Data))
|
||||
{
|
||||
_logger.LogWarning("DataInbox: Invalid data format - not base64 encoded for source {Source}", dataInbox.Source);
|
||||
return BadRequest("Invalid data format - not base64 encoded");
|
||||
// Limit data size to 10MB to prevent DoS
|
||||
if (dataInbox.Data.Length > 10_000_000)
|
||||
{
|
||||
_logger.LogWarning("DataInbox: Data too large for source {Source}, size {Size}", dataInbox.Source, dataInbox.Data.Length);
|
||||
return BadRequest("Data too large (max 10MB)");
|
||||
}
|
||||
|
||||
if (!IsBase64String(dataInbox.Data))
|
||||
{
|
||||
_logger.LogWarning("DataInbox: Invalid data format - not base64 encoded for source {Source}", dataInbox.Source);
|
||||
return BadRequest("Invalid data format - not base64 encoded");
|
||||
}
|
||||
}
|
||||
|
||||
dataInbox.Id = Guid.NewGuid();
|
||||
@@ -97,6 +107,16 @@ public class DataInboxController : Controller
|
||||
{
|
||||
try
|
||||
{
|
||||
// Validate pagination parameters
|
||||
if (limit <= 0 || limit > 1000)
|
||||
{
|
||||
return BadRequest("Limit must be between 1 and 1000");
|
||||
}
|
||||
if (start < 0)
|
||||
{
|
||||
return BadRequest("Start must be non-negative");
|
||||
}
|
||||
|
||||
var query = _db.DataInbox.AsQueryable();
|
||||
|
||||
if (!string.IsNullOrEmpty(search))
|
||||
|
||||
@@ -42,6 +42,16 @@ public class JobsController : Controller
|
||||
{
|
||||
try
|
||||
{
|
||||
// Validate pagination parameters
|
||||
if (limit <= 0 || limit > 1000)
|
||||
{
|
||||
return BadRequest("Limit must be between 1 and 1000");
|
||||
}
|
||||
if (start < 0)
|
||||
{
|
||||
return BadRequest("Start must be non-negative");
|
||||
}
|
||||
|
||||
var query = _db.QueueJobs.AsQueryable();
|
||||
|
||||
if (status.HasValue)
|
||||
|
||||
@@ -48,6 +48,16 @@ public class LayersController : Controller
|
||||
{
|
||||
try
|
||||
{
|
||||
// Validate pagination parameters
|
||||
if (limit <= 0 || limit > 1000)
|
||||
{
|
||||
return BadRequest("Limit must be between 1 and 1000");
|
||||
}
|
||||
if (start < 0)
|
||||
{
|
||||
return BadRequest("Start must be non-negative");
|
||||
}
|
||||
|
||||
var query = _db.Layers.Where(x => !x.IsDeleted);
|
||||
|
||||
if (name != null)
|
||||
|
||||
Reference in New Issue
Block a user