From eb5528e17691b4e761ae2d4a14e157e2b51f560f Mon Sep 17 00:00:00 2001 From: Gabriel Grubba <70247653+Grubba27@users.noreply.github.com> Date: Thu, 25 Jan 2024 16:15:23 -0300 Subject: [PATCH] docs-packages: added browser policy --- v3-docs/docs/packages/browser-policy.md | 175 ++++++++++++++++++++++++ 1 file changed, 175 insertions(+) create mode 100644 v3-docs/docs/packages/browser-policy.md diff --git a/v3-docs/docs/packages/browser-policy.md b/v3-docs/docs/packages/browser-policy.md new file mode 100644 index 0000000000..248c49fe7c --- /dev/null +++ b/v3-docs/docs/packages/browser-policy.md @@ -0,0 +1,175 @@ +# Browser Policy + +The `browser-policy` family of packages, part of +[Webapp](https://github.com/meteor/meteor/tree/master/packages/webapp), lets you +set security-related policies that will be enforced by newer browsers. These +policies help you prevent and mitigate common attacks like cross-site scripting +and clickjacking. + +## Details + +When you add `browser-policy` to your app, you get default configurations for +the HTTP headers X-Frame-Options and Content-Security-Policy. X-Frame-Options +tells the browser which websites are allowed to frame your app. You should only +let trusted websites frame your app, because malicious sites could harm your +users with [clickjacking attacks](https://www.owasp.org/index.php/Clickjacking). +[Content-Security-Policy](https://developer.mozilla.org/en-US/docs/Security/CSP/Introducing_Content_Security_Policy) +tells the browser where your app can load content from, which encourages safe +practices and mitigates the damage of a cross-site-scripting attack. +`browser-policy` also provides functions for you to configure these policies if +the defaults are not suitable. + +If you only want to use Content-Security-Policy or X-Frame-Options but not both, +you can add the individual packages `browser-policy-content` or +`browser-policy-framing` instead of `browser-policy`. + +For most apps, we recommend that you take the following steps: + +- Add `browser-policy` to your app to enable a starter policy. With this starter + policy, your app's client code will be able to load content (images, scripts, + fonts, etc.) only from its own origin, except that XMLHttpRequests and WebSocket + connections can go to any origin. Further, your app's client code will not be + able to use functions such as `eval()` that convert strings to code. Users' + browsers will only let your app be framed by web pages on the same origin as + your app. +- You can use the functions described below to customize the policies. If your + app does not need any inline Javascript such as inline `