This is an automated email from the ASF dual-hosted git repository. gnodet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-mvnd.git
commit 9f0537a681e735a95ec7324d4ffb447ab7f69ec9 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 | 12 +++++++++--- 2 files changed, 10 insertions(+), 5 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 89af9b75..d6ebc268 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 b8e00634..a8bcc956 100644 --- a/daemon/src/main/java/org/mvndaemon/mvnd/daemon/Server.java +++ b/daemon/src/main/java/org/mvndaemon/mvnd/daemon/Server.java @@ -287,9 +287,15 @@ public class Server implements AutoCloseable, Runnable { updateState(DaemonState.Idle); return; } - LOGGER.info("Request received: {}", message); - if (message instanceof BuildRequest) { - handle(connection, (BuildRequest) message); + if (message instanceof BuildRequest buildRequest) { + 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);