5
For which I understood, this response header controls access to the content of the application, and in conjunction with other headers such as the Referrer Policy
approached in this question, increases exponentially the security of the site of various types of attacks (especially XSS).
In the Security Headers for example, having only https working does not guarantee you more than a "D" note, but with these stated directives the note increases a lot.
An example of use (cited in the first link above) is:
Feature-Policy: vibrate 'self'; usermedia *; sync-xhr 'self' https://example.com
In the Google Developers informs that with Featured Police
it is possible to perform several actions:
- Change the default autoplay behavior in videos for devices furniture and third party;
- Restrict a website from using confidential Apis as a camera or microphone.
- Allow
iframes
use the fullscreenAPI. - Block the use of outdated Apis such as XHR and synchronous
document.write()
; - Ensure that images are scaled
correctly (for example, avoid layout grinding) and are not
too big for the
viewport
(for example, width waste user band).
(* translated with the help of Google translator)
So I was wondering how to declare Feature Policy Header
in the .htaccess
, since use resources from external websites, like Cloudflare’s CDN, Google Analytics (tagmanager), Google Fonts, font-awesome, but I don’t use access to camera or microphone, videos...
For now, with the modifications made so far for the others headers
, the referent part of . htaccess looks like this:
<IfModule mod_headers.c>
Header always set X-Xss-Protection "1; mode=block"
Header always append X-Frame-Options SAMEORIGIN
Header set X-Content-Type-Options nosniff
Header always set Referrer-Policy "strict-origin-when-cross-origin"
</IfModule>
whereas I want only the source server itself, CDN, Google, Font-awesome etc to be able to upload data on the page, as should be the statement on .htaccess
?
Search here on this site "How does the "Referrer Policy" header work? show the meaning of each treatment, apply one that matches the needs of your site.
– Ela Black Sheep
The Feature-Policy seems to me this linked to site features like: Accelerometer, Camera, Microphone, Paymentrequest, ... - It seems to me that you are looking for something like content control Content-Security-Policy, would that ? -- If yes, it might be worth reformulating the question =D
– Icaro Martins
So @Icaro Martins, I referred to the resources I use on the site only as a complement. The content-security-Police is yet another thing I’m already thinking about in another rsrs question. In the case here, since you didn’t use these features (micropobe etc) I want to disable all using Feature-Police, but without breaking the application...
– gustavox
But looking better I think the final part of the question I got confused and I turned to aspects of content-secuity even... then I will edit. Thanks
– gustavox