[JIRA] (JENKINS-58664) Add pipeline function to obscure credentials inFile

2 views
Skip to first unread message

citizenkahn@java.net (JIRA)

unread,
Jul 25, 2019, 2:23:02 PM7/25/19
to jenkinsc...@googlegroups.com
citizenkahn created an issue
 
Jenkins / New Feature JENKINS-58664
Add pipeline function to obscure credentials inFile
Issue Type: New Feature New Feature
Assignee: Unassigned
Components: credentials-binding-plugin
Created: 2019-07-25 18:22
Priority: Minor Minor
Reporter: citizenkahn

Problem

The plugin hides secrets from the jenkins console but when a using complex tool chain the secrets may be stored in some tool's log and later published as build output. 

For example: the following uses ansible and a junit output callback to generate junit xml which will include secrets.

withCredentials([usernamePassword(credentialsId: 'my-test-user',
            passwordVariable: 'USER',
            usernameVariable: 'PASSWORD')]) {
        withEnv([
                "ANSIBLE_STDOUT_CALLBACK=junit",
                "JUNIT_OUTPUT_DIR=${env.WORKSPACE}"
        ]) {
                try {
                      ansiblePlaybook(
                        playbook:"ansible/playbooks/steps.yml",
                        extraVars: [
                                user: USER,
                                password: PASSWORD
                                ]
                      )
                } finally {
                    junit 'steps.*xml'
                }           
        }
} 

Recommendation

Whereas

  • It seem unreasonable/impossible for the plugin to understand all tool chains
  • Only the binding plugin can properly know all secrets to hide

The addition of an exposed function like obscureCredentialsInFile(file: 'mylog.xml') would allow the pipeline author to use the file cleaner to remove secrets from a file or perhaps with a glob a series of files.

The method would perform the standard replacement in the file as it would do on the console regardless of the impact to the file.  For example, if the secret was 'error' and that was an xml key, the cleanup would be for the pipeline author to handle.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)
Reply all
Reply to author
Forward
0 new messages