Skip to content

Commit 5dec98b

Browse files
authored
fix: do not expose operator private key in logs or error messages (#59)
* fix: do not include operator private key in config error message `parsePrivateKey` interpolated the raw key string into the `IllegalArgumentException` message. That message is printed by Spring's startup failure banner and ends up in container, CI and aggregated logs. Drop the value from the message; keep the original cause for diagnostics. Signed-off-by: Alejandro <26930485+alejandroGM0@users.noreply.github.com> * fix: redact operator private key in TestConfigSource log output `TestConfigSource` iterated all properties and logged them at INFO, including `hiero.privateKey`. The dotenv passthrough above already filters the key out as sensitive, so the log statement contradicted that intent and exposed the value on every test run (including in CI logs). Redact the value when the key is `hiero.privateKey`. Signed-off-by: Alejandro <26930485+alejandroGM0@users.noreply.github.com> --------- Signed-off-by: Alejandro <26930485+alejandroGM0@users.noreply.github.com>
1 parent 878109a commit 5dec98b

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

hiero-enterprise-microprofile/src/test/java/org/hiero/microprofile/test/TestConfigSource.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ public TestConfigSource() {
4848
.filter(e -> !e.getKey().equals("hiero.network.name"))
4949
.forEach(e -> properties.put(e.getKey(), e.getValue()));
5050

51-
properties.forEach((k, v) -> log.info("CONFIG: '" + k + "'->'" + v + "'"));
51+
properties.forEach(
52+
(k, v) ->
53+
log.info("CONFIG: '" + k + "'->'" + ("hiero.privateKey".equals(k) ? "***" : v) + "'"));
5254
}
5355

5456
@Override

hiero-enterprise-spring/src/main/java/org/hiero/spring/implementation/HieroConfigImpl.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@ private static PrivateKey parsePrivateKey(final String privateKey) {
9191
try {
9292
return PrivateKey.fromString(privateKey);
9393
} catch (Exception e) {
94-
throw new IllegalArgumentException(
95-
"Can not parse 'privateKey' property: '" + privateKey + "'", e);
94+
throw new IllegalArgumentException("Can not parse 'privateKey' property", e);
9695
}
9796
}
9897

0 commit comments

Comments
 (0)