THE GITHTML FIELD GUIDE

Understand a stylesheet blocked by an integrity mismatch

An integrity mismatch means the fetched resource does not match the hash expected by the document. Verify the intended resource version and its provenance before updating the hash. Do not remove integrity checking merely to make an unfamiliar page load; a static reading copy should use reviewed assets whose contents you can account for.

Identify the specific failure

A CDN URL that changes contents can invalidate an old integrity value. The failure may be benign version drift, but it can also signal an unexpected response. The hash check is evidence of a mismatch, not an explanation of its cause.

Make a narrow correction

Compare the requested version, final response, and trusted publisher information. Cross-origin integrity use also interacts with CORS. Keep those checks separate so a hash update does not mask an access problem or an HTML error response.

  1. Identify the expected asset version and inspect the actual fetched response.
  2. Verify provenance before changing an integrity attribute.
  3. Check cross-origin requirements separately and retain the security check for approved remote assets.
text
Review checklist:
- expected version
- final response URL
- trusted resource contents
- matching integrity metadata

Distinguish approved version drift from an unexpected response

Suppose an export references a versioned stylesheet but retains the integrity value from a previous release. The browser retrieves the new bytes and refuses to apply them. Compare the expected release with the trusted publisher's artifact before calculating any replacement value. A mismatch does not tell you whether the new response is the intended upgrade, an intermediary error page, or something untrusted. Updating the hash to match whatever arrived would remove the useful distinction between an approved change and an unexplained one.

Even apparently harmless changes can matter because integrity checks compare resource contents, not a human judgment that two files look equivalent. A different minified build or changed comment can produce another digest. Preserve the exact approved asset and its integrity metadata together. If an export process rewrites CSS after the integrity value was generated, either avoid that transformation for the linked resource or regenerate the metadata through the authorized publication process. Do not retain a stale hash and assume the browser will ignore cosmetic differences.

For a cross-origin resource, examine the CORS arrangement as well as the digest. The markup's cross-origin configuration and the server's authorization response must support integrity checking; a matching hash alone does not make an otherwise unusable response available. Record those checks separately in the diagnostic notes. When the reading copy instead embeds a reviewed style subset, document that it is a new static artifact, not a byte-identical copy of the remote stylesheet. Its correctness then depends on the export review and reading tests rather than on the removed remote resource's integrity attribute.

Verify the repaired artifact

Retest using the exact approved resource bytes. Record the version alongside the artifact so a later refresh can repeat the same verification.

Sources and further reading

AI-assisted writing with source-linked guidance and illustrative examples. Read our editorial approach or report a correction.

All html troubleshooting guides →

Read as MarkdownAll guides

Understand a stylesheet blocked by an integrity mismatch · gitHtml