Rules

X-Content-Type-Options: nosniff header missing

SR-WEB-004 · Low

Browsers sometimes guess a file's type from its contents instead of trusting the Content-Type header. If users can upload files, or an endpoint returns text you do not fully control, that guessing can turn a harmless looking file into a script or a page that runs on your domain. The X-Content-Type-Options: nosniff header turns the guessing off and makes the browser block scripts and stylesheets served with the wrong type. The fix is one header on every response, plus correct Content-Type values for the files you serve.

The fix

Before · Terminal
$ curl -sI https://yourapp.com | grep -i x-content-type-options
$
After · next.config.js
module.exports = {
  async headers() {
    return [
      {
        source: "/(.*)",
        headers: [{ key: "X-Content-Type-Options", value: "nosniff" }],
      },
    ];
  },
};

How ShipReady finds it

shipready url requests your page once and reports when the response has no X-Content-Type-Options header. Findings carry rule ID SR-WEB-004.

Run the check

Terminal
npx @shipmate-agency/shipready url https://yourapp.com

The GitHub Action deeflect/shipready@v0.2.0 scans the repo only, so run this check against your deployed site.

Want a person to check every area and send the fixes as pull requests? Launch Lockdown, $950 once.