jquery.js 820 B

123456789101112131415161718192021222324252627282930313233
  1. /**
  2. * Copyright © Magento, Inc. All rights reserved.
  3. * See COPYING.txt for license details.
  4. */
  5. define([], function () {
  6. 'use strict';
  7. /**
  8. * Patch for CVE-2015-9251 (XSS vulnerability).
  9. * Can safely remove only when jQuery UI is upgraded to >= 3.3.x.
  10. * https://www.cvedetails.com/cve/CVE-2015-9251/
  11. */
  12. function ajaxResponsePatch(jQuery) {
  13. jQuery.ajaxPrefilter(function (s) {
  14. if (s.crossDomain) {
  15. s.contents.script = false;
  16. }
  17. });
  18. }
  19. return function ($) {
  20. var majorVersion = $.fn.jquery.split('.')[0];
  21. if (majorVersion >= 3) {
  22. console.warn('jQuery patch for CVE-2015-9251 is no longer necessary, and should be removed');
  23. }
  24. ajaxResponsePatch($);
  25. return $;
  26. };
  27. });