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-66729] Un-inlining UsageStatistics/footer.jelly (CSP issue) #Hacktoberfest #5787

Merged
merged 5 commits into from
Oct 20, 2021
Merged

Conversation

abhijeet007rocks8
Copy link
Contributor

@abhijeet007rocks8 abhijeet007rocks8 commented Oct 5, 2021

See JENKINS-66729.
Script Tag for UsageStatistics/footer.jelly moved to separate file for CSP reasons.

Submitter checklist

  • (If applicable) Jira issue is well described
  • Changelog entries and upgrade guidelines are appropriate for the audience affected by the change (users or developer, depending on the change). Examples
    • Fill-in the Proposed changelog entries section only if there are breaking changes or other changes which may require extra steps from users during the upgrade
  • Appropriate autotests or explanation to why this change has no tests
  • For dependency updates: links to external changelogs and, if possible, full diffs

Desired reviewers

@daniel-beck @Wadeck

Maintainer checklist

Before the changes are marked as ready-for-merge:

  • There are at least 2 approvals for the pull request and no outstanding requests for change
  • Conversations in the pull request are over OR it is explicit that a reviewer does not block the change
  • Changelog entries in the PR title and/or Proposed changelog entries are correct
  • Proper changelog labels are set so that the changelog can be generated automatically
  • If the change needs additional upgrade steps from users, upgrade-guide-needed label is set and there is a Proposed upgrade guidelines section in the PR title. (example)
  • If it would make sense to backport the change to LTS, a Jira issue must exist, be a Bug or Improvement, and be labeled as lts-candidate to be considered (see query).

@@ -0,0 +1,3 @@
Behaviour.addLoadEvent(function() {
loadScript("https://usage.jenkins.io/usage-stats.js?${statData}");
Copy link
Member

Choose a reason for hiding this comment

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

This won't work. Have you tested it at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sir I used #5786 as reference for this issue.
I ran the yarn tests as it was written but is showed 2 test case passed.
Can you help me out. ?

Copy link
Contributor

Choose a reason for hiding this comment

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

It needs to be tested interactively with a web browser in addition to the test automation. Human evaluation of presentation of a web page sees things that the automated test assertions may not be checking.

Copy link
Contributor

Choose a reason for hiding this comment

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

The statData is a java variable that is injected in the Jelly. If you are moving to a separate file, this value will be not provided to the JS file.

You can find more information in https://www.jenkins.io/doc/developer/security/xss-prevention/#passing-values-to-javascript.

But yeah, please test it manually ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Wadeck @MarkEWaite can you check now?

@abhijeet007rocks8 abhijeet007rocks8 changed the title [JENKINS-66729] Un-inlining UsageStatistics/footer.jelly (CSP issue) #Hacktoberfest Draft: [JENKINS-66729] Un-inlining UsageStatistics/footer.jelly (CSP issue) #Hacktoberfest Oct 5, 2021
@abhijeet007rocks8 abhijeet007rocks8 changed the title Draft: [JENKINS-66729] Un-inlining UsageStatistics/footer.jelly (CSP issue) #Hacktoberfest [JENKINS-66729] Un-inlining UsageStatistics/footer.jelly (CSP issue) #Hacktoberfest Oct 6, 2021
@abhijeet007rocks8
Copy link
Contributor Author

@MarkEWaite @daniel-beck @Wadeck can you review the PR now ?

Copy link
Contributor

@Wadeck Wadeck left a comment

Choose a reason for hiding this comment

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

Not manually tested but this version should work a lot better :)

Have you tested it?

@Wadeck Wadeck added skip-changelog Should not be shown in the changelog squash-merge-me Unclean or useless commit history, should be merged only with squash-merge labels Oct 10, 2021
Copy link
Member

@oleg-nenashev oleg-nenashev left a comment

Choose a reason for hiding this comment

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

Yes the new version should work.

We may merge it in 24 hours if there is no negative feedback. Please see the merge process documentation for more information about the merge process

@oleg-nenashev oleg-nenashev added the ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback label Oct 19, 2021
@oleg-nenashev oleg-nenashev merged commit 6adc9c0 into jenkinsci:master Oct 20, 2021
@oleg-nenashev
Copy link
Member

Thanks a lot for your contribution @abhijeet007rocks8 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback skip-changelog Should not be shown in the changelog squash-merge-me Unclean or useless commit history, should be merged only with squash-merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants