{"ava":{"failFast":false,"files":["dist/tests/**/*.js","!dist/tests/**/fixtures/**/*.js"],"timeout":"1m"},"dependencies":{"@hint/utils-debug":"^1.0.4","@hint/utils-i18n":"^1.0.7","@hint/utils-network":"^1.0.8","@hint/utils-string":"^1.0.7","@hint/utils-types":"^1.1.2"},"description":"hint for best practices related to the usage of the X-Content-Type-Options response header.","devDependencies":{"@hint/utils-create-server":"^3.4.8","@hint/utils-tests-helpers":"^6.3.2","@types/node":"^14.14.22","@typescript-eslint/eslint-plugin":"^4.14.1","@typescript-eslint/parser":"^4.14.1","ava":"^3.15.0","cpx":"^1.5.0","eslint":"^7.17.0","eslint-plugin-import":"^2.22.1","eslint-plugin-markdown":"^1.0.2","npm-run-all":"^4.1.5","nyc":"^15.1.0","rimraf":"^3.0.2","typescript":"^4.1.3"},"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":"^6.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,.md,.ts --ignore-path ../../.eslintignore","lint:dependencies":"node ../../scripts/lint-dependencies.js","lint:md":"node ../../scripts/lint-markdown.js","test":"npm run i18n && npm run lint && npm run build && npm run test-only","test-only":"nyc ava","test-release":"npm run i18n && 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":"4.0.4","bugs":{"url":"https://github.com/webhintio/hint/issues"},"_id":"@hint/hint-x-content-type-options@4.0.4","_nodeVersion":"10.22.0","_npmVersion":"6.14.6","dist":{"integrity":"sha512-B5SoDOoKCVgVL0rjUxQH+8m68qLMcxIh7IhBmoRzCcHk4sHOQPSSswdiF43U6WuMgCR1W/gUpUFuI/q+19KsbQ==","shasum":"468ed7720daf9f4c2306106d85f20f21f219a883","tarball":"http://registry-npm.ywwl.com/@hint/hint-x-content-type-options/download/@hint/hint-x-content-type-options-4.0.4.tgz","fileCount":18,"unpackedSize":722594,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgHEvECRA9TVsSAnZWagAAwzUQAItD9TvDtvdlQ/Ur8499\nznBnnVbZ0KvIKxyvz8sNDQKl0siySYOo1yAqa9m0Od/QzuPh07RIXqooZ8fa\n31tm4za3qVp5vXuo2y0+SWRdFzUrmZDrT6xD7ZDdxy983I1E9cGaVzWA/EIP\n1eQyMuH1/XKdO8YblCJUGjxBFfepXzP5uUmysCtHonqRtw91oky9tuIHLdYT\nnLwBvcH2x5Mtrc7Zm2rODwClU3egqBbRGJCaqzpr1fYottIuHz/tlAgDPuZ2\nsQlJmK4Bg6icVXtqWuREV50x5hKk9Jdfp5tx70cxBchZj9SNJKUAMmcI8CHn\nrigfVXHHog2UypuQ8cUHNCciydkUJ4uGzIE2U8P1SUIq7/riDPMkk7RJhCCD\nQ1JdWl2F6DGD+CVBlRmcyT23BaGQqVt85YVDqgr9absilwk9eOhvR5zXpg2/\nAexClZFZ+fUcQcDWAWPrWr+I6dXDhyf8qNodDyXo9fwZETC5PkQ6/kg1QA3/\n3LpeoI2VmKrvYllmkt7f7CI5Vxw03i8vriE1+ZVln8FWA0G5RVPtdEj0kvwu\nVbf8e40tfrQRnnTKLJHm8J52j4pWfDE5IM6HnqLnsbcdHw5MfIqUnicJ64+s\n3VLo1P1uPDdkouZfrF9OfjEN/Kc7VTUn0X3T/sBhlnKtyK/UQiR1KeDNLIyn\nuqTD\r\n=fWLN\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBZXwiyuLEWEEUe+cVu6ytMHnf2fquEXjXyeD314tpT0AiAYfB1tRvl2M1F26bkehxKouCtBDhxnSVV+5N3hUqGrBg=="}],"size":66738,"noattachment":false,"key":"/@hint/hint-x-content-type-options/-/@hint/hint-x-content-type-options-4.0.4.tgz"},"_npmUser":{"name":"sarvaje","email":"jdgarcia@outlook.com"},"directories":{},"maintainers":[{"name":"molant","email":"amolleda@gmail.com"},{"name":"antross","email":"antross@gmail.com"},{"name":"johnatms","email":"John.Emau@microsoft.com"},{"name":"sarvaje","email":"jdgarcia@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hint-x-content-type-options_4.0.4_1612467139582_0.9574164670180916"},"_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":1612467139732,"_cnpm_publish_time":1612467139732,"dist-tags":{"latest":"4.0.23"}}