Security: controllers and stack traces in logs
All checks were successful
Build Docker Images / test (map[name:Morska plugin_project:DiunaBI.Plugins.Morska]) (push) Successful in 1m32s
Build Docker Images / test (map[name:PedrolloPL plugin_project:DiunaBI.Plugins.PedrolloPL]) (push) Successful in 1m29s
Build Docker Images / build-and-push (map[image_suffix:morska name:Morska plugin_project:DiunaBI.Plugins.Morska]) (push) Successful in 1m47s
Build Docker Images / build-and-push (map[image_suffix:pedrollopl name:PedrolloPL plugin_project:DiunaBI.Plugins.PedrolloPL]) (push) Successful in 1m42s
All checks were successful
Build Docker Images / test (map[name:Morska plugin_project:DiunaBI.Plugins.Morska]) (push) Successful in 1m32s
Build Docker Images / test (map[name:PedrolloPL plugin_project:DiunaBI.Plugins.PedrolloPL]) (push) Successful in 1m29s
Build Docker Images / build-and-push (map[image_suffix:morska name:Morska plugin_project:DiunaBI.Plugins.Morska]) (push) Successful in 1m47s
Build Docker Images / build-and-push (map[image_suffix:pedrollopl name:PedrolloPL plugin_project:DiunaBI.Plugins.PedrolloPL]) (push) Successful in 1m42s
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using DiunaBI.API.Attributes;
|
||||
using DiunaBI.Application.DTOModels.Common;
|
||||
using DiunaBI.Domain.Entities;
|
||||
using DiunaBI.Infrastructure.Data;
|
||||
@@ -82,7 +83,7 @@ public class JobsController : Controller
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "GetAll: Error retrieving jobs");
|
||||
return BadRequest(ex.ToString());
|
||||
return BadRequest("An error occurred while retrieving jobs");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,21 +109,15 @@ public class JobsController : Controller
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Get: Error retrieving job {JobId}", id);
|
||||
return BadRequest(ex.ToString());
|
||||
return BadRequest("An error occurred processing your request");
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("schedule/{apiKey}")]
|
||||
[AllowAnonymous]
|
||||
public async Task<IActionResult> ScheduleJobs(string apiKey, [FromQuery] string? nameFilter = null)
|
||||
[Route("schedule")]
|
||||
[ApiKeyAuth]
|
||||
public async Task<IActionResult> ScheduleJobs([FromQuery] string? nameFilter = null)
|
||||
{
|
||||
if (apiKey != _configuration["apiKey"])
|
||||
{
|
||||
_logger.LogWarning("ScheduleJobs: Unauthorized request with apiKey {ApiKey}", apiKey);
|
||||
return Unauthorized();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var jobsCreated = await _jobScheduler.ScheduleAllJobsAsync(nameFilter);
|
||||
@@ -139,21 +134,15 @@ public class JobsController : Controller
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "ScheduleJobs: Error scheduling jobs");
|
||||
return BadRequest(ex.ToString());
|
||||
return BadRequest("An error occurred processing your request");
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("schedule/imports/{apiKey}")]
|
||||
[AllowAnonymous]
|
||||
public async Task<IActionResult> ScheduleImportJobs(string apiKey, [FromQuery] string? nameFilter = null)
|
||||
[Route("schedule/imports")]
|
||||
[ApiKeyAuth]
|
||||
public async Task<IActionResult> ScheduleImportJobs([FromQuery] string? nameFilter = null)
|
||||
{
|
||||
if (apiKey != _configuration["apiKey"])
|
||||
{
|
||||
_logger.LogWarning("ScheduleImportJobs: Unauthorized request with apiKey {ApiKey}", apiKey);
|
||||
return Unauthorized();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var jobsCreated = await _jobScheduler.ScheduleImportJobsAsync(nameFilter);
|
||||
@@ -170,21 +159,15 @@ public class JobsController : Controller
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "ScheduleImportJobs: Error scheduling import jobs");
|
||||
return BadRequest(ex.ToString());
|
||||
return BadRequest("An error occurred processing your request");
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("schedule/processes/{apiKey}")]
|
||||
[AllowAnonymous]
|
||||
public async Task<IActionResult> ScheduleProcessJobs(string apiKey)
|
||||
[Route("schedule/processes")]
|
||||
[ApiKeyAuth]
|
||||
public async Task<IActionResult> ScheduleProcessJobs()
|
||||
{
|
||||
if (apiKey != _configuration["apiKey"])
|
||||
{
|
||||
_logger.LogWarning("ScheduleProcessJobs: Unauthorized request with apiKey {ApiKey}", apiKey);
|
||||
return Unauthorized();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var jobsCreated = await _jobScheduler.ScheduleProcessJobsAsync();
|
||||
@@ -201,7 +184,7 @@ public class JobsController : Controller
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "ScheduleProcessJobs: Error scheduling process jobs");
|
||||
return BadRequest(ex.ToString());
|
||||
return BadRequest("An error occurred processing your request");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,7 +226,7 @@ public class JobsController : Controller
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "RetryJob: Error retrying job {JobId}", id);
|
||||
return BadRequest(ex.ToString());
|
||||
return BadRequest("An error occurred processing your request");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -290,7 +273,7 @@ public class JobsController : Controller
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "CancelJob: Error cancelling job {JobId}", id);
|
||||
return BadRequest(ex.ToString());
|
||||
return BadRequest("An error occurred processing your request");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -317,7 +300,7 @@ public class JobsController : Controller
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "GetStats: Error retrieving job statistics");
|
||||
return BadRequest(ex.ToString());
|
||||
return BadRequest("An error occurred processing your request");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -429,7 +412,7 @@ public class JobsController : Controller
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "CreateJobForLayer: Error creating job for layer {LayerId}", layerId);
|
||||
return BadRequest(ex.ToString());
|
||||
return BadRequest("An error occurred processing your request");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user