-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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-21052] Warn user that the copy button requires HTTPS #7665
[JENKINS-21052] Warn user that the copy button requires HTTPS #7665
Conversation
Users that run Jenkins over an unencrypted (HTTP) connection will see the copy button, but it does not perform a copy. Browsers will only allow access to the clipboard if the page is in a secure context. With this change, the text that is displayed when the user clicks the copy button from an insecure context will alert the user that copy requires a secure connection. https://stackoverflow.com/questions/400212/how-do-i-copy-to-the-clipboard-in-javascript describes the alternatives in more detail. https://issues.jenkins.io/browse/JENKINS-21052 reported that the copy button does not work. I've confirmed that it works when using an HTTPS connection.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
likely doesn't affect much in the wild but may as well 👍, likely affects Jesse because he uses a non localhost url to avoid cookie clashes.
/label ready-for-merge This PR is now ready for merge. We will merge it after ~24 hours if there is no negative feedback. |
Caused JENKINS-70895 - some plugin automated tests fail because HTMLUnit does not recognize |
https://issues.jenkins.io/browse/JENKINS-70895 reports that `isSecureContext` is not recognized by HTMLUnit in its JavaScript handling. That breaks tests for some plugins that use HTMLUnit to test configuration round trips. jenkinsci#7665 introduced this change to notify users running over HTTP connections (insecure) that the copy button does not work over insecure connections. https://issues.jenkins.io/browse/JENKINS-21052 was the original motivation for that informational message to the user. James Nord tested this change in the automated test that was failing with Jenkins 2.397 and confirmed that the test passes with this change. I tested interactively over HTTP and confirmed that the copy button on the inbound agent page still reports that copy is not supported over an insecure session. I tested interactively over HTTPS and confirmed that the copy button on the inbound agent page still correctly copies the expected content. I spent several unsuccessful hours trying to create an automated test to show the failure. I think we should include this fix without an automated test because the automated tests in the plugin that James maintains will detect the issue.
https://issues.jenkins.io/browse/JENKINS-70895 reports that `isSecureContext` is not recognized by HTMLUnit in its JavaScript handling. That breaks tests for some plugins that use HTMLUnit to test configuration round trips. #7665 introduced this change to notify users running over HTTP connections (insecure) that the copy button does not work over insecure connections. https://issues.jenkins.io/browse/JENKINS-21052 was the original motivation for that informational message to the user. James Nord tested this change in the automated test that was failing with Jenkins 2.397 and confirmed that the test passes with this change. I tested interactively over HTTP and confirmed that the copy button on the inbound agent page still reports that copy is not supported over an insecure session. I tested interactively over HTTPS and confirmed that the copy button on the inbound agent page still correctly copies the expected content. I spent several unsuccessful hours trying to create an automated test to show the failure. I think we should include this fix without an automated test because the automated tests in the plugin that James maintains will detect the issue.
JENKINS-21052 Warn user that copy button requires HTTPS
Users that run Jenkins over an unencrypted (HTTP) connection will see the copy button, but it does not perform a copy. Browsers will only allow access to the clipboard if the page is in a secure context.
With this change, the text that is displayed when the user clicks the copy button from an insecure context will alert the user that copy requires a secure connection.
https://stackoverflow.com/questions/400212/how-do-i-copy-to-the-clipboard-in-javascript describes the alternatives in more detail.
JENKINS-21052 reported that the copy button does not work. I've confirmed that it works when using an HTTPS connection.
Testing done
Insecure context
Secure context
No automated test because configuring an automated test in a secure context seems very complicated.
Proposed changelog entries
Proposed upgrade guidelines
N/A
Submitter checklist
@Restricted
or have@since TODO
Javadocs, as appropriate.@Deprecated(since = "TODO")
or@Deprecated(forRemoval = true, since = "TODO")
, if applicable.eval
to ease future introduction of Content Security Policy (CSP) directives (see documentation).Desired reviewers
Use a space suppressing diff to clearly see the added conditional for contexts that are not secure.
Maintainer checklist
Before the changes are marked as
ready-for-merge
:upgrade-guide-needed
label is set and there is a Proposed upgrade guidelines section in the pull request title (see example).lts-candidate
to be considered (see query).