From 43619f13742fffd789cb9cf57f07212c32206301 Mon Sep 17 00:00:00 2001 From: streiwil Date: Fri, 27 Sep 2019 13:08:50 -0500 Subject: [PATCH] Added warning if a header listed in SignedHeaders is missing from request --- src/main/java/burp/Utility.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/burp/Utility.java b/src/main/java/burp/Utility.java index 92b0edd..cb8d912 100644 --- a/src/main/java/burp/Utility.java +++ b/src/main/java/burp/Utility.java @@ -90,8 +90,12 @@ public static byte[] signRequest(IHttpRequestResponse messageInfo, StringBuilder canonicalHeaders = new StringBuilder(); - for (String signedHeader : signedHeaderList){ - canonicalHeaders.append(signedHeader.toLowerCase()).append(':').append(headerMap.get(signedHeader)).append('\n'); + for (String signedHeader : signedHeaderList) { + if (headerMap.containsKey(signedHeader)) { + canonicalHeaders.append(signedHeader.toLowerCase()).append(':').append(headerMap.get(signedHeader)).append('\n'); + } else { + pw.println("Warning: SignedHeader '" + signedHeader + "' does not exist in request headers."); + } } byte[] request = messageInfo.getRequest();