jenkinsci / jenkinsci/credentials-binding-plugin

[JENKINS-52713] Broken output when secret text starts with whitespace

Open
#459 1 comment 0 reactions 0 assignees View on GitHub
component:credentials-binding-plugin imported-jira-issue priority:minor resolution:unresolved
Dominant language
Java
Stars
57
Forks
108
PR merge metrics
No merged PRs in 30d

Description

I found credentials-binding-plugin prints raw text when use secret text start with whitespace (like " secret") .

Here is my sample pipeline script:

 

node {

withCredentials([string(credentialsId: 'SAMPLE_CREDENTIAL', variable: 'SAMPLE_CREDENTIAL')]) {
sh 'echo $SAMPLE_CREDENTIAL'
}
}

All output:

Started by user user

Running in Durability level: MAX_SURVIVABILITY

[Pipeline] node

Running on Jenkins in /var/jenkins_home/workspace/print_credential_pipeline

[Pipeline] {

[Pipeline] withCredentials

[Pipeline] {

[Pipeline] sh

[print_credential_pipeline] Running shell script

+ echo****

credential test

{{[Pipeline] }}}

[Pipeline] // withCredentials

{{[Pipeline] }}}

[Pipeline] // node

[Pipeline] End of Pipeline

Finished: SUCCESS

---
Originally reported by mtgto, imported from: Broken output when secret text starts with whitespace


  • status: Open
  • priority: Minor
  • component(s): credentials-binding-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 2
  • imported: 20251211-141027

Raw content of original issue

I found credentials-binding-plugin prints raw text when use secret text start with whitespace (like " secret") .

Here is my sample pipeline script:

 



node {

withCredentials([string(credentialsId: 'SAMPLE_CREDENTIAL', variable: 'SAMPLE_CREDENTIAL')]) {
sh 'echo $SAMPLE_CREDENTIAL'
}
}


All output:

Started by user user
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] node
Running on Jenkins in /var/jenkins_home/workspace/print_credential_pipeline
[Pipeline] {
[Pipeline] withCredentials
[Pipeline] {
[Pipeline] sh
[print_credential_pipeline] Running shell script
+ echo****
credential test
{{[Pipeline] }}}
[Pipeline] // withCredentials
{{[Pipeline] }}}
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS

environment

```
Operating System: Host=macOS 10.13.6 Guest=jenkinsci/blueocean on Docker

Plugin: Credentials Binding Plugin v1.16
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.