Skip to content

SRI hashes changed on multiple libraries yesterday and some SRI hashes are wrong #14210

Open

Description

@ssigwart

Yesterday (2023-07-31), I noticed that the SRI hash for https://cdnjs.cloudflare.com/ajax/libs/vue/3.3.2/vue.global.min.js (https://cdnjs.com/libraries/vue/3.3.2) changed. It used to be sha512-6mO8pNkTyFMzOwbajocp9NbJzQUVV+zBFPZW8pKpIKnjhHYY19ez+tISSNkkvaBsj/nHq/E2FANyg6YlB7A+dQ==. Now it's sha512-twbmYKE2H3LPbArlkbjDppF/XJ+GVTM/RvEceYhFMEl6xi1PF1Q5004mNU8BFp3WKatWanAFKU2SQbdk4PdjXg==.

Also, I noticed that the SRI hash for https://cdnjs.cloudflare.com/ajax/libs/vue/3.3.4/vue.global.prod.min.js is wrong. https://cdnjs.com/libraries/vue/3.3.4 says it should be sha512-pHXx64U1UkFexsKz00jfapuz0FgKq+a+5dBTuitirYVcJzaxPqTbNbCWsUiFyTYVYmHMiql9zLCeod+IpAJUew==. However, https://www.srihash.org/ says it should be sha512-39BSQXI5q1XlvVhLfFRidKG8KM6Tr6VS/XSnNo6N/A0ZXexHCeoUI/s+ulujQy3UREjoLNrMnFat8VI0mMugWA==.

I did some debugging and found these logs:

From that, it looks like version 3.3.2 was published on 5/12, but was updated yesterday at 12:07:49. You can also see that the SRI hashes changed. I'm not sure if it's normal that old packages will be regenerated periodically.

Based on comparing an old copy of vue.global.min.js with the new one, it seems like something changed in the minification process, so different variable names were used.

I searched commits in https://github.com/cdnjs/logs for "update kv-publish". From that, I found several other libraries updated yesterday where the SRI tags changed:

From them, it definitely seems like the issue is that:

  1. Existing versions were regenerated.
  2. If those versions had minified versions, those ended up with their SRI hash changing.

I still don't know if that explains why vue/3.3.4/vue.global.prod.min.js is wrong.

