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-60866] Add initial guidelines how to make code compatible with CSP #5301

Merged
merged 4 commits into from
Jul 29, 2022

Conversation

daniel-beck
Copy link
Contributor

@daniel-beck daniel-beck commented Jul 20, 2022

@daniel-beck daniel-beck requested a review from Wadeck July 20, 2022 18:28
@daniel-beck daniel-beck requested a review from a team as a code owner July 20, 2022 18:28
@probot-autolabeler probot-autolabeler bot added the documentation Jenkins documentation, including user and developer docs, solution pages, etc. label Jul 20, 2022
Copy link
Contributor

@dwnusbaum dwnusbaum left a comment

Choose a reason for hiding this comment

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

I added some stylistic suggestions, but I also noticed one typo.

content/doc/developer/security/csp.adoc Outdated Show resolved Hide resolved
content/doc/developer/security/csp.adoc Outdated Show resolved Hide resolved
content/doc/developer/security/csp.adoc Outdated Show resolved Hide resolved
content/doc/developer/security/csp.adoc Outdated Show resolved Hide resolved
content/doc/developer/security/csp.adoc Outdated Show resolved Hide resolved
content/doc/developer/security/csp.adoc Outdated Show resolved Hide resolved
content/doc/developer/security/csp.adoc Outdated Show resolved Hide resolved
content/doc/developer/security/csp.adoc Outdated Show resolved Hide resolved
To parse JSON, use `JSON.parse` instead.
See https://github.com/jenkinsci/jenkins/pull/6868[jenkinsci/jenkins#6868] for an example.

To invoke a callback, have the caller define a global function and pass its name as an argument.
Copy link
Contributor

Choose a reason for hiding this comment

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

Having to define globals seems awkward. Do you have an example of this case?

Copy link
Contributor Author

@daniel-beck daniel-beck Jul 21, 2022

Choose a reason for hiding this comment

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

var foo = function() { … } (or let foo = function() { … }) outside any block makes it global scoped (or, since it's functions, function foobar() { … }).

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I just meant that the general scenario of when you would need to do this is not really clear to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's the part of jenkinsci/jenkins#6865 related to renderOnDemand.jelly.

@MarkEWaite
Copy link
Contributor

I think this is enough of an improvement to justify the merge, especially with the review from @dwnusbaum

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Jenkins documentation, including user and developer docs, solution pages, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants