Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JENKINS-60316] Fix escaping single quotes in Unix file paths #486

Merged
merged 2 commits into from
Jan 18, 2020

Conversation

darxriggs
Copy link
Contributor

@darxriggs darxriggs commented Dec 29, 2019

JENKINS-60316

Points addressed

  • a single quote is not allowed between single quotes, even if escaped
  • a backslash requires escaping if to be used literally in a reqular expression

This escaping has previously already been used in quoteUnixCredentials which was added in commit 62872bc - see here.

Also see https://www.gnu.org/software/bash/manual/html_node/Single-Quotes.html.

I tested it manually on Linux, with a SSH key and a username/password credential, with a job inside a folder that contains spaces and single quotes.

There is no test infrastructure available yet to test such things automatically - right?

Points addressed
- a single quote is not allowed between single quotes, even if escaped
- a backslash requires escaping if to be used literally in a reqular expression

This escaping has previously already been used in `quoteUnixCredentials`
which was added in commit 62872bc.

Also see https://www.gnu.org/software/bash/manual/html_node/Single-Quotes.html
There is no need to
- use regular expressions
- flush the file writer
@darxriggs
Copy link
Contributor Author

@MarkEWaite do you want to consider this for the next release?

@MarkEWaite
Copy link
Contributor

@darxriggs I made a first attempt to duplicate the problem from a Jenkins installation last week before I released 3.1.0-beta. I was unable to duplicate the problem.

Since I could not duplicate the problem, I was unwilling to include a fix that I could not confirm actually fixed the issue.

This fix will need to wait for a release of git client plugin after 3.1.0.

I would love to have an automated test that shows the problem or an acceptance test on a branch in my jenkins-bugs repository or an acceptance test in my docker-lfs repository.

@darxriggs
Copy link
Contributor Author

darxriggs commented Jan 7, 2020

I tested it manually on Linux, with a SSH key and a username/password credential, with a job inside a folder that contains spaces and single quotes.

@MarkEWaite This info was not helpful to reproduce it? I could reproduce it that way.

@MarkEWaite MarkEWaite merged commit 47857f2 into jenkinsci:master Jan 18, 2020
@darxriggs darxriggs deleted the fix-filepath-quoting branch January 18, 2020 18:28
@darxriggs
Copy link
Contributor Author

I put the automated test on my todo list. I am just not sure when I will have a look at it.

@MarkEWaite
Copy link
Contributor

MarkEWaite commented Jan 18, 2020

On my TODO list as well and definitely not sure when I will have time to look at it. The interactive testing exercise exposed configuration errors in my CI setup. Thanks for fixing the bug and for the positive impact that had on my ability to reliably test credentials issues in my environment.

@MarkEWaite MarkEWaite added bug Incorrect or flawed behavior and removed bugfix labels Nov 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Incorrect or flawed behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants