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();