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

stapler:bind is creating inline javascript #457

Closed
mawinter69 opened this issue Apr 25, 2023 · 3 comments · Fixed by #385
Closed

stapler:bind is creating inline javascript #457

mawinter69 opened this issue Apr 25, 2023 · 3 comments · Fixed by #385

Comments

@mawinter69
Copy link

What feature do you want to see added?

using <st:bind var="myproxy" value="${it}"/>result in the following code getting injected in the rendered page:

<script>
myproxy = makeStaplerProxy(...)
</script>

This is a problem when Content Security Policy should be enabled.
Maybe one can just create some json data

<script class="stapler-javascript-proxy" type="application/json">
  {"myproxy": {"url": "/jenkins/$stapler/bound/dcabcdd4-f80d-4b46-b5f7-db0ce94ab8ff",
               "crumb": "abc234d97ed766f5...",
               "methods": ["myfirstmethod", "mysecondmethod"] 
               }
  }
</script>

The bind.js could then find the data and do the assignment to the variable.

Upstream changes

No response

@timja
Copy link
Member

timja commented Apr 25, 2023

There's a PR here for this #385 from @daniel-beck

@MarkEWaite
Copy link
Contributor

Merged and included in Stapler release 1839.ved17667b_a_eb_5

@daniel-beck
Copy link
Member

Depends on jenkinsci/jenkins#6865 to work though. Reviews still welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants