{"ava":{"failFast":false,"files":["dist/tests/**/*.js","!dist/tests/**/fixtures/**/*.js"],"timeout":"1m"},"dependencies":{"@hint/utils":"^6.1.0"},"description":"hint for best practices related to the usage of the X-Content-Type-Options response header.","devDependencies":{"@hint/utils-tests-helpers":"^5.1.0","@types/node":"^12.7.5","@typescript-eslint/eslint-plugin":"^1.13.0","@typescript-eslint/parser":"^1.12.0","ava":"^2.4.0","cpx":"^1.5.0","eslint":"^6.5.1","eslint-plugin-import":"^2.18.2","eslint-plugin-markdown":"^1.0.0","npm-run-all":"^4.1.5","nyc":"^14.1.0","rimraf":"^3.0.0","typescript":"^3.6.4"},"engines":{"node":">=8.0.0"},"homepage":"https://webhint.io/","keywords":["webhint","webhint-hint","webhint-recommended","x-content-type-options","x-content-type-options-hint"],"license":"Apache-2.0","main":"dist/src/hint.js","name":"@hint/hint-x-content-type-options","nyc":{"extends":"../../.nycrc"},"peerDependencies":{"hint":"^5.0.0"},"repository":{"directory":"packages/hint-x-content-type-options","type":"git","url":"git+https://github.com/webhintio/hint.git"},"scripts":{"build":"npm run i18n && npm-run-all build:*","build-release":"npm run clean && npm run i18n && npm run build:assets && tsc --inlineSourceMap false --removeComments true","build:assets":"cpx \"./{src,tests}/**/{!(*.ts),.!(ts)}\" dist","build:ts":"tsc -b","clean":"rimraf dist","i18n":"node ../../scripts/create-i18n.js","lint":"npm-run-all lint:*","lint:js":"eslint . --cache --ext js --ext md --ext ts --ignore-path ../../.eslintignore --report-unused-disable-directives","lint:dependencies":"node ../../scripts/lint-dependencies.js","lint:md":"node ../../scripts/lint-markdown.js","test":"npm run lint && npm run build && npm run test-only","test-only":"nyc ava","test-release":"npm run lint && npm run build-release && ava","watch":"npm run build && npm-run-all --parallel -c watch:*","watch:assets":"npm run build:assets -- -w --no-initial","watch:test":"ava --watch","watch:ts":"npm run build:ts -- --watch"},"version":"3.2.11","bugs":{"url":"https://github.com/webhintio/hint/issues"},"_id":"@hint/hint-x-content-type-options@3.2.11","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-tIB9RtgpNrsTKHt6WxyldeEb47cDfFI/2MNtV0XSQpePKjBEqM7rK0ep6WXNkMuOReH71irY8Jr7NRFhGrdCAg==","shasum":"8d7dbd3a5a3f31f5fb47b2fc3f1f7548015125c4","tarball":"http://registry-npm.ywwl.com/@hint/hint-x-content-type-options/download/@hint/hint-x-content-type-options-3.2.11.tgz","fileCount":18,"unpackedSize":450706,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJduL3DCRA9TVsSAnZWagAAr7sP+wUvNGg2PaOjtlOYul8m\npLp7sVnCGmG+RVnLduHOk3WP7/IyeKmJDxrzXG1TCT9IYDL1/BcxhrcIc2E7\nUFzaQKeCVo1LX/z94dUnLDBb0QhLQBwJk0NQbGLdy0ArOKqO4JD38d2V8952\nsmZlZJurn+s7ewr+nIHane0US0/iaoWv/3ID7lOnS/KHZvO/GnFFNYVRFmf4\nz0M89JOWil7s4SoE1AjKgwC3O9HFZmvlSl0nAZkKOculoP4nXr4fhAGAnEeV\nvRbwYEw7/6oHZWhWt8whYGt1+obswbsdbIxCegx0dPpIoiAYUfh2T2T0YPv0\npiUwnb+jTUTdBYxYdZo0a5nGlSLvvjT5DM521E91oLRzBEQAurLQky4BUME7\nQ2YDmivw9KAVl3kGa451+7sRkHwhcBXh6Ryuf+PywKUWvIRu779O5zrtIGiM\ngefPhOvdaFn0xpZPwMXeybaf2e34zf0g1TYX4iNSkcL7W/4Ilbwnc2ygXFDZ\nI2YRBsnwOEEW9DXTd4EKZMJA4yIZGhk/d7gLfQdbkKYzH3WX7p9ZLJpRpydn\nI/R/MVqmt8HMj+tjeDNjkjNWqtd9EoG5Js/ui5J1a1PZNK2ER/wUBH3NkCgs\nU0sKa21l184Bl82SIofC0317XfdLvyBT7E9HJjm2Y4JwLgEcF0+cz5uXIY49\nzM2A\r\n=5OOO\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBYvUsGr+cq9JQcfLUWpSAesV6Vbmt1/u7y5aCII+hTPAiEAt5wG6uK2vdB9TrLTfYLm2On0vKWPj114vEe0cGGFQyA="}],"size":53301,"noattachment":false,"key":"/@hint/hint-x-content-type-options/-/@hint/hint-x-content-type-options-3.2.11.tgz"},"maintainers":[{"email":"antross@gmail.com","name":"antross"},{"email":"amolleda@gmail.com","name":"molant"}],"_npmUser":{"name":"molant","email":"amolleda@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hint-x-content-type-options_3.2.11_1572388291282_0.058361577461848"},"_hasShrinkwrap":false,"readme":"# Use `X-Content-Type-Options` header (`x-content-type-options`)\n\n`x-content-type-options` requires that all resources are\nserved with the `X-Content-Type-Options: nosniff`\nHTTP response header.\n\n## Why is this important?\n\nSometimes the metadata browsers need to know how to interpret the\ncontent of a resource is either incorrect, not reliable, or absent.\nIn those cases, browsers use contextual clues that inspect the bytes\nof the response to detect the file format. This is known as [MIME\nsniffing][mime sniffing spec] and it is done regardless of the specified\n`Content-Type` HTTP header sent by servers.\n\nFor example, if a browser requests a script, but that script is served\nwith an incorrect media type (e.g. `x/x`), the browser will still detect\nthe script and execute it.\n\nWhile content sniffing can be beneficial, it can also expose the web\nsite/app to attacks based on MIME-type confusion leading to security\nproblems, especially in the case of servers hosting untrusted content.\n\nFortunately, browsers provide a way to opt-out of MIME sniffing by\nusing the `X-Content-Type-Options: nosniff` HTTP response header.\n\nGoing back to the previous example, if the `X-Content-Type-Options: nosniff`\nheader is sent for the script and the browser detects that it’s a script\nand it wasn’t served with one of the [JavaScript media types][javascript\nmedia types], the script will be blocked.\n\nWhile [modern browsers respect the header mainly for scripts and\nstylesheets][fetch spec blocking], [Chromium uses this response header on\nother resources][chromium ssca] for\n[Cross-Origin Read Blocking][chromium corb].\n\n## What does the hint check?\n\nThe hint checks if all resources are served with the\n`X-Content-Type-Options` HTTP headers with the value of `nosniff`.\n\n### Examples that **trigger** the hint\n\nResource is not served with the\n`X-Content-Type-Options` HTTP header.\n\n```text\nHTTP/... 200 OK\n\n...\n\nContent-Type: image/png\n```\n\nScript is served with the `X-Content-Type-Options` HTTP header\nwith the invalid value of `no-sniff`.\n\n```text\nHTTP/... 200 OK\n\n...\nContent-Type: text/javascript; charset=utf-8\nX-Content-Type-Options: no-sniff\n```\n\n### Examples that **pass** the hint\n\nScript is served with the `X-Content-Type-Options` HTTP header\nwith the valid value of `nosniff`.\n\n```text\nHTTP/... 200 OK\n\n...\nContent-Type: text/javascript; charset=utf-8\nX-Content-Type-Options: nosniff\n```\n\n## How to configure the server to pass this hint\n\n<details><summary>How to configure Apache</summary>\n\nApache can be configured to add headers using the [`Header`\ndirective][header directive].\n\n```apache\n<IfModule mod_headers.c>\n    Header always set X-Content-Type-Options nosniff\n</IfModule>\n```\n\nNote that:\n\n* The above snippet works with Apache `v2.2.0+`, but you need to have\n  [`mod_headers`][mod_headers] [enabled][how to enable apache modules]\n  for it to take effect.\n\n* If you have access to the [main Apache configuration file][main\n  apache conf file] (usually called `httpd.conf`), you should add\n  the logic in, for example, a [`<Directory>`][apache directory]\n  section in that file. This is usually the recommended way as\n  [using `.htaccess` files slows down][htaccess is slow] Apache!\n\n  If you don't have access to the main configuration file (quite\n  common with hosting services), add the snippets in a `.htaccess`\n  file in the root of the web site/app.\n\nFor the complete set of configurations, not just for this rule, see\nthe [Apache server configuration related documentation][apache config].\n\n</details>\n\n<details>\n\n<summary>How to configure IIS</summary>\n\nYou can add this header unconditionally to all responses.\n\n```xml\n<configuration>\n     <system.webServer>\n        <httpProtocol>\n            <customHeaders>\n                <add name=\"X-Content-Type-Options\" value=\"nosniff\" />\n            </customHeaders>\n        </httpProtocol>\n    </system.webServer>\n</configuration>\n```\n\nNote that:\n\n* The above snippet works with IIS 7+.\n* You should use the above snippet in the `web.config` of your\n  application.\n\nFor the complete set of configurations, not just for this rule,\nsee the [IIS server configuration related documentation][iis config].\n\n</details>\n\n## How to use this hint?\n\nThis package is installed automatically by webhint:\n\n```bash\nnpm install hint --save-dev\n```\n\nTo use it, activate it via the [`.hintrc`][hintrc] configuration file:\n\n```json\n{\n    \"connector\": {...},\n    \"formatters\": [...],\n    \"hints\": {\n        \"x-content-type-options\": \"error\",\n        ...\n    },\n    \"parsers\": [...],\n    ...\n}\n```\n\n**Note**: The recommended way of running webhint is as a `devDependency` of\nyour project.\n\n## Further Reading\n\n* [`X-Content-Type-Options` header](https://fetch.spec.whatwg.org/#x-content-type-options-header)\n* [Reducing MIME type security risks](https://msdn.microsoft.com/en-us/library/gg622941.aspx)\n* [Mitigating MIME Confusion Attacks in Firefox](https://blog.mozilla.org/security/2016/08/26/mitigating-mime-confusion-attacks-in-firefox/)\n* [Script Polyglots](https://blogs.msdn.microsoft.com/ieinternals/2014/11/24/script-polyglots/)\n* [IE8 Security Part V: Comprehensive Protection](https://blogs.msdn.microsoft.com/ie/2008/07/02/ie8-security-part-v-comprehensive-protection/)\n\n<!-- Link labels: -->\n\n[chromium corb]: https://chromium.googlesource.com/chromium/src/+/master/services/network/cross_origin_read_blocking_explainer.md\n[chromium ssca]: https://www.chromium.org/Home/chromium-security/ssca\n[fetch spec blocking]: https://fetch.spec.whatwg.org/#should-response-to-request-be-blocked-due-to-nosniff%3F\n[fetch spec issue]: https://github.com/whatwg/fetch/issues/395\n[hintrc]: https://webhint.io/docs/user-guide/configuring-webhint/summary/\n[javascript media types]: https://html.spec.whatwg.org/multipage/scripting.html#javascript-mime-type\n[mime sniffing spec]: https://mimesniff.spec.whatwg.org/\n\n<!-- Apache links -->\n\n[apache config]: https://webhint.io/docs/user-guide/server-configurations/apache/\n[apache directory]: https://httpd.apache.org/docs/current/mod/core.html#directory\n[header directive]: https://httpd.apache.org/docs/current/mod/mod_headers.html#header\n[how to enable apache modules]: https://github.com/h5bp/server-configs-apache/tree/7eb30da6a06ec4fc24daf33c75b7bd86f9ad1f68#enable-apache-httpd-modules\n[htaccess is slow]: https://httpd.apache.org/docs/current/howto/htaccess.html#when\n[main apache conf file]: https://httpd.apache.org/docs/current/configuring.html#main\n[mod_headers]: https://httpd.apache.org/docs/current/mod/mod_headers.html\n\n<!-- IIS links -->\n\n[iis config]: https://webhint.io/docs/user-guide/server-configurations/iis/\n","publish_time":1572388291467,"_cnpm_publish_time":1572388291467,"dist-tags":{"latest":"4.0.23"}}