mdn / mdn/mdn-http-observatory

SRI test treats same registrable domain + scheme as same origin

Open
#558 0 comments 0 reactions 1 assignee View on GitHub

@caugner is already working on this.

Since Jul 15, 2026.

p1 test: SRI
Dominant language
JavaScript
Stars
141
Forks
34
Avg merge
8h 36m
Merged PRs (30d)
14

Description

What information was incorrect, unhelpful, or incomplete?

The SRI test in subresource-integrity.js uses registrable domain (eTLD+1, via tldts/Public Suffix List) plus scheme to test for equivalent origins, not the actual origin.

src.domain === parse(requests.site.hostname).domain treats any host on the site's registrable domain as a "secure origin":

  • Host too loose: cdn.example.com, evil.example.com, www.example.com all collapse to example.com, so a script from a different subdomain is exempted from the SRI penalty. That's same-site, not same-origin.
  • Port ignored; scheme is only used for the separate "secure scheme" check, not origin identity.

The assumption that controlling a registrable domain implies controlling all its subdomains fails under subdomain takeover and delegated/vendor-hosted subdomains — the cross-origin resources SRI is meant to protect.

What did you expect to see?

Equivalent origin compared as exact scheme + host + port. A different subdomain is a distinct origin.

Do you have any supporting links, references, or citations?
Do you have anything more you want to share?

Raised by the security team: "the tests seem to be using public suffix and scheme to test for equivalent origins. This is not correct." Pre-existing, independent of the protocol-relative-URL work on 464-protocol-relative-urls-with-https.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.