Feed Sign in with OpenID OpenID

Simon Willison’s Weblog

hash. Douglas Crockford: “Any HTML tag that accepts a src= or href= attribute should also be allowed to take a hash= attribute”—to protect against file tampering and (more importantly) provide a truly robust caching mechanism.

11 comments

  1. Can't you do something like that with etags?

    Cristiano Betta - 30th March 2008 18:59 - #

  2. Cristiano, I think the point is that you are giving the hash of the image, css or js in the html link so that the browser can determine whether to do a fetch without any network traffic.

    James Tauber - 30th March 2008 20:41 - #

  3. This is total nonsense, that's exactly what ALL of the existing HTTP caching headers are for.

    It also completely ignores content negotiation by the user-agent. A resource does not map one-to-to to any specific representation, as well he should know.

    Noah Slater - 30th March 2008 21:19 - #

  4. I agree with Noah on caching.
    And for the security part, it can't really be used. For example, the ad systems need to return a different content each time.

    Rik - 30th March 2008 21:47 - #

  5. This adds no security: if whatever corresponds to the hash can be tampered with in transit, then so can the hash itself.

    It also completely ignores how the web works.

    The web is addressed by resource, not content. If you want to refer to the same resource on the web, you use the same URI. (What does that acronym stand for anyway?)

    On the web, whatever the origin server says about a resource is final, not what some link tells you.

    And on, and on, and on...

    This is complete bogus.

    arien - 31st March 2008 07:27 - #

  6. I doubt this will provide more security than https.

    Also imagine changing one page - and then changing all pages that link to it, and so on. Wow, that spreads fast : )

    Concerning cache improvement: enormous number of documents and links in internet seriously questions reliability of short string keys in "hash table" of browser cache. I think conflicts are imminent.

    arty - 31st March 2008 08:52 - #

  7. By the way, HTTP's Content-MD5 header already provides a message integrity check.

    (The last sentence in my previous comment should have read: This is completely bogus. There was a vulgar noun meaning nonsense at the end of that sentence...)

    arien - 31st March 2008 08:56 - #

  8. @arien: The hash is not transmitted by the server but computed by the browser after the download.

    Rik - 31st March 2008 10:13 - #

  9. This adds no security: if whatever corresponds to the hash can be tampered with in transit, then so can the hash itself.

    It adds security in the case where you are linking to material hosted on a different site from your own - which I assumed was the principle use-case for the idea.

    Simon Willison - 31st March 2008 10:57 - #

  10. @Simon How fragile a security method is it though? How often do pages change in very small ways? Dates, incomming links, related links, top headlines? Template change? Something so fragile has no real use.

    As arien pointed out, resources are addressed by identifier, not content, and this proposal breaks some fairly fundamental aspects of WebArch.

    Noah Slater - 31st March 2008 11:28 - #

  11. Hi Simon,

    It adds security in the case where you are linking to material hosted on a different site from your own - which I assumed was the principle use-case for the idea.

    He doesn't seem to be talking about that type of scenario (emphasis mine):

    [...] it gives us confidence that the file that we receive is the one that we asked for, that it was not replaced or tampered with in transit.

    Even if he were talking about the scenario you describe, what added security would there be? And what would happen if the hash doesn't match? Is the user informed of the mismatch? How? What does it mean for the hash not to match? After how many false positives do people just give up on this "feature"?

    arien - 31st March 2008 12:03 - #

Sign in with OpenID

Auto-HTML: Line breaks are preserved; URLs will be converted in to links.

Manual XHTML: Enter your own, valid XHTML. Allowed tags are a, p, blockquote, ul, ol, li, dl, dt, dd, em, strong, dfn, code, q, samp, kbd, var, cite, abbr, acronym, sub, sup, br, pre

A django site