Gathering detailed insights and metrics for @hint/hint-x-content-type-options
Gathering detailed insights and metrics for @hint/hint-x-content-type-options
Gathering detailed insights and metrics for @hint/hint-x-content-type-options
Gathering detailed insights and metrics for @hint/hint-x-content-type-options
💡 A hinting engine for the web
npm install @hint/hint-x-content-type-options
Typescript
Module System
Node Version
NPM Version
Dist files
Updated on Oct 01, 2019
configuration-development-v6.1.1
Updated on Mar 07, 2019
hint-sri-v3.0.5
Updated on Mar 07, 2019
hint-no-vulnerable-javascript-libraries-v2.7.0
Updated on Mar 07, 2019
hint-css-prefix-order-v1.0.2
Updated on Mar 07, 2019
hint-amp-validator-v2.7.0
Updated on Mar 07, 2019
TypeScript (91.49%)
JavaScript (4.96%)
CSS (2.22%)
Handlebars (0.76%)
EJS (0.5%)
HTML (0.06%)
Batchfile (0.01%)
Shell (0.01%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
Apache-2.0 License
3,653 Stars
6,372 Commits
743 Forks
75 Watchers
157 Branches
105 Contributors
Updated on Jul 11, 2025
Latest Version
4.0.23
Package Id
@hint/hint-x-content-type-options@4.0.23
Unpacked Size
141.08 kB
Size
45.67 kB
File Count
17
NPM Version
10.5.0
Node Version
18.19.1
Published on
Aug 29, 2024
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
5
1
X-Content-Type-Options
header (x-content-type-options
)x-content-type-options
requires that all resources are
served with the X-Content-Type-Options: nosniff
HTTP response header.
Sometimes the metadata browsers need to know how to interpret the
content of a resource is either incorrect, not reliable, or absent.
In those cases, browsers use contextual clues that inspect the bytes
of the response to detect the file format. This is known as MIME
sniffing and it is done regardless of the specified
Content-Type
HTTP header sent by servers.
For example, if a browser requests a script, but that script is served
with an incorrect media type (e.g. x/x
), the browser will still detect
the script and execute it.
While content sniffing can be beneficial, it can also expose the web site/app to attacks based on MIME-type confusion leading to security problems, especially in the case of servers hosting untrusted content.
Fortunately, browsers provide a way to opt-out of MIME sniffing by
using the X-Content-Type-Options: nosniff
HTTP response header.
Going back to the previous example, if the X-Content-Type-Options: nosniff
header is sent for the script and the browser detects that it’s a script
and it wasn’t served with one of the JavaScript media types, the script will be blocked.
While modern browsers respect the header mainly for scripts and stylesheets, Chromium uses this response header on other resources for Cross-Origin Read Blocking.
The hint checks if all resources are served with the
X-Content-Type-Options
HTTP headers with the value of nosniff
.
Resource is not served with the
X-Content-Type-Options
HTTP header.
1HTTP/... 200 OK 2 3... 4 5Content-Type: image/png
Script is served with the X-Content-Type-Options
HTTP header
with the invalid value of no-sniff
.
1HTTP/... 200 OK 2 3... 4Content-Type: text/javascript; charset=utf-8 5X-Content-Type-Options: no-sniff
Script is served with the X-Content-Type-Options
HTTP header
with the valid value of nosniff
.
1HTTP/... 200 OK 2 3... 4Content-Type: text/javascript; charset=utf-8 5X-Content-Type-Options: nosniff
Apache can be configured to add headers using the Header
directive.
1<IfModule mod_headers.c>
2 Header always set X-Content-Type-Options nosniff
3</IfModule>
Note that:
The above snippet works with Apache v2.2.0+
, but you need to have
mod_headers
enabled
for it to take effect.
If you have access to the main Apache configuration file (usually called httpd.conf
), you should add
the logic in, for example, a <Directory>
section in that file. This is usually the recommended way as
using .htaccess
files slows down Apache!
If you don't have access to the main configuration file (quite
common with hosting services), add the snippets in a .htaccess
file in the root of the web site/app.
For the complete set of configurations, not just for this rule, see the Apache server configuration related documentation.
You can add this header unconditionally to all responses.
1<configuration> 2 <system.webServer> 3 <httpProtocol> 4 <customHeaders> 5 <add name="X-Content-Type-Options" value="nosniff" /> 6 </customHeaders> 7 </httpProtocol> 8 </system.webServer> 9</configuration>
Note that:
web.config
of your
application.For the complete set of configurations, not just for this rule, see the IIS server configuration related documentation.
This package is installed automatically by webhint:
1npm install hint --save-dev
To use it, activate it via the .hintrc
configuration file:
1{ 2 "connector": {...}, 3 "formatters": [...], 4 "hints": { 5 "x-content-type-options": "error", 6 ... 7 }, 8 "parsers": [...], 9 ... 10}
Note: The recommended way of running webhint is as a devDependency
of
your project.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
no binaries found in the repo
Reason
Found 4/23 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
Project has not signed or included provenance with any releases.
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
64 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More