harvesthq / platform

A whole new way to add time tracking to your web application.
https://www.getharvest.com/platform
59 stars 11 forks source link

CSP - Content Security Policy #42

Closed Artistan closed 6 years ago

Artistan commented 6 years ago

the button inclusion does not work for me due to CSP...

https://developer.chrome.com/apps/contentSecurityPolicy

screen shot 2017-08-29 at 2 23 53 pm

Artistan commented 6 years ago

https://github.com/Artistan/harvest-scripts-integration/blob/master/harvest_git_integration.user.js

adunkman commented 6 years ago

It looks like the site that you’re attempting to integrate will uses a Content Security Policy. You’ll need to allow access to harvestapp.com in order to integrate — it’s not something that we can allow on our end.

Artistan commented 6 years ago

https://chrome.google.com/webstore/detail/content-security-policy-o/lhieoncdgamiiogcllfmboilhgoknmpi


[
    ["https://github\\.com", [
        ["img-src", "img-src https://*.harvestapp.com"],
        ["connect-src", "connect-src https://*.harvestapp.com"],
        ["child-src", "child-src https://*.harvestapp.com"],
        ["script-src", "script-src 'unsafe-eval'"]
    ]]
]

screen shot 2017-08-29 at 2 47 07 pm

Artistan commented 6 years ago

What's up with just closing this with no feedback? @adunkman ? You "embeded" code does not support CSP restrictions.

Artistan commented 6 years ago

https://github.com/Artistan/harvest-scripts-integration/blob/master/harvest_git_integration.user.js

this works in gitlabs similar to the chrome plugin.

adunkman commented 6 years ago

I’m not sure what to tell you — our script requires access to our servers to function, and based on your screenshot above, a Content Security Policy is preventing the script from accessing our servers.

You’ll need to change the Content Security Policy to allow access, or the script won’t function. The Content Security Policy is set by the site that you’re integrating into — which unfortunately we at Harvest don’t have access to modify.

Our Chrome extension modifies Content Security Policies when appropriate, which is how it gets around the restrictions. If something works in GitLab but doesn’t work in other places, I’d expect the sites to have different Content Security Policies.

Artistan commented 6 years ago

Thank you for the reply.