为什么 Jenkins 突然抱怨插值不安全

问题描述 投票:0回答:1

上周末我们更新了 Jenkins 实例 (2.249.3),现在管道中的每个构建都会发出很多警告:

“已检测到的以下步骤可能存在敏感变量的不安全插值”。

我们使用Jenkinsfile来配置管道步骤,有很多属性参数,其中有2个密码类型字段。所有警告都表明这 2 个密码类型字段被传递给 echo 或 sh 命令。但这似乎不是真的。

创建 2 个密码类型参数后,日志中会显示第一个警告。此后,每个使用字符串插值的 echo 或 sh 命令都会在日志中抛出有关这两个字段的警告,即使该命令中未使用这些特定字段:

[2020-11-20T10:24:44.032Z] [Pipeline] properties
[2020-11-20T10:24:44.037Z] Warning: A secret was passed to "properties" using Groovy String interpolation, which is insecure.
[2020-11-20T10:24:44.037Z]       Affected argument(s) used the following variable(s): [PASSWORD_PROD, PASSWORD]
[2020-11-20T10:24:44.037Z]       See https://jenkins.io/redirect/groovy-string-interpolation for details.


[2020-11-20T10:24:46.435Z] [Pipeline] echo
[2020-11-20T10:24:46.436Z] Warning: A secret was passed to "echo" using Groovy String interpolation, which is insecure.
[2020-11-20T10:24:46.436Z]       Affected argument(s) used the following variable(s): [PASSWORD_PROD, PASSWORD]
[2020-11-20T10:24:46.436Z]       See https://jenkins.io/redirect/groovy-string-interpolation for details.

最后一个警告是由此回声触发的:

echo "${COLOR_INFO}[INFO] ${messageText}${COLOR_END}"

这 2 个密码字段不用于字符串插值。其他参数是,但我们不介意在日志中显示这些参数。

这是上次更新中的某种错误吗?还是我们确实做错了什么?

jenkins groovy interpolation
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.