Jump to content

Using url names with variables in a Content-Security-Policy statement


phdphd
 Share

Recommended Posts

Hi All,

I would like to implement a content security policy in my htaccess file. My website uses maps, and one of the URLs I want to allow has variables. 

https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png

I use this URL in a js file ("var tiles = L.tileLayer('https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png', ....")

What syntax should I use to express this URL in a Content-Security-Policy statement ? Can I use it as is or do I need some wildcards for the variables?

I know there exists the "*" wildcard, but I think that if I used it to match the beginning "{s}", any malicious URL starting with a sequence of characters followed by ".basemaps.cartocdn.com" might match. Would such a risk exists?

Thanks!

 

 

 

 

Link to comment
Share on other sites

7 hours ago, phdphd said:

any malicious URL starting with a sequence of characters followed by ".basemaps.cartocdn.com" might match. Would such a risk exists?

You're asking if someone could create their own website under *.basemaps.cartocdn.com.

  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.