Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.binding.haywardomnilogiclocal.internal.HaywardBindingConstants;
Expand Down Expand Up @@ -121,6 +122,14 @@ public void handleCommand(ChannelUID channelUID, Command command) {
if (bridge != null && bridge.getHandler() instanceof HaywardBridgeHandler bridgehandler) {
String cmdString = this.cmdToString(command);
String cmdURL = null;
String token = bridgehandler.getAccount().getToken();

if (poolID == null || systemID == null || token == null) {
logger.warn("haywardCommand missing configuration (poolID={}, systemID={}, token={})", poolID,
systemID, token);
Comment on lines +127 to +129

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Stop logging authentication token

The warning emitted when any of poolID, systemID, or token is null logs the raw token value even when only one of the other fields is missing. The token is an account credential and this statement now leaks it at WARN level whenever misconfiguration occurs. Consider omitting the token entirely or masking it so that secret material is never written to logs.

Useful? React with 👍 / 👎.

return;
}

int mspId = Integer.parseInt(bridgehandler.getAccount().getMspSystemID());

if (command == OnOffType.ON) {
Expand All @@ -133,7 +142,8 @@ public void handleCommand(ChannelUID channelUID, Command command) {
switch (channelUID.getId()) {
case HaywardBindingConstants.CHANNEL_VIRTUALHEATER_ENABLE:
cmdURL = CommandBuilder.buildSetHeaterEnable(HaywardBindingConstants.COMMAND_PARAMETERS,
bridgehandler.getAccount().getToken(), mspId, poolID, systemID, cmdString);
Objects.requireNonNull(token), mspId, Objects.requireNonNull(poolID),
Objects.requireNonNull(systemID), cmdString);
break;

case HaywardBindingConstants.CHANNEL_VIRTUALHEATER_CURRENTSETPOINT:
Expand All @@ -146,7 +156,8 @@ public void handleCommand(ChannelUID channelUID, Command command) {
}

cmdURL = CommandBuilder.buildSetUIHeaterCmd(HaywardBindingConstants.COMMAND_PARAMETERS,
bridgehandler.getAccount().getToken(), mspId, poolID, systemID, cmdString);
Objects.requireNonNull(token), mspId, Objects.requireNonNull(poolID),
Objects.requireNonNull(systemID), cmdString);
break;
default:
logger.warn("haywardCommand Unsupported type {}", channelUID);
Expand Down