Activity

  1. MattIPv4 commented on Aug 1, 2023

    @MattIPv4
    Member

    Hey!

    It looks like a backfill was run yesterday against a large set of libraries to populate them in new infrastructure -- this backfill was not meant to update the files on the CDN, nor the SRI hashes, as we consider all files on the CDN to be immutable, it was only meant to populate the libraries in the new infrastructure.

    However, due to a bug in the processing logic, that being that the minification dependencies used weren't pinned to a specific version, many of the minified files were regenerated during the backfill processing and the new versions were pushed to the CDN with slightly different contents and new SRI hashes.

    I flagged this internally this morning when I discovered that the backfill had caused SRI hashes to change, and the folks involved in the backfill have put a fix in place to pin the minification dependencies and re-run the backfill again, which should hopefully result in all the changes files and SRI hashes being updated again back to what they were before (this second backfill run is actively processing as we speak, it just takes a while to get through everything).

    I have an open question for the folks running this logic around how we plan to verify that we are back to the state we were in before this backfill was run, so that folks' sites aren't broken with SRI hash mismatches going forward. I will update here as I hear more.

    Apologies to anyone whose site this has broken!

  2. ssigwart commented on Aug 1, 2023

    @ssigwart
    Author

    Thanks for the quick reply, @MattIPv4!

    For verifying the old SRI tags, perhaps you can find any kv-publish.log that was updated yesterday and grab the original SRI hashes from there.

  3. MattIPv4 commented on Aug 1, 2023

    @MattIPv4
    Member

    https://status.cdnjs.com/incidents/j85nrhmbcbc5 has been published to track this as an incident impacting the CDN.

  4. xtuc commented on Aug 1, 2023

    @xtuc
    Member

    Those files are back to normal. I will invalidate the cache globally, please let me know if this fixes the issue for you.

  5. ssigwart commented on Aug 1, 2023

    @ssigwart
    Author

    Thanks, @xtuc.

    For the 3.3.2 update, that did solve it. However, I had to do a hard browser refresh to get the corrected version because it looks like the caching headers allow the browser to reuse the same file for up to 355 days. I think that's going to have lingering effects for users that happened to visit websites in the last day or so and have the incorrect version cached. I don't think there's much that can be done about that though.

    For the 3.3.4 update, https://cdnjs.com/libraries/vue/3.3.4 is showing the correct SRI hash now, but https://cdnjs.com/libraries/vue still has sha512-pHXx64U1UkFexsKz00jfapuz0FgKq+a+5dBTuitirYVcJzaxPqTbNbCWsUiFyTYVYmHMiql9zLCeod+IpAJUew==.

  6. AKHorizon commented on Aug 2, 2023

    @AKHorizon

    still having issue with vue 3.3.4
    https://cdnjs.cloudflare.com/ajax/libs/vue/3.3.4/vue.global.min.js is showing:
    sha512-fcdKKm7U9XeFv9U8RsC9vwQfGoLk2vnUXhFAzJk1bCtWUvNxJP2HaSSW1+RopF16gpk4MLkYFbYukbuQX7e4Ug==

  7. MattIPv4 commented on Aug 2, 2023

    @MattIPv4
    Member

    cdnjs/logs@8a96350 indicates the asset in KV has been rolled back to the prior version and matches the origin SRI hash (cdnjs/logs@46f0f30). I suspect you're still seeing a cached version of the bad state from yesterday?

    @xtuc has there been any thought given to purging the CDN cache as a whole, given how many libraries and files were impacted by this incident? Of course, end-users are going to be suffering from this for roughly a year with the cache headers we have in place, but at least we can clear out any bad responses from the CDN itself?

  8. wh1t3t1p commented on Aug 3, 2023

    @wh1t3t1p
  9. MattIPv4 commented on Aug 3, 2023

    @MattIPv4
    Member

    @xtuc Could you take a look at this? https://github.com/cdnjs/logs/commits/prod/packages/c/codemirror/5.48.4 doesn't have any of the kv-publish logs I'd expect to verify whether the SRI hashes were changed/reverted as part of this incident?

  10. Martin-F commented on Aug 3, 2023

    @Martin-F

    I just ran into this problem, and found this:

    We'll continue to monitor for reports of any hash mismatches, which should be reported in the issue on GitHub

    ...so, here I am.

    My affected code uses https://cdnjs.com/libraries/codemirror/5.38.0:

    URL Expected SHA-256 Current SHA-256
    https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.38.0/codemirror.min.css I8NyGs4wjbMuBSUE40o55W6k6P7tu/7G28/JGUUYCIs= 9T+2aDjQSkwR+EUy1CF0CdcHIcSvYBLTIcE0bIfGRvg=
    https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.38.0/codemirror.min.js /fNlNrKCT1Q8cEd3M2yaup/lkUpN1LQEG109ZPNskYk= GTw5k2DzzSlHiUfE7e9WjJDJYfmRjieIe1laeXbQGFU=
    https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.38.0/mode/xml/xml.min.js QmQ8vh5c1+UzpnyWXYB7nnY1aqpJmXPVkFWtJHJkLnE= G6wKF6cDqgsd/06cqf2ilYycFusA8WE+pnc5K9Q/8LE=
    https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.38.0/mode/javascript/javascript.min.js ylo1K/gUyfpfh6s3tKjY8Q6voK8/TCnx8eZaZeoMldo= 84b94SFsvUq1IsfeaC/aVoLY2KZ5WSx6RabGswnga8s=
    https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.38.0/mode/css/css.min.js YVb7n24DLwrjN0DghcwJYL17MI/X7e3c4EJZr6PwNdY= oc1I6s4YVpw+rzBOMU7PGtwtXfnQrweg0vm7009U+3g=
    https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.38.0/mode/htmlmixed/htmlmixed.min.js CcVYnZJocbbLCyjOo/tA2QEH56hhTBEPZX+che0RYSo= CzgL3sVoqXsZU1T+JHgK8qZnnB3OKdvGcbb+n+KPMkU=
  11. xtuc commented on Aug 4, 2023

    @xtuc
    Member

    Our cdnjs.cloudflare.com main storage got out of sync with the cdnjs/cdnjs git repo, after syncing:

    @Martin-F:

    • cdnjs.cloudflare.com/ajax/libs/codemirror/5.38.0/codemirror.min.css: sha256-I8NyGs4wjbMuBSUE40o55W6k6P7tu/7G28/JGUUYCIs=
    • cdnjs.cloudflare.com/ajax/libs/codemirror/5.38.0/codemirror.min.js: sha256-/fNlNrKCT1Q8cEd3M2yaup/lkUpN1LQEG109ZPNskYk=
    • cdnjs.cloudflare.com/ajax/libs/codemirror/5.38.0/mode/xml/xml.min.js: sha256-QmQ8vh5c1+UzpnyWXYB7nnY1aqpJmXPVkFWtJHJkLnE=
    • cdnjs.cloudflare.com/ajax/libs/codemirror/5.38.0/mode/javascript/javascript.min.js: sha256-ylo1K/gUyfpfh6s3tKjY8Q6voK8/TCnx8eZaZeoMldo=
    • cdnjs.cloudflare.com/ajax/libs/codemirror/5.38.0/mode/css/css.min.js: sha256-YVb7n24DLwrjN0DghcwJYL17MI/X7e3c4EJZr6PwNdY=
    • cdnjs.cloudflare.com/ajax/libs/codemirror/5.38.0/mode/htmlmixed/htmlmixed.min.js: sha256-CcVYnZJocbbLCyjOo/tA2QEH56hhTBEPZX+che0RYSo=

    @AKHorizon:

    • cdnjs.cloudflare.com/ajax/libs/vue/3.3.4/vue.global.min.js: sha512-Wbf9QOX8TxnLykSrNGmAc5mDntbpyXjOw9zgnKql3DgQ7Iyr5TCSPWpvpwDuo+jikYoSNMD9tRRH854VfPpL9A==

    @wh1t3t1p :

    • cdnjs.cloudflare.com/ajax/libs/codemirror/5.48.4/addon/dialog/dialog.min.js: sha256-G+QhvxjUNi5P5cyQqjROwriSUy2lZtCFUQh+8W1o6I0=
    • cdnjs.cloudflare.com/ajax/libs/codemirror/5.48.4/mode/xml/xml.min.js; cphnEddX56MtGJsi1PoCPLds+dlnDj1QQkAlCWeJYDo=

    These libraries SRIs went back to normal. Also, I globally invalidated the cache for them.

  12. wh1t3t1p commented on Aug 4, 2023

    @wh1t3t1p

    thanks for the resolution, much appreciated!

  13. Martin-F commented on Aug 4, 2023

    @Martin-F

    @xtuc can confirm that's fixed for me now, thank you!

  14. 21 remaining items

  15. shatterproof commented on Jun 22, 2024

    @shatterproof

    @jackielii
    Try sha512-9KsixJxn00SQfLkrArzXRFi3QyqP4RyIzYgj2Ho4YJSLEOHS00uhDQdc7dv6N8PS5OsYZWKiY0/7DsZRlcv/DQ== for the integrity attribute.

    @xPaw
    Try sha512-v2CJ7UaYy4JwqLDIrZUI/4hqeoQieOmAZNXBeQyjo21dadnwR+8ZaIJVT8EE2iyI61OV8e6M8PP2/4hpQINQ/g== for the integrity attribute.

    These were calculated using srihash.org.

    For dylanvdmerwe and Kuuchuu's issues the SRIs do match those from the hash calculator, so this is even more concerning since it indicates the files were arriving changed. I checked the SRI currently being returned from cdnjs for moment.min.js 2.30.1 and it is incorrect again.

    @xtuc
    A bunch of SRIs are out of sync again listed in the comments above (and I'm sure many others as well), could you please revisit this? Not sure if they were missed in the first pass or if the bug reoccurred.

    This makes cdnjs unusable unfortunately since we cannot rely on integrity checks if the contents of static files are changing, in addition to many SRIs on site being out of sync. It would be great to see this fixed.

  16. xPaw commented on Nov 26, 2024

    @xPaw
    Contributor

    To this day the site is giving wrong integrity hashes for some scripts.

  17. blazing-panda commented on Jan 16, 2025

    @blazing-panda

    Still having this issue with:

    Failed to find a valid digest in the 'integrity' attribute for resource 'https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.30.1/moment.min.js' with computed SHA-512 integrity 'QoJS4DOhdmG8kbbHkxmB/rtPdN62cGWXAdAFWWJPvUFF1/zxcPSdAnn4HhYZSIlVoLVEJ0LesfNlusgm2bPfnA=='. The resource has been blocked.
    
    Failed to find a valid digest in the 'integrity' attribute for resource 'https://cdnjs.cloudflare.com/ajax/libs/intro.js/7.2.0/intro.min.js' with computed SHA-512 integrity 'TW1wgxbyMD70qUiI6oDIoMb1fjLKF19UKAjJRVPE6lv2pfvpFIGwzhqfjXtGs3zmVREIjS1LmGgqn3GUPzQjCw=='. The resource has been blocked.
    
  18. AllanJard commented on Aug 26, 2025

    @AllanJard

    Just a quick note to say that the moment 2.30.1 hash is still being given incorrectly: https://cdnjs.com/libraries/moment.js .

    <script src="/?url=https%3A%2F%2Fcdnjs.cloudflare.com%2Fajax%2Flibs%2Fmoment.js%2F2.30.1%2Fmoment.min.js" integrity="sha512-hUhvpC5f8cgc04OZb55j0KNGh4eh7dLxd/dPSJ5VyzqDWxsayYbojWyl5Tkcgrmb/RVKCRJI1jNlRbVP4WWC4w==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
    

    Is when is given when clicking on the "script" button, but as noted the hash is wrong. Is there a way to have the site recompute the hashes?

  19. lucciu5 commented on Dec 18, 2025

    @lucciu5

    I am experiencing issues with moment.min.js@2.30.1 having a wrong hash

  20. andrewfrazer03 commented on Jul 24, 2026

    @andrewfrazer03

    Jquery 4.0.0 added to the CDN after the migration has the wrong SRI hash.
    Hash on cdnjs.com:
    sha512-8LENNbXmzI/Gbj+OwXmqR6V4QaUAw0/porPzy1+dQoJqC0JPHedWoe0DDOTL2uHA5XXJyIsPtiMHH86pVlay6A==
    actual:
    sha512-YuCuk5nNmVIUfKROKeV3fpZZ5Vt9vsnq8nExr5JwEJc2r1YDVmDfujcq373eHIzjqdxwCzoKpxngIaAdRUyg3A==

  21. MattIPv4 commented on Jul 27, 2026

    @MattIPv4
    Member

    @andrewfrazer03 thanks for flagging. Does indeed look like that version was published by the new bot: https://github.com/cdnjs/logs/tree/prod/packages/j/jquery/4.0.0

    And I can confirm that we have the wrong SRI hash for it:

    curl -s https://cdnjs.cloudflare.com/ajax/libs/jquery/4.0.0/jquery.min.js | openssl dgst -sha512 -binary | openssl base64 -A 
    YuCuk5nNmVIUfKROKeV3fpZZ5Vt9vsnq8nExr5JwEJc2r1YDVmDfujcq373eHIzjqdxwCzoKpxngIaAdRUyg3A==
    
    curl -s https://api.cdnjs.com/libraries/jquery/4.0.0 | jq '.sri["jquery.min.js"]'
    "sha512-8LENNbXmzI/Gbj+OwXmqR6V4QaUAw0/porPzy1+dQoJqC0JPHedWoe0DDOTL2uHA5XXJyIsPtiMHH86pVlay6A=="
    

    @simonabadoiu any ideas how the bot is ending up with the wrong hash?

    I believe the original bot had a bug where it'd use the hash of the source minified file while storing our own generated minified file, due to a race.

  22. simonabadoiu commented on Jul 28, 2026

    @simonabadoiu

    Hello, Thanks for flagging this, and sorry for the trouble. Thanks Matt for checking as well 🙏

    Checked it out: the hash on api.cdnjs.com (sha512-8LEN…6A==) is the right one. It matches what npm ships in jquery-4.0.0.tgz exactly, so if you've got that in your integrity attribute you're fine and don't need to change anything. The problem was the file itself, not the hash. It looks like the same compression issue we hit in #14305. We re-ingested jquery 4.0.0 on July 21 and R2 has had the correct file since then, but our cache holds files for about a year and it's per-datacenter, so depending on where you are you might still be getting the old bad copy. That's most likely what you saw. We're going to purge the cache for everything we re-ingested so this clears up everywhere.

    One more thing worth mentioning: the re-ingest didn't show up in cdnjs/logs, which made it look like nothing had been republished. Turns out our audit logging writes the same content back to GitHub when the file list hasn't changed, and GitHub just no-ops that, so no commit. We've got a fix for it and will deploy shortly.

    Will update here once the purge is done.

  23. simonabadoiu commented on Jul 28, 2026

    @simonabadoiu

    The cache purge is done.
    @andrewfrazer03 can you confirm on your end? One thing to watch: our headers let browsers hold these files for ~355 days, so you may need a hard refresh to pick up the corrected copy.

  24. MattIPv4 commented on Jul 28, 2026

    @MattIPv4
    Member

    Things look better via curl now:

    curl -s https://cdnjs.cloudflare.com/ajax/libs/jquery/4.0.0/jquery.min.js | openssl dgst -sha512 -binary | openssl base64 -A 
    8LENNbXmzI/Gbj+OwXmqR6V4QaUAw0/porPzy1+dQoJqC0JPHedWoe0DDOTL2uHA5XXJyIsPtiMHH86pVlay6A==
    
  25. AllanJard commented on Jul 28, 2026

    @AllanJard

    The SRI hash for https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.30.1/moment.min.js on this page still appears to be wrong I'm afraid. I've done a hard refresh and a second browser just to make sure.

  26. MattIPv4 commented on Jul 28, 2026

    @MattIPv4
    Member

    @AllanJard that version would have been processed by the old bot many years ago (https://github.com/cdnjs/logs/tree/prod/packages/m/moment.js/2.30.1), and so likely hit the original bug I alluded to that this issue was originally for.

    @simonabadoiu do we have any plans to refresh the SRI hashes we're storing against the actual assets, to clear up leftovers from that bug? I feel like we'd maybe talked about doing that as part of the migration work?

  27. andrewfrazer03 commented on Jul 28, 2026

    @andrewfrazer03

    The cache purge is done. @andrewfrazer03 can you confirm on your end? One thing to watch: our headers let browsers hold these files for ~355 days, so you may need a hard refresh to pick up the corrected copy.

    @simonabadoiu I can confirm Jquery 4.0.0 and other recently updated library script tags copied from cdnjs.com are now working as expected on my end.

  28. simonabadoiu commented on Jul 29, 2026

    @simonabadoiu

    @MattIPv4, @andrewfrazer03 yes, we have a task tracked for refreshing the stored SRIs for old versions affected by that bug. It isn't in flight yet, I'll post here when we start. Thanks for your patience 🙏

  29. rkerr commented on Aug 3, 2026

    @rkerr

    Having run into this myself for jquery 4.0.0 I just wanted to add a little bit more info that may be useful to others. The difference between the two hashes is that one represents the file with a newline at the end (78748 bytes) and one is the same file without a newline (78747 bytes). Although cdnjs is now serving up the version with the newline (the hash starting 8LEN) end user browsers have a reasonable chance of having the version without the newline in their cache. Whilst flushing the cache is an option if you have control over the browser, I found it better to just put both hashes in the script tag for now as that lets the scripts load regardless of what the browser has cached.

    Jquery UI 1.14.2 also has a similar issue, with two different versions with and without a newline at the end.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions