1 Star 0 Fork 27

桐小哥/cloud-init

forked from src-openEuler/cloud-init 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-fix-Logging-sensitive-data.patch 1.73 KB
一键复制 编辑 原始数据 按行查看 历史
桐小哥 提交于 2024-04-12 15:48 . fix: Logging sensitive data
From 2f9812e805f8e66feaf2689384ea6d669305d9a5 Mon Sep 17 00:00:00 2001
From: Brett Holman <brett.holman@canonical.com>
Date: Wed, 3 Apr 2024 13:51:25 -0600
Subject: [PATCH] fix: Logging sensitive data
Don't log sensitive data.
Since /var/log/cloud-init.log is a priviledged file, this does not expose a
secure system (no CVE). However, we don't want to log this information so that
users can file reports without having to manually redact logs.
Standardize log messages so that redacted and non-redacted logs match.
Reference:https://github.com/canonical/cloud-init/commit/2f9812e8
---
cloudinit/subp.py | 24 +++++++++---------------
1 file changed, 9 insertions(+), 15 deletions(-)
diff --git a/cloudinit/subp.py b/cloudinit/subp.py
index 85a970f..9347f4f 100644
--- a/cloudinit/subp.py
+++ b/cloudinit/subp.py
@@ -229,21 +229,15 @@ def subp(
if status_cb:
command = " ".join(args) if isinstance(args, list) else args
status_cb("Begin run command: {command}\n".format(command=command))
- if not logstring:
- LOG.debug(
- "Running command %s with allowed return codes %s"
- " (shell=%s, capture=%s)",
- args,
- rcs,
- shell,
- "combine" if combine_capture else capture,
- )
- else:
- LOG.debug(
- "Running hidden command to protect sensitive "
- "input/output logstring: %s",
- logstring,
- )
+
+ LOG.debug(
+ "Running command %s with allowed return codes %s"
+ " (shell=%s, capture=%s)",
+ logstring if logstring else args,
+ rcs,
+ shell,
+ "combine" if combine_capture else capture,
+ )
stdin: Union[TextIOWrapper, int]
stdout = None
--
2.27.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/tong_1001/cloud-init.git
git@gitee.com:tong_1001/cloud-init.git
tong_1001
cloud-init
cloud-init
master

搜索帮助