Skip to content

Commit c65e309

Browse files
Merge pull request #23 from JakubPatkowski/fix-security-alerts
fix: security scanning alerts
2 parents 15d9c9a + 0dc754b commit c65e309

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/TodoTaskAPI.API/Controllers/TodoController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public async Task<ActionResult<ApiResponseDto<IEnumerable<TodoDto>>>> FindTodos(
155155
try
156156
{
157157
_logger.LogInformation("Starting todo search with parameters: ID: {Id}",
158-
parameters.Id);
158+
LogSanitizer.Sanitize(parameters.Id));
159159

160160
// Call the FindTodosAsync method in the TodoService to retrieve the matching todos
161161
var todos = await _todoService.FindTodosAsync(parameters);

src/TodoTaskAPI.API/Middleware/RequestLoggingMiddleware.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ public async Task InvokeAsync(HttpContext context)
6464
// Log the response details, including the elapsed time.
6565
_logger.LogInformation(
6666
"Request {Method} {Path} completed in {ElapsedMilliseconds}ms with status code {StatusCode}",
67-
context.Request.Method,
68-
context.Request.Path,
67+
LogSanitizer.Sanitize(context.Request.Method),
68+
LogSanitizer.Sanitize(context.Request.Path),
6969
stopwatch.ElapsedMilliseconds,
7070
context.Response.StatusCode);
7171
}

src/TodoTaskAPI.Application/Services/TodoService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public async Task<IEnumerable<TodoDto>> FindTodosAsync(TodoSearchParametersDto p
117117
try
118118
{
119119
_logger.LogInformation("Starting todo search with parameters: ID: {Id}",
120-
parameters.Id);
120+
LogSanitizer.Sanitize(parameters.Id));
121121

122122
// Validate parameters
123123
parameters.ValidateParameters();

src/TodoTaskAPI.Infrastructure/Repositories/TodoRepository.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
using System;
2-
using Microsoft.EntityFrameworkCore;
1+
using Microsoft.EntityFrameworkCore;
32
using TodoTaskAPI.Core.Entities;
43
using TodoTaskAPI.Core.Interfaces;
54
using TodoTaskAPI.Infrastructure.Data;
65
using Microsoft.Extensions.Logging;
76
using TodoTaskAPI.Core.Exceptions;
7+
using TodoTaskAPI.Core.Helpers;
88

99
namespace TodoTaskAPI.Infrastructure.Repositories;
1010

@@ -80,7 +80,7 @@ public async Task<IEnumerable<Todo>> FindTodosAsync(Guid? id = null, string? tit
8080
}
8181
catch (Exception ex)
8282
{
83-
_logger.LogError(ex, "Error occurred while searching for todos. ID: {Id}", id);
83+
_logger.LogError(ex, "Error occurred while searching for todos. ID: {Id}", LogSanitizer.Sanitize(id));
8484
throw;
8585
}
8686
}

0 commit comments

Comments
 (0)