Shared Jenkins library which all ODS projects & components use - provisioning, SonarQube code scanning, Nexus publishing, OpenShift template based deployments and repository orchestration
Apache License 2.0
75
stars
57
forks
source link
Bitbucket user token creation fails when colon is present #813
Describe the bug
Bitbucket user token request (curl) fails when the password includes some special characters.
Guessing the : (colon) is a problem since it is used to separated username and password, meaning it needs to be escaped, but all special character could be URL encoded to be sure.
To Reproduce
Steps to reproduce the behavior:
Run any component pipeline with cd-user credentials which include some special characters.
For instance:
• qdGk2wqIrHeJueC]czq9~J:5I%DT!8 (Initial password and not working)
• wXt6Azz{h:.Yt@2U@Mj>GUN^7Q:9';Av (Not working)
Expected behavior
The request should succeed.
Screenshots
If applicable, add screenshots to help explain your problem.
Affected version (please complete the following information):
OpenDevStack 4.x
Log Output (ensure to remove any confidential information like tokens, project names, etc.
Running on pod-d7dc8b69-b60b-411d-a01c-6f9b68d486ca-dx626-k68c6 in /tmp/workspace/mlops-cd/mlops-cd-pipeline-master
[Pipeline] {
[Pipeline] withCredentials
[Pipeline] // withCredentials
[Pipeline] echo
Secret cd-user-bitbucket-token does not exist yet, it will be created now.
[Pipeline] withCredentials
Masking supported pattern matches of $USERNAME or $PASSWORD
[Pipeline] {
[Pipeline] echo
Requesting token via PUT https://bitbucket.biscrum.com/rest/access-tokens/1.0/users/x2odsmlops_boehringer-ingelheim.com with payload={"name": "ods-jenkins-shared-library-mlops-cd", "permissions": ["PROJECT_WRITE", "REPO_WRITE"]}
[Pipeline] sh
+ set +x
curl: (22) The requested URL returned error: 401
[Pipeline] }
[Pipeline] // withCredentials
[Pipeline] stage
[Pipeline] { (odsPipeline error)
[Pipeline] echo
WARN: [pipeline] ***** Finished ODS Pipeline for pipeline (with error) ***** (took 40041 ms)
Describe the bug Bitbucket user token request (curl) fails when the password includes some special characters.
Guessing the : (colon) is a problem since it is used to separated username and password, meaning it needs to be escaped, but all special character could be URL encoded to be sure.
See https://github.com/opendevstack/ods-jenkins-shared-library/blob/2df7e4be97180bd4186b7294c1f59a339ef0e65e/src/org/ods/services/BitbucketService.groovy#L456
To Reproduce Steps to reproduce the behavior: Run any component pipeline with cd-user credentials which include some special characters.
For instance: • qdGk2wqIrHeJueC]czq9~J:5I%DT!8 (Initial password and not working) • wXt6Azz{h:.Yt@2U@Mj>GUN^7Q:9';Av (Not working)
Expected behavior The request should succeed.
Screenshots If applicable, add screenshots to help explain your problem.
Affected version (please complete the following information):
Log Output (ensure to remove any confidential information like tokens, project names, etc.