Skip to content

"Whitelisting external JavaScript with hashes" incorrectly assumes encoding of sourcesΒ #110

@joelweinberger

Description

@joelweinberger

In Whitelisting external JavaScript with hashs, the spec mentions that if there is integrity metadata on an element, it must match the hash-sources. However, SRI and CSP subtly use different resource bodies to compute digests. SRI computes digests on the raw resources (i.e. applying the digest algorithm to the representation data) while CSP applies digests to an encoded string (as discussed in #109, in practice UAs apply it to the UTF-8 encoding while the specs actually apply it to the UTF-16 encoding).

I'm not sure of the best solution to this since, inherently the integrity metadata is potentially different from the hash source list. We could special case UTF-8/16 encoded resources, but that seems odd. Offhand, it seems like this section isn't possible with how the digests are currently computed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions