From 955d93bf2e0f5aba8c7acdbc829522a8382a7f0d Mon Sep 17 00:00:00 2001 From: Eric J Potter Date: Thu, 19 Dec 2024 12:53:16 -0600 Subject: [PATCH] Update aws-sigv4.kts Small reordering of code to avoid an NPE that turned up in extended testing. --- scripts/examples/httpsender/aws-sigv4.kts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/examples/httpsender/aws-sigv4.kts b/scripts/examples/httpsender/aws-sigv4.kts index 85c2fd0..69b7697 100644 --- a/scripts/examples/httpsender/aws-sigv4.kts +++ b/scripts/examples/httpsender/aws-sigv4.kts @@ -58,10 +58,10 @@ fun sendingRequest(msg: HttpMessage, initiator: Int, helper: HttpSenderScriptHel val host = msg.requestHeader.hostName var canonicalQuerystring = "" - if (parsedUrl.query != "") { + var query = parsedUrl.query ?: "" + if (query != "") { // Replace any + * from ZAP Payloads with %20/%2A - + * breaks signature - val query = parsedUrl.query - .replace("+", "%20") + query.replace("+", "%20") .replace("*", "%2A") // sort parameters @@ -119,4 +119,4 @@ fun responseReceived(msg: HttpMessage, initiator: Int, helper: HttpSenderScriptH logger.info("responseReceived function called") logger.info("\n${msg.requestHeader}\n${msg.requestBody}") logger.info("\n${msg.responseHeader}\n${msg.responseBody}") -} \ No newline at end of file +}