Skip to content

Compare the strongest integrity metadata when reusing a preload - #13044

Open
annevk wants to merge 2 commits into
mainfrom
preload-integrity-comparison
Open

annevk wants to merge 2 commits into
mainfrom
preload-integrity-comparison

Conversation

@annevk

@annevk annevk commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

A preloaded response can be reused when the consumer's strongest integrity metadata is unordered equal to that of the preload, as only the strongest metadata is used to check integrity. Also check for an empty set rather than "no metadata", which SRI no longer returns.


As a result, a consumer whose integrity metadata only contains unknown algorithms can reuse any preload, as SRI does not check integrity in that case.

From reading their code: Gecko already compares only the strongest metadata, ignoring order. Chromium compares the full parsed metadata, including order. WebKit instead checks the consumer's integrity metadata against the response when it is used.

(See WHATWG Working Mode: Changes for more details.)


/infrastructure.html ( diff )
/links.html ( diff )

Also check for an empty set rather than "no metadata", which SRI no longer returns.
@noamr

noamr commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Also @yoavweiss probably has some fresh recollection of integrity metadata stuff.

@noamr

noamr commented Oct 8, 2026

Copy link
Copy Markdown
Contributor
AI Review

This looks right to me: SRI's parse metadata now returns an (ordered) set of maps, map equality is by value, and Infra's "unordered equal" is subset+superset, which also tolerates the duplicates SRI can currently produce (it uses list append rather than set append — probably worth an SRI issue).

A few things:

  • Nit: the "; or" is on the last list item; it should move to the first one now that you're rewriting both lines.
  • Switching to "is empty" also means a consumer whose integrity contains only unknown algorithms (e.g. md5-…) now matches any preload. That's consistent with SRI's "empty set matches" semantics, but worth calling out and testing.
  • Since SRI no longer stores options at all, is the XXX about issue Note that new commits as well as <picture> et al are licensed under CC0 #116 still accurate as written?
  • Have we considered comparing "get the strongest metadata from set" of each side instead? That would allow reusing a sha384-B preload for a sha256-A sha384-B consumer with identical security.

@annevk annevk changed the title Ignore order when comparing preload integrity metadata Compare the strongest integrity metadata when reusing a preload Oct 13, 2026
@annevk
annevk requested review from noamr and yoavweiss October 13, 2026 12:02
@annevk annevk added normative change security/privacy There are security or privacy implications integration Better coordination across standards needed labels Oct 13, 2026
@noamr

noamr commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Needs implementation bugs, but you can mark chromium as interested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration Better coordination across standards needed normative change security/privacy There are security or privacy implications

Development

Successfully merging this pull request may close these issues.

2 participants