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

Allow Users to Specify Alternate Sources for Content-Security Policy #3808

Closed
arno-st opened this issue Sep 16, 2020 · 15 comments
Closed

Allow Users to Specify Alternate Sources for Content-Security Policy #3808

arno-st opened this issue Sep 16, 2020 · 15 comments
Labels
bug Undesired behaviour resolved A fixed issue

Comments

@arno-st
Copy link
Contributor

arno-st commented Sep 16, 2020

Describe the bug

Using a call to an external javascript, can't be executed due to configuration of contend-security to tigth

To Reproduce

I'm using a Mapping plugin who do a call on the following url:
https://unpkg.com/[email protected]/dist/leaflet.css
https://unpkg.com/[email protected]/dist/leaflet.js

it's openstreet map componnents, and it give the following error:

Content Security Policy: The page settings prevented a resource from loading at https://unpkg.com/[email protected]/dist/leaflet.css ("style-src").
Content Security Policy: The page settings prevented a resource from loading at https://unpkg.com/[email protected]/dist/leaflet.js ("script-src").

it's on Cacti 1.2.14 but it's like that since the dev team added contewnt-security.
And i try on Firefox and IE.

I try the Console > Configuration > Setting > General
Called: Allow Unsafe JavaScript eval() calls
Set that to Yes.

but that dosen't change anything.

And I have no clue ho to solve that and what to change to apply on the current content-security settings

@arno-st arno-st added bug Undesired behaviour unverified Some days we don't have a clue labels Sep 16, 2020
@cigamit
Copy link
Member

cigamit commented Sep 16, 2020

Not a Cacti bug, but a bug within how the plugin works I believe.

Also duplicate of Cacti/plugin_gpsmap#12

@arno-st
Copy link
Contributor Author

arno-st commented Sep 16, 2020

Not a duplicate exactly, it's not the same plugin.

But I would love to have some input, to find the bug on this (my) plugin !!
Here is the part of the code that is not working s I expect him:

<script src="https://unpkg.com/[email protected]/dist/leaflet.js" integrity="sha512-gZwIG9x3wUXg2hdXF6+rVkLF/0Vi9U8D2Ntg4Ga5I5BZpVkVxlJWbSQtXPSiUTtC0TjtGOmxa1AJPuV0CPthew==" crossorigin=""></script>

and you can find the whole code here:
https://github.com/arno-st/map

It was working fine before the security-contend, and I know I'm way far from THE developer in PHP and web app, but willing to learn!

So any input you can give me is welcome

@TheWitness
Copy link
Member

We've got a but like this in the main Cacti issue tracker as well. I'm going to add another setting to loosen the security restrictions. Might have it done tonight. We'll see.

@TheWitness
Copy link
Member

Looking through the spec's again, we may have to allow one to many origin's outside of 'self'. Basically make it a configuration option.

@TheWitness TheWitness changed the title Unsafe Java script security to tight Allow Users to Specify Alternate Sources for Content-Security Policy Sep 16, 2020
TheWitness added a commit that referenced this issue Sep 16, 2020
Allow Users to Specify Alternate Sources for Content-Security Policy
@TheWitness
Copy link
Member

Hopefully, this is self explanatory.
image

@TheWitness TheWitness added resolved A fixed issue and removed unverified Some days we don't have a clue labels Sep 16, 2020
@arno-st
Copy link
Contributor Author

arno-st commented Sep 17, 2020

Almost good
You just need to add $alternate to img-src and it's ok

TheWitness added a commit that referenced this issue Sep 17, 2020
Add image source extensions
@TheWitness
Copy link
Member

Okay, test again.

@arno-st
Copy link
Contributor Author

arno-st commented Sep 17, 2020

Yup perfect thanks for your prompt action

@squad1534
Copy link

I'm facing this same issue in Debian Buster will this fix make it into buster-backports?

@TheWitness
Copy link
Member

You need to direct this to @paulgevers.

@paulgevers
Copy link
Contributor

@squad1534 yes it will, once there is a new cacti release, I packaged it for unstable, the package migrates to testing (and somebody pings me ;) )

@TheWitness
Copy link
Member

@paulgevers, we have been delaying the 1.2.15 for a bit now picking up a few additional bugs here and there. There are a number of users and companies testing the 1.2.x branch. I think we are pretty close right now. When @netniV thinks we are ready, we will pull the trigger.

@netniV
Copy link
Member

netniV commented Oct 25, 2020

I am thinking next weekend would be good. Most things seem to have calmed down again.

@bmfmancini
Copy link
Member

bmfmancini commented Oct 25, 2020 via email

@squad1534
Copy link

Sounds great, thanks Devs!

TheWitness added a commit that referenced this issue Dec 16, 2020
This is a partial rollback of issue #3808 due to negative impact it has on both GUI and Data Collector performance.
@github-actions github-actions bot locked and limited conversation to collaborators Jan 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Undesired behaviour resolved A fixed issue
Projects
None yet
Development

No branches or pull requests

7 participants