Giter Site home page Giter Site logo

CSP problem about jquery HOT 8 CLOSED

soilssong avatar soilssong commented on June 8, 2024
CSP problem

from jquery.

Comments (8)

wizzymore avatar wizzymore commented on June 8, 2024

Can you provide a snippet of the code that triggers this error?

from jquery.

soilssong avatar soilssong commented on June 8, 2024

Can you provide a snippet of the code that triggers this error?

unnamed

Actually I'm adding my scripts like that due to BundleConfig.
I have tried to adding nonce to every script that related the Jquery but the result is same, I even tried to hard coded nonce like

<script ............ 'nonce-example' There are lot of script file that uses Jquery so I'm not quite sure which one is triggering and is that the proper usage of nonce values.

from jquery.

wenz avatar wenz commented on June 8, 2024

Looking at the error message in the browser console, it looks like there is no nonce in the CSP.

from jquery.

soilssong avatar soilssong commented on June 8, 2024

Yes that was the error message before I have applied nonce. I added hard-coded nonce like below even I know that its should be generated at each request but just wanted to test it with static value.
csp1
csp2

This is my CSP:

csp3

in that CSP condition isn't that enough to add this value to script tags as a nonce value that related to Jquery ?

from jquery.

wenz avatar wenz commented on June 8, 2024

Thanks for the clarification. I assume you could confirm in the browser dev tools that the <script> tag in question does not have a nonce attribute, right? A minimal reproduction of the error, e.g. on jsbin, would be helpful.

from jquery.

mgol avatar mgol commented on June 8, 2024

The browser will generally clean the nonce attribute for security reasons but you should be able to read the nonce property - you can even try doing that from browser DevTools.

It's hard to act on this without any test case. Hence the Needs info label for now.

from jquery.

soilssong avatar soilssong commented on June 8, 2024

First of all sorry for late response and thanks for your support.
I can confirm that in web browser tool , I can see the nonce attribute but its hides the value of it. ( and I think as mgol said its a built in behavior by modern browsers)
Beside of all these recently I have realised that even my onClick functions are violating CSP itself. You can see it below.
There are lot of functions so I couldn't figure out how can I minimize it and just wanted to show some part of it.
For example this is the codes I'm using from pagination, when I'm clicking the any page number new CSP violation error occurs.

image
image
image
image

from jquery.

mgol avatar mgol commented on June 8, 2024

Inline event handlers will definitely conflict with CSP. It looks like you have a lot to do that’s unrelated to jQuery. Let me close the issue then. You may want to try venues more geared towards developer help rather than the jQuery bug report.

from jquery.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.