From 4770915ba2a50991138df0ccd99f63214e22d3b1 Mon Sep 17 00:00:00 2001 From: Ryan Montgomery Date: Fri, 19 Aug 2022 15:28:40 -0400 Subject: [PATCH 1/3] Add x-forwarded-for to logs --- pom.xml | 4 ++-- .../java/com/capitalone/dashboard/logging/LoggingFilter.java | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 17eb1677..43b0e6fd 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ api jar ${project.groupId}:${project.artifactId} - 3.4.46 + 3.4.47 Hygieia Rest API Layer https://github.com/Hygieia/api @@ -59,7 +59,7 @@ - 3.15.43 + 3.15.44 4.2.18.RELEASE 8.5.70 1.9.4 diff --git a/src/main/java/com/capitalone/dashboard/logging/LoggingFilter.java b/src/main/java/com/capitalone/dashboard/logging/LoggingFilter.java index 0a7a299b..edfe5ce7 100644 --- a/src/main/java/com/capitalone/dashboard/logging/LoggingFilter.java +++ b/src/main/java/com/capitalone/dashboard/logging/LoggingFilter.java @@ -61,6 +61,8 @@ public class LoggingFilter implements Filter { private static final String API_USER_KEY = "apiUser"; + private static final String X_FORWARDED_FOR = "x-forwarded-for"; + private static final String UNKNOWN_USER = "unknown"; @@ -98,6 +100,8 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha try { requestLog.setClient(httpServletRequest.getRemoteAddr()); + String x_forwarded_for = bufferedRequest.getHeader(X_FORWARDED_FOR) + requestLog.setXForwardedFor(x_forwarded_for); requestLog.setEndpoint(httpServletRequest.getRequestURI()); requestLog.setMethod(httpServletRequest.getMethod()); requestLog.setParameter(requestMap.toString()); From 17993492d240049f0a5ec3dd930615fdce4c1ca0 Mon Sep 17 00:00:00 2001 From: Ryan Montgomery Date: Mon, 22 Aug 2022 09:37:54 -0400 Subject: [PATCH 2/3] Updated ubuntu --- .github/workflows/maven-pr-checks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maven-pr-checks.yml b/.github/workflows/maven-pr-checks.yml index 61560d10..a6b0f4a7 100755 --- a/.github/workflows/maven-pr-checks.yml +++ b/.github/workflows/maven-pr-checks.yml @@ -6,7 +6,7 @@ on: - master jobs: build: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 From a910068d56c75129015ad44a9b7875913d913dd6 Mon Sep 17 00:00:00 2001 From: Ryan Montgomery Date: Mon, 22 Aug 2022 11:49:34 -0400 Subject: [PATCH 3/3] Fix typo in logging filter --- .../java/com/capitalone/dashboard/logging/LoggingFilter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/capitalone/dashboard/logging/LoggingFilter.java b/src/main/java/com/capitalone/dashboard/logging/LoggingFilter.java index edfe5ce7..0e52fbc4 100644 --- a/src/main/java/com/capitalone/dashboard/logging/LoggingFilter.java +++ b/src/main/java/com/capitalone/dashboard/logging/LoggingFilter.java @@ -100,7 +100,7 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha try { requestLog.setClient(httpServletRequest.getRemoteAddr()); - String x_forwarded_for = bufferedRequest.getHeader(X_FORWARDED_FOR) + String x_forwarded_for = bufferedRequest.getHeader(X_FORWARDED_FOR); requestLog.setXForwardedFor(x_forwarded_for); requestLog.setEndpoint(httpServletRequest.getRequestURI()); requestLog.setMethod(httpServletRequest.getMethod());