Demote fake file server contents logging to debug. (#4440)

Don't log PHI at INFO, even if it is fake test data.
This commit is contained in:
michaelabuckley 2023-01-17 17:36:34 -05:00 committed by GitHub
parent 8029e2d5bc
commit 2f5ffe7554
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 5 deletions

View File

@ -0,0 +1,5 @@
---
type: change
issue: 4440
title: "During testing, the bulk-import command line tool logs file contents.
This logging has been demoted to DEBUG level as bulk-import files may contain PHI."

View File

@ -59,7 +59,7 @@ public class BulkImportFileServlet extends HttpServlet {
public static final String DEFAULT_HEADER_CONTENT_TYPE = CT_FHIR_NDJSON + CHARSET_UTF8_CTSUFFIX; public static final String DEFAULT_HEADER_CONTENT_TYPE = CT_FHIR_NDJSON + CHARSET_UTF8_CTSUFFIX;
@Override @Override
protected void doGet(HttpServletRequest theRequest, HttpServletResponse theResponse) throws ServletException, IOException { protected void doGet(HttpServletRequest theRequest, HttpServletResponse theResponse) throws IOException {
try { try {
String servletPath = theRequest.getServletPath(); String servletPath = theRequest.getServletPath();
String requestUri = theRequest.getRequestURI(); String requestUri = theRequest.getRequestURI();
@ -86,7 +86,7 @@ public class BulkImportFileServlet extends HttpServlet {
} }
} }
private void handleDownload(HttpServletRequest theRequest, HttpServletResponse theResponse) throws ServletException, IOException { private void handleDownload(HttpServletRequest theRequest, HttpServletResponse theResponse) throws IOException {
String indexParam = defaultString(theRequest.getParameter(INDEX_PARAM)); String indexParam = defaultString(theRequest.getParameter(INDEX_PARAM));
if (isBlank(indexParam)) { if (isBlank(indexParam)) {
throw new ResourceNotFoundException(Msg.code(2050) + "Missing or invalid index parameter"); throw new ResourceNotFoundException(Msg.code(2050) + "Missing or invalid index parameter");
@ -104,9 +104,11 @@ public class BulkImportFileServlet extends HttpServlet {
theResponse.addHeader(Constants.HEADER_CONTENT_ENCODING, Constants.ENCODING_GZIP); theResponse.addHeader(Constants.HEADER_CONTENT_ENCODING, Constants.ENCODING_GZIP);
} }
try (Reader reader = new InputStreamReader(supplier.get())) { if (ourLog.isDebugEnabled()) {
String string = IOUtils.toString(reader); try (Reader reader = new InputStreamReader(supplier.get())) {
ourLog.info(string); String string = IOUtils.toString(reader);
ourLog.debug("file content: {}", string);
}
} }
try (InputStream reader = supplier.get()) { try (InputStream reader = supplier.get()) {