@Test public void testSecurityExceptionExposed() { RestServiceExceptionFacade exceptionFacade = getExceptionFacade(); exceptionFacade.setExposeInternalErrorDetails(true); String secretMessage = "Secret information not to be revealed on client - only to be logged on server!"; int statusCode = 403; String message = "The operation failed due to security restrictions. Please contact the support in case of a permission problem."; String code = null; checkFacade(exceptionFacade, new AccessDeniedException(secretMessage), statusCode, "SecurityErrorUserException: " + message + System.lineSeparator() + "AccessDeniedException: " + secretMessage, UUID_ANY, code); }
public void setExposeInternalErrorDetails(boolean exposeInternalErrorDetails) { this.exposeInternalErrorDetails = exposeInternalErrorDetails; if (exposeInternalErrorDetails) { String message = "****** Exposing of internal error details is enabled! This violates OWASP A6 (Sensitive Data Exposure) and shall only be used for testing/debugging and never in production. ******"; LOG.warn(message); System.err.println(message); } }
RestServiceExceptionFacade implements ExceptionMapper<Throwable> { public void setExposeInternalErrorDetails(boolean exposeInternalErrorDetails) { this.exposeInternalErrorDetails = exposeInternalErrorDetails; if (exposeInternalErrorDetails) { String message = "****** Exposing of internal error details is enabled! This violates OWASP A6 (Sensitive Data Exposure) and shall only be used for testing/debugging and never in production. ******"; LOG.warn(message); System.err.println(message); } } }
RestServiceExceptionFacade implements ExceptionMapper<Throwable> { public void setExposeInternalErrorDetails(boolean exposeInternalErrorDetails) { this.exposeInternalErrorDetails = exposeInternalErrorDetails; if (exposeInternalErrorDetails) { String message = "****** Exposing of internal error details is enabled! This violates OWASP A6 (Sensitive Data Exposure) and shall only be used for testing/debugging and never in production. ******"; LOG.warn(message); System.err.println(message); } } RestServiceExceptionFacade(); }
RestServiceExceptionFacade implements ExceptionMapper<Throwable> { public void setExposeInternalErrorDetails(boolean exposeInternalErrorDetails) { this.exposeInternalErrorDetails = exposeInternalErrorDetails; if (exposeInternalErrorDetails) { String message = "****** Exposing of internal error details is enabled! This violates OWASP A6 (Sensitive Data Exposure) and shall only be used for testing/debugging and never in production. ******"; LOG.warn(message); System.err.println(message); } } RestServiceExceptionFacade(); @Override Response toResponse(Throwable exception); ObjectMapper getMapper(); @Inject void setMapper(ObjectMapper mapper); void setExposeInternalErrorDetails(boolean exposeInternalErrorDetails); boolean isExposeInternalErrorDetails(); }
RestServiceExceptionFacade implements ExceptionMapper<Throwable> { public void setExposeInternalErrorDetails(boolean exposeInternalErrorDetails) { this.exposeInternalErrorDetails = exposeInternalErrorDetails; if (exposeInternalErrorDetails) { String message = "****** Exposing of internal error details is enabled! This violates OWASP A6 (Sensitive Data Exposure) and shall only be used for testing/debugging and never in production. ******"; LOG.warn(message); System.err.println(message); } } RestServiceExceptionFacade(); @Override Response toResponse(Throwable exception); ObjectMapper getMapper(); @Inject void setMapper(ObjectMapper mapper); void setExposeInternalErrorDetails(boolean exposeInternalErrorDetails); boolean isExposeInternalErrorDetails();  }