[JENKINS-56674] Mask environment variable if they passed in case of inside docker image run#166
Conversation
…nside docker image run
875e3f0 to
67b802f
Compare
|
You shouldn't hardcode passwords in your Jenkinsfile or anywhere in your repositories. Values in environment variables that are also provided by the credentials API will be masked in console output when Unless my understanding of how credentials and console output work together is flawed, this wouldn't be a risk for anyone that is retrieving credentials via appropriate channels. |
|
Yes we should not, case which I've shown in test it's just a test, environment variable can be field from any source(vault, file, DB, credentials api or something else) and passed to process by env... In the same way all environment variable in the end of command masked, but at the beginning not. The case which I've try to described appeared only in case of recursive call of which is covered by logic of this step, but not masked env variables... Try to look at the code and I hope you will understand what I mean.... @conn |
@conn not a true, since you can get credentials from any source and it will not logged in plain text but in case if it filled as env and passed to inContainer it will logged in the |
| " withDockerContainer(image:'docker',\n" + | ||
| " args:'-v /var/run/docker.sock:/var/run/docker.sock --user root') {\n" + | ||
| " env.TEST_PWD = 'pwd12345'\n" + | ||
| " withDockerContainer(image:'docker',\n" + |
There was a problem hiding this comment.
This is not a plausible test case. I am working on a clearer one.
Resolves https://issues.jenkins-ci.org/browse/JENKINS-56674
I would like to propose and show which issue exists with masked env variables during such case
So the output of job will have include env variable which can contains sensitive data (first part of docker exec):
As you can see second docker run (which is wrapped by docker exec logged all env variables) which is not security