Skip to content

Commit

Permalink
Do not display client environment unless specifically asked for
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Nov 25, 2024
1 parent 0951c2f commit a503cb2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
3 changes: 1 addition & 2 deletions common/src/main/java/org/mvndaemon/mvnd/common/Message.java
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,7 @@ public String toString() {
return "BuildRequest{" + "args="
+ args + ", workingDir='"
+ workingDir + '\'' + ", projectDir='"
+ projectDir + '\'' + ", env='"
+ env + '\'' + '}';
+ projectDir + '\'' + '}';
}

@Override
Expand Down
12 changes: 9 additions & 3 deletions daemon/src/main/java/org/mvndaemon/mvnd/daemon/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,15 @@ private void client(SocketChannel socket) {
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);
Expand Down

0 comments on commit a503cb2

Please sign in to comment.