From 1678fec3fe4c6e90c430526337c2bba345ef5993 Mon Sep 17 00:00:00 2001 From: Kennedy Lodonu Date: Wed, 16 Oct 2024 01:58:24 +0000 Subject: [PATCH] Fix code scanning alert no. 2: Log entries created from user input Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- examples/WebApplication1/Controllers/RequestController.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/WebApplication1/Controllers/RequestController.cs b/examples/WebApplication1/Controllers/RequestController.cs index de8b16c..6f2060f 100644 --- a/examples/WebApplication1/Controllers/RequestController.cs +++ b/examples/WebApplication1/Controllers/RequestController.cs @@ -41,7 +41,8 @@ [FromBody]ProgrammableServiceRequest request { //this action will be called anytime a user wants to interact with your application - _logger.LogDebug("received request for {msisdn} {session_id} {gs_request}", request.Mobile, request.SessionId, + var sanitizedSessionId = request.SessionId?.Replace(Environment.NewLine, "").Replace("\n", "").Replace("\r", ""); + _logger.LogDebug("received request for {msisdn} {session_id} {gs_request}", request.Mobile, sanitizedSessionId, JsonConvert.SerializeObject(request)); var response = await _programmableService.ExecuteInteraction(request, nameof(EvdController));