{"ava":{"failFast":false,"files":["dist/tests/**/*.js"],"timeout":"1m"},"dependencies":{"@hint/utils":"^3.1.2"},"description":"hint for best practices related to the usage of the X-Content-Type-Options response header.","devDependencies":{"@hint/utils-tests-helpers":"^5.0.4","@types/node":"^12.6.9","@typescript-eslint/eslint-plugin":"^1.13.0","@typescript-eslint/parser":"^1.12.0","ava":"^1.4.1","cpx":"^1.5.0","eslint":"^5.15.1","eslint-plugin-import":"^2.18.2","eslint-plugin-markdown":"^1.0.0","hint":"^5.2.0","npm-link-check":"^3.0.0","npm-run-all":"^4.1.5","nyc":"^14.1.0","rimraf":"^2.6.3","typescript":"^3.5.1"},"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.2.0"},"repository":{"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.3","bugs":{"url":"https://github.com/webhintio/hint/issues"},"_id":"@hint/hint-x-content-type-options@3.2.3","_npmVersion":"6.4.1","_nodeVersion":"8.16.0","_npmUser":{"name":"antross","email":"antross@gmail.com"},"dist":{"integrity":"sha512-21Dl5xLn0mbKDJpnMQUTjYe5mtDF2T9idB0C+vdfiT5EMwMmMH7/kHRLVZOdCqKgSLqH2b34YEZWUx1MF/H42w==","shasum":"6a07abd217d5a28f4cb6f964a3012c588846bd56","tarball":"http://registry-npm.ywwl.com/@hint/hint-x-content-type-options/download/@hint/hint-x-content-type-options-3.2.3.tgz","fileCount":18,"unpackedSize":643211,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdSeZ0CRA9TVsSAnZWagAAnPIP/RVkcXfKUTLDiwolPl9W\nDeTvFT5qiRtxe9ba633qXR0vtvhZZeSNjaeomv2ntjBGq20nDGxZ2ct/N72N\nkp2SaeanZJFQJOzf2xZ5EtHs4C2OLKAuZnvvNIR/oNDqqpP9PIsWBgJrhtV2\nNCow01Pebr+peXIMsUMNpplvZMrIVIDPTCa2KKLUoGMZ8vObq26Sj/Ywf2I1\nkTtbJQ6PmFVZYBvjsVg1wEx+cp1JrIIsw2oCq4PpHvaL/1jvUnBQuGvn2ZTV\nOhvdDHe7clWW7Nafj4qr6ArEXqIBJyveO43vCFJSRjezPE8Wk34+5Rnump/l\nyoRWFe87xDZVrd9Vt8h7Sbe+FtkfYR4Hmb47d+A2oOX/Nfp/Ltz6JGYeRKTG\nLtXC2sG/D50DidUfDpuUBDBZpPKa8xCPlOTR2Rm9ougmfrgY16BjXpZx9O93\nLBY4pSvWR1CULQeHLb2oTH8+WhVBe8pKto7c/ukkrlc35ksoRycQ+vtPN6bB\nFYCCDkbzPoytkcHp6hX7mIKhyIPHz+IiuvyOV8ukDYy6g33Pevd20Atn76IX\ncFhG+lQxUGYbyaSfK1HbXarcHFeagVsY+Q2AW0/O9yJgLuZP+f+kAvssbaGc\nVNLZLWDS9TFRqzAK5mEkg0qCKrHVNPDWyH/u/ZzEyxwI65rmtR8O3rXxQfOD\n2Dok\r\n=yhb5\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCGEFfQiuVlIPZz8sAa+WJES61xYAnujNIf7NsmZGAO9AIhALOAIIE5kVL4O/wNHACU/ott7WeB3cpNgGosrr1OjzbR"}],"size":53899,"noattachment":false,"key":"/@hint/hint-x-content-type-options/-/@hint/hint-x-content-type-options-3.2.3.tgz"},"maintainers":[{"email":"antross@gmail.com","name":"antross"},{"email":"amolleda@gmail.com","name":"molant"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hint-x-content-type-options_3.2.3_1565124212007_0.6858543771354084"},"_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":1565124212188,"_cnpm_publish_time":1565124212188,"dist-tags":{"latest":"4.0.23"}}