diff --git a/newrelic-security-agent/src/main/java/com/newrelic/agent/security/intcodeagent/constants/HttpStatusCodes.java b/newrelic-security-agent/src/main/java/com/newrelic/agent/security/intcodeagent/constants/HttpStatusCodes.java index a09c3f961..7cf99e9ae 100644 --- a/newrelic-security-agent/src/main/java/com/newrelic/agent/security/intcodeagent/constants/HttpStatusCodes.java +++ b/newrelic-security-agent/src/main/java/com/newrelic/agent/security/intcodeagent/constants/HttpStatusCodes.java @@ -54,7 +54,23 @@ public class HttpStatusCodes { codes.put(508, "Loop Detected"); codes.put(510, "Not Extended"); codes.put(511, "Network Authentication Required"); - + codes.put(0, "OK"); + codes.put(1, "Cancelled"); + codes.put(2, "Unknown"); + codes.put(3, "Invalid Argument"); + codes.put(4, "Deadline Exceeded"); + codes.put(5, "Not Found"); + codes.put(6, "Already Exists"); + codes.put(7, "Permission Denied"); + codes.put(8, "Resource Exhausted"); + codes.put(9, "Failed Precondition"); + codes.put(10, "Aborted"); + codes.put(11, "Out Of Range"); + codes.put(12, "Unimplemented"); + codes.put(13, "Internal"); + codes.put(14, "Unavailable"); + codes.put(15, "Data Loss"); + codes.put(16, "Unauthenticated"); } public static String getStatusCode(int code) { diff --git a/newrelic-security-api/src/main/java/com/newrelic/api/agent/security/instrumentation/helpers/ServletHelper.java b/newrelic-security-api/src/main/java/com/newrelic/api/agent/security/instrumentation/helpers/ServletHelper.java index a6c57384e..da431894b 100644 --- a/newrelic-security-api/src/main/java/com/newrelic/api/agent/security/instrumentation/helpers/ServletHelper.java +++ b/newrelic-security-api/src/main/java/com/newrelic/api/agent/security/instrumentation/helpers/ServletHelper.java @@ -36,7 +36,7 @@ public class ServletHelper { public static final String NR_SEC_HTTP_SESSION_ATTRIB_NAME = "NR-CSEC-HTTP-SESSION-"; public static final String NR_SEC_HTTP_SERVLET_RESPONSE_ATTRIB_NAME = "NR-CSEC-HTTP-SERVLET-RESPONSE-"; - private static Set filesToRemove = ConcurrentHashMap.newKeySet(); + private static final Set filesToRemove = ConcurrentHashMap.newKeySet(); private static final Set unsupportedContentType = new HashSet() {{ add("application/zip"); add("application/epub+zip"); @@ -240,7 +240,7 @@ public static void executeBeforeExitingTransaction() { } int responseCode = NewRelicSecurity.getAgent().getSecurityMetaData().getResponse().getResponseCode(); - if(responseCode >= 500){ + if(responseCode >= 500 || responseCode == 2 || responseCode == 12 || responseCode == 13 || responseCode == 15){ Exception exception = NewRelicSecurity.getAgent().getSecurityMetaData().getCustomAttribute("ENDMOST_EXCEPTION", Exception.class); NewRelicSecurity.getAgent().recordExceptions(NewRelicSecurity.getAgent().getSecurityMetaData(), exception); }