Skip to content

Commit a87564a

Browse files
authored
Avoid dumping model and model sections in the logs (#561)
1 parent 0e44203 commit a87564a

File tree

5 files changed

+21
-9
lines changed

5 files changed

+21
-9
lines changed

core/src/main/java/oracle/weblogic/deploy/yaml/AbstractYamlTranslator.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2019, Oracle Corporation and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 2020, Oracle Corporation and/or its affiliates.
33
* Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44
*/
55
package oracle.weblogic.deploy.yaml;
@@ -199,7 +199,9 @@ protected PyDictionary parseInternal(String yamlFileName, InputStream yamlStream
199199
throw ye;
200200
}
201201
}
202-
getLogger().exiting(getClassName(), METHOD, fileDict);
202+
203+
// don't log the value on exit, it may be a password
204+
getLogger().exiting(getClassName(), METHOD);
203205
return fileDict;
204206
}
205207

@@ -274,7 +276,9 @@ private PyObject getScalarValue(String name, YamlParser.ValueContext valueContex
274276
} else {
275277
getLogger().severe("WLSDPLY-18006", name, valueClazz.getName());
276278
}
277-
getLogger().exiting(getClassName(), METHOD, value);
279+
280+
// don't log the value on exit, it may be a password
281+
getLogger().exiting(getClassName(), METHOD);
278282
return value;
279283
}
280284

core/src/main/java/oracle/weblogic/deploy/yaml/YamlTranslator.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2019, Oracle Corporation and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 2020, Oracle Corporation and/or its affiliates.
33
* Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44
*/
55
package oracle.weblogic.deploy.yaml;
@@ -64,7 +64,9 @@ public PyDictionary parse() throws YamlException {
6464
LOGGER.throwing(CLASS, METHOD, ex);
6565
throw ex;
6666
}
67-
LOGGER.exiting(CLASS, METHOD, result);
67+
68+
// don't log the model on exit, it may contain passwords
69+
LOGGER.exiting(CLASS, METHOD);
6870
return result;
6971
}
7072

core/src/main/python/wlsdeploy/json/json_translator.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ def parse(self):
5151
self._logger.entering(class_name=self._class_name, method_name=_method_name)
5252
# throws JsonException with details, nothing we can really add here...
5353
result_dict = self._translator.parse()
54-
self._logger.exiting(class_name=self._class_name, method_name=_method_name, result=result_dict)
54+
55+
# don't log the model on exit, it may contain passwords
56+
self._logger.exiting(class_name=self._class_name, method_name=_method_name)
5557
return result_dict
5658

5759

core/src/main/python/wlsdeploy/tool/validate/validator.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Copyright (c) 2017, 2020, Oracle Corporation and/or its affiliates. All rights reserved.
2+
Copyright (c) 2017, 2020, Oracle Corporation and/or its affiliates.
33
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44
"""
55
import os
@@ -32,6 +32,7 @@
3232

3333
from wlsdeploy.aliases.model_constants import DOMAIN_INFO
3434
from wlsdeploy.aliases.model_constants import KUBERNETES
35+
from wlsdeploy.aliases.model_constants import MASKED_PASSWORD
3536
from wlsdeploy.aliases.model_constants import MODEL_LIST_DELIMITER
3637
from wlsdeploy.aliases.model_constants import NAME
3738
from wlsdeploy.aliases.model_constants import SERVER_GROUP_TARGETING_LIMITS
@@ -390,7 +391,8 @@ def __validate_model_section(self, model_section_key, model_dict, valid_section_
390391
if variables.has_variables(section_dict_key):
391392
self._report_unsupported_variable_usage(section_dict_key, model_folder_path)
392393

393-
self._logger.finer('WLSDPLY-05011', section_dict_key, section_dict_value,
394+
# don't log section_dict_value here, it may be a password or dict with password
395+
self._logger.finer('WLSDPLY-05011', section_dict_key, MASKED_PASSWORD,
394396
class_name=_class_name, method_name=_method_name)
395397

396398
if section_dict_key in valid_attr_infos:

core/src/main/python/wlsdeploy/yaml/yaml_translator.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ def parse(self):
5353
self._logger.entering(class_name=self._class_name, method_name=_method_name)
5454
# throws YamlException with details, nothing we can really add here...
5555
result_dict = self._translator.parse()
56-
self._logger.exiting(class_name=self._class_name, method_name=_method_name, result=result_dict)
56+
57+
# don't log the model on exit, it may contain passwords
58+
self._logger.exiting(class_name=self._class_name, method_name=_method_name)
5759
return result_dict
5860

5961

0 commit comments

Comments
 (0)