log/appv2: don't dump all settings in log metadata

This commit is contained in:
Alexandre Aubin 2023-02-02 22:54:39 +01:00
parent e7d5d3942e
commit a9ac55e4a5

View file

@ -16,6 +16,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import copy
import os
import re
import yaml
@ -594,6 +595,14 @@ class OperationLogger:
Write or rewrite the metadata file with all metadata known
"""
metadata = copy.copy(self.metadata)
# Remove lower-case keys ... this is because with the new v2 app packaging,
# all settings are included in the env but we probably don't want to dump all of these
# which may contain various secret/private data ...
if "env" in metadata:
metadata["env"] = {k: v for k, v in metadata["env"].items() if k == k.upper()}
dump = yaml.safe_dump(self.metadata, default_flow_style=False)
for data in self.data_to_redact:
# N.B. : we need quotes here, otherwise yaml isn't happy about loading the yml later