This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch mvnd-1.x
in repository https://gitbox.apache.org/repos/asf/maven-mvnd.git

commit a8d90d5dcbc2abcabcc91b2ddac304cd83e49458
Author: Guillaume Nodet <gno...@gmail.com>
AuthorDate: Fri Nov 22 17:58:39 2024 +0100

    Do not display client environment unless specifically asked for
---
 common/src/main/java/org/mvndaemon/mvnd/common/Message.java |  3 +--
 daemon/src/main/java/org/mvndaemon/mvnd/daemon/Server.java  | 11 +++++++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/common/src/main/java/org/mvndaemon/mvnd/common/Message.java 
b/common/src/main/java/org/mvndaemon/mvnd/common/Message.java
index 8b4897bf..9c15c2af 100644
--- a/common/src/main/java/org/mvndaemon/mvnd/common/Message.java
+++ b/common/src/main/java/org/mvndaemon/mvnd/common/Message.java
@@ -367,8 +367,7 @@ public abstract class Message {
             return "BuildRequest{" + "args="
                     + args + ", workingDir='"
                     + workingDir + '\'' + ", projectDir='"
-                    + projectDir + '\'' + ", env='"
-                    + env + '\'' + '}';
+                    + projectDir + '\'' + '}';
         }
 
         @Override
diff --git a/daemon/src/main/java/org/mvndaemon/mvnd/daemon/Server.java 
b/daemon/src/main/java/org/mvndaemon/mvnd/daemon/Server.java
index 9d95876b..89a96152 100644
--- a/daemon/src/main/java/org/mvndaemon/mvnd/daemon/Server.java
+++ b/daemon/src/main/java/org/mvndaemon/mvnd/daemon/Server.java
@@ -283,9 +283,16 @@ public class Server implements AutoCloseable, Runnable {
                 updateState(DaemonState.Idle);
                 return;
             }
-            LOGGER.info("Request received: {}", message);
             if (message instanceof BuildRequest) {
-                handle(connection, (BuildRequest) message);
+                BuildRequest buildRequest = (BuildRequest) message;
+                LOGGER.info("Request received: {}", message);
+                if (Boolean.getBoolean("mvnd.dump.client.env")) {
+                    // Environment can contain passwords or tokens, so do not 
dump, unless specifically asked for
+                    LOGGER.trace("Client environment dump: {}", 
buildRequest.getEnv());
+                }
+                handle(connection, buildRequest);
+            } else {
+                LOGGER.info("Ignoring message: {}", message);
             }
         } catch (Throwable t) {
             LOGGER.error("Error reading request", t);

Reply via email to