{"ava":{"failFast":false,"files":["dist/tests/**/*.js","!dist/tests/**/fixtures/**/*.js"],"timeout":"1m"},"dependencies":{"@hint/utils-debug":"^1.0.1","@hint/utils-i18n":"^1.0.3","@hint/utils-network":"^1.0.4","@hint/utils-string":"^1.0.3","@hint/utils-types":"^1.0.1"},"description":"hint for best practices related to the usage of the X-Content-Type-Options response header.","devDependencies":{"@hint/utils-create-server":"^3.4.4","@hint/utils-tests-helpers":"^6.1.2","@types/node":"^13.13.4","@typescript-eslint/eslint-plugin":"^1.13.0","@typescript-eslint/parser":"^1.12.0","ava":"^3.8.2","cpx":"^1.5.0","eslint":"^6.8.0","eslint-plugin-import":"^2.18.2","eslint-plugin-markdown":"^1.0.2","npm-run-all":"^4.1.5","nyc":"^15.0.1","rimraf":"^3.0.2","typescript":"^3.8.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.0","bugs":{"url":"https://github.com/webhintio/hint/issues"},"_id":"@hint/hint-x-content-type-options@4.0.0","_nodeVersion":"10.19.0","_npmVersion":"6.14.4","dist":{"integrity":"sha512-A4CGJNfNXkuyf7ArRcPOqJ/Got2HJAETAd7PVOfeGZBNshoNB4+DCRuUf9gp8GBLhTU8lnc5QY3kSL7t8uBPaw==","shasum":"74d738c4762a356da56c0d657cbc4f7c04f42c87","tarball":"http://registry-npm.ywwl.com/@hint/hint-x-content-type-options/download/@hint/hint-x-content-type-options-4.0.0.tgz","fileCount":18,"unpackedSize":897756,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJewwmSCRA9TVsSAnZWagAAZQgQAIIoiEObM9e4KzKs4Rvz\nAb6CewBqIMCCCQpzDv0JAFfZo/6bagsDn4hT3OXZttKkIHs2yRxMZO56kk1v\nFQGcaNiG+NcMon4X5kwEasozbdRk0M0ccJaqicCFB7RU3V4bYcaT4IPlm+aV\n1n+uglstMgUxWMcMQtx9bwiQvcv40gelNtK3e/qcqEzzdkPN0wkrQuBOYpbB\nqpaGSrvdOFFU2W1lMxKbgic1NhC+7fJgZrseh+EpY0hO5TnHlYnAGnAXxnTG\ncKhL/D34XGVPsn3k1mCgcazylzTiUZ3fChcvZKskaYfUqFHDSvmv86shpcKg\n/6UuDu80GCA6LPgIj335jMSe931t4kBYGrVwwVgYF2EYOajINPxmPPvuzdov\nfJzzr/4jfQbadW5Xru5iAw3BOqGP2cZWg6x8UKWIxxrWO4h4ojOJsLfjheFD\nKv5VYC2tKvuDalO8QAsWdcglFDFSRVEFnAK7S/ycg/T2JQTSsHYPAJGUfDex\nl1Jcsf/qNIHyURMAij6PuRxM2BhvEHkyyLpm89jGG2cvOmEouN5AZNtWe9vW\nSHl9tv1lWH+0oTjRu6Sq/on9x8am3AE4iD3IemrECFnY+F159O1NV6b6KfHc\n24Tl0xLCnKzy8BVeFcctGUwhpGflx4owu6PDvdIAWyzS+72MH+ZzNdEEieTj\nzqut\r\n=/Yq5\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCbfyovx+Jf1/WtpI+yjqA0Nlc14M40gPYQqwCVvcdq/wIgViMuKheNmRV7Bx6Z2vY9XV64UV7tIixQM4v3kH08+/Q="}],"size":63216,"noattachment":false,"key":"/@hint/hint-x-content-type-options/-/@hint/hint-x-content-type-options-4.0.0.tgz"},"maintainers":[{"email":"antross@gmail.com","name":"antross"},{"email":"John.Emau@microsoft.com","name":"johnatms"},{"email":"amolleda@gmail.com","name":"molant"}],"_npmUser":{"name":"johnatms","email":"John.Emau@microsoft.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hint-x-content-type-options_4.0.0_1589840274391_0.8116775203011215"},"_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":1589840274497,"_cnpm_publish_time":1589840274497,"dist-tags":{"latest":"4.0.23"}}