Content-Type & X-Content-Type-Options Auditor avatar

Content-Type & X-Content-Type-Options Auditor

Pricing

Pay per usage

Go to Apify Store
Content-Type & X-Content-Type-Options Auditor

Content-Type & X-Content-Type-Options Auditor

Audit one public URL for Content-Type accuracy, X-Content-Type-Options nosniff, and MIME confusion risk via magic-byte sniffing.

Pricing

Pay per usage

Rating

0.0

(0)

Developer

Sanskar Jaiswal

Sanskar Jaiswal

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

5 days ago

Last modified

Share

Fetches one public URL and inspects its Content-Type header, X-Content-Type-Options header, and magic-byte sniff to detect MIME confusion risk. Returns a readiness score and recommendations. Built for security teams, devops engineers, site migration QA, and frontend platform teams.

Use cases

  • Verify X-Content-Type-Options: nosniff on static assets after a CDN or origin cutover.
  • Detect script or stylesheet responses with a Content-Type that disagrees with the actual bytes.
  • Catch missing or generic Content-Type headers (e.g. application/octet-stream on a JS file) before production deploy.
  • Run scheduled checks on critical resources to catch configuration drift on edge servers.
  • Feed structured results into security QA dashboards or CI pipelines.

Input

FieldTypeDescription
startUrlstringPublic HTTP or HTTPS URL to audit. URLs with credentials and private network targets are rejected.
timeoutSecondsintegerRequest timeout from 3 to 30 seconds. Defaults to 10.
maxBodyBytesintegerMaximum response body bytes to read for magic-byte sniffing. Defaults to 64 KB; capped at 512 KB.

Output

The actor pushes one dataset item per run.

FieldTypeDescription
inputUrlstringOriginal URL from input.
normalizedInputUrlstringNormalized input URL after defaulting the scheme.
finalUrlstringFinal page URL after redirects.
okbooleanTrue when the fetch succeeded.
checkedAtstringISO timestamp for the audit.
httpStatusinteger or nullHTTP status code from the response.
declaredContentTypestring or nullRaw Content-Type header value.
declaredTypestring or nullParsed media type (lowercased, without parameters).
declaredCharsetstring or nullCharset from the Content-Type header, if present.
xContentTypeOptionsstring or nullRaw X-Content-Type-Options header value.
hasNosniffbooleanTrue when X-Content-Type-Options contains nosniff.
sniffedTypestring or nullMagic-byte sniffed media type, or null if unrecognized.
typeMismatchbooleanTrue when the sniffed type conflicts with the declared Content-Type.
confusionRiskstringMIME confusion risk level: low, medium, or critical.
scoreintegerContent-Type readiness score from 0 to 100.
gradestringLetter grade from A to F.
issuesarrayHuman-readable issues.
recommendationsarraySuggested fixes.
errorstring or nullFetch-level error, if the request failed.

Example input

{
"startUrl": "https://example.com/app.js",
"timeoutSeconds": 10
}

Example output

{
"inputUrl": "https://example.com/app.js",
"normalizedInputUrl": "https://example.com/app.js",
"finalUrl": "https://example.com/app.js",
"ok": true,
"checkedAt": "2025-01-01T00:00:00.000Z",
"httpStatus": 200,
"declaredContentType": "application/javascript; charset=utf-8",
"declaredType": "application/javascript",
"declaredCharset": "utf-8",
"xContentTypeOptions": "nosniff",
"hasNosniff": true,
"sniffedType": null,
"typeMismatch": false,
"confusionRisk": "low",
"score": 100,
"grade": "A",
"issues": [],
"recommendations": [
"Content-Type declaration, charset, and X-Content-Type-Options look correct for this resource."
],
"error": null
}

Security

  • Only public HTTP and HTTPS URLs are fetched.
  • URLs with usernames or passwords are rejected.
  • Private IPv4, private IPv6, localhost, link-local, and private DNS resolutions are blocked before fetching.
  • Redirect destinations are revalidated before they are followed.
  • Body reads are capped to limit memory use during magic-byte sniffing.
  • The actor does not require logins, cookies, browser sessions, or credentials.

Pricing

EventSuggested price
Actor start$0.005
URL audited$0.01

Suggested launch price: about $0.015 per audited URL. Teams can schedule the actor for recurring checks on important resources after deploys and CDN cutovers.

FAQ

Does this actor crawl multiple URLs or a whole site?

No. It fetches one URL per run. This keeps runs cheap and predictable for CI and scheduled monitoring.

How does the magic-byte sniff work?

The actor reads the first bytes of the response body and compares them against known file signatures (image, PDF, gzip, WOFF fonts, etc.). It also checks text prefixes for HTML, JSON, XML, and SVG. If the sniffed type disagrees with the declared Content-Type, the actor flags a mismatch.

What makes a risk critical?

A type mismatch on a script or stylesheet resource without X-Content-Type-Options: nosniff is critical, because browsers may execute content with a different type than intended, creating a MIME-sniffing attack vector.

Why is X-Content-Type-Options important?

Without nosniff, browsers may sniff the response body and interpret it as a different type than declared in the Content-Type header. For scripts and stylesheets, this can allow cross-site script execution. nosniff instructs the browser to respect the declared type.

How does the score work?

The score starts at 100 and is reduced for: missing nosniff (-10, -30 for scripts/stylesheets), missing Content-Type (-25), generic application/octet-stream with detectable bytes (-10), type mismatch (-15, -35 for scripts/stylesheets), and missing charset on HTML (-5). The resulting letter grade reflects overall Content-Type posture.