Skip to content

Commit

Permalink
[Fix] Fixed secrets showing up on JSON of agent
Browse files Browse the repository at this point in the history
  • Loading branch information
eitch committed Jul 28, 2023
1 parent efbd624 commit 2a51a5b
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,12 @@ public JsonObject toJson() {
for (String key : this.configurationValues.keySet()) {
JsonObject propertyJ = new JsonObject();
propertyJ.addProperty(Tags.Json.KEY, key);
propertyJ.addProperty(Tags.Json.VALUE, this.configurationValues.get(key));

if (this.valueTypes.containsKey(key) && this.valueTypes.get(key).equals(SECRET))
propertyJ.addProperty(Tags.Json.VALUE, "***");
else
propertyJ.addProperty(Tags.Json.VALUE, this.configurationValues.get(key));

propertyJ.addProperty(Tags.Json.UNUSED, true);
propertiesMap.put(key, propertyJ);
}
Expand All @@ -263,10 +268,7 @@ public JsonObject toJson() {

propertyJ.addProperty(Tags.Json.UNUSED, false);
propertyJ.addProperty(Tags.Json.DEFAULT_VALUE, this.defaultValues.get(key));
String type = this.valueTypes.get(key);
if (type.equals(SECRET))
propertyJ.addProperty(Tags.Json.VALUE, "***");
propertyJ.addProperty(Tags.Json.TYPE, type);
propertyJ.addProperty(Tags.Json.TYPE, this.valueTypes.get(key));
}

JsonArray propertiesJ = propertiesMap.values().stream()
Expand Down

0 comments on commit 2a51a5b

Please sign in to comment.