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-73951][JENKINS-73952] Improve CSP compatibility #321

Merged
merged 4 commits into from
Oct 17, 2024

Conversation

yaroslavafenkin
Copy link
Contributor

https://issues.jenkins.io/browse/JENKINS-73951
https://issues.jenkins.io/browse/JENKINS-73952

Testing done

For JENKINS-73951 I needed to go to the enterCredential page that's referenced from url field help file. And then to get to the credentialOK I commented out these lines locally:

repository.testConnection();
authManager.checkIfProtocolCompleted();

https://www.loom.com/share/4b2e8bfe5ab147e8b05584dded1343f1

https://www.loom.com/share/94b12cc934c8439f879bf5c8cc6709eb

CSP violations that appear in the list in the end are addressed by #319.


For JENKINS-73952 had to setup a project with 2 module locations, so that at least 2 entries appear on the tagBuild page which allows affected elements to be rendered. The functionality in the related script was broken due to jQuery not being available, so I've fixed that along the way.

https://www.loom.com/share/2b96f17fe29340ec8d536ebedbd9517e

https://www.loom.com/share/58b6fdaae7384c86bf9dd64b0ebe93f0

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

yaroslavafenkin added a commit to yaroslavafenkin/acceptance-test-harness that referenced this pull request Oct 17, 2024
yaroslavafenkin added a commit to yaroslavafenkin/bom that referenced this pull request Oct 17, 2024
Copy link
Member

@basil basil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing looks good. Left some optional feedback for your consideration. Feel free to disregard if these suggestions aren't helping.

@@ -0,0 +1,3 @@
window.addEventListener("DOMContentLoaded", () => {
document.querySelector(".svn-credential-ok-close").addEventListener("click", () => window.close());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Elsewhere in your changes, you've been putting one-line lambdas into their own block. I don't care either way, as long as we're consistent within the same file.

Suggested change
document.querySelector(".svn-credential-ok-close").addEventListener("click", () => window.close());
document.querySelector(".svn-credential-ok-close").addEventListener("click", () => {
window.close();
});

}

window.addEventListener("DOMContentLoaded", () => {
document.querySelectorAll(".svn-tagform-tag-checkbox").forEach(checkbox => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Elsewhere in Jenkins core and in other CSP PRs we're putting parameters in parentheses consistently, so please do so here as well:

Suggested change
document.querySelectorAll(".svn-tagform-tag-checkbox").forEach(checkbox => {
document.querySelectorAll(".svn-tagform-tag-checkbox").forEach((checkbox) => {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I'll try to be more consistent with it.


window.addEventListener("DOMContentLoaded", () => {
document.querySelectorAll(".svn-tagform-tag-checkbox").forEach(checkbox => {
document.addEventListener("change", updateRow);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems odd to me that we aren't using checkbox. If it's truly unused, maybe we should use () instead on the previous line? Or if we should use it, should this line be:

Suggested change
document.addEventListener("change", updateRow);
checkbox.addEventListener("change", updateRow);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, it's an oversight from my side. I'm unsure how this even worked for the sake of the video :/

Copy link
Member

@basil basil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

@basil basil added the internal label Oct 17, 2024
@basil basil merged commit b8220b2 into jenkinsci:master Oct 17, 2024
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants