Repository navigation
Update Vite to 8.3.5 and the admin panels' jQuery to 3.7.1 - #980
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #(none — Dependabot alerts 208–211 and 232–237)
Type: bugfix
Two dependency updates for the vulnerabilities GitHub reports on the default branch: Vite (build tooling) and the jQuery the Admin, Store and Vendor panels run.
Issue
Vite
Both frontend projects,
src/Web/Grand.Web/vueapp(storefront) andsrc/Web/Grand.SharedUIResources/adminapp(Admin, Store and Vendor panels), build with Vite 8.3.2. Vite 8.3.0–8.3.2 bundles alaunch-editoraffected by three advisories, all on Windows: thefs.existsSync()existence check can be bypassed (high), editor CLI flags can be misread into running a command (moderate), andescapeCmdArgs()does not escape%(moderate).They are reachable only through the Vite dev server (
npm run dev, "open in editor" from the browser) on a developer machine. Production serves the prebuilt bundles and contains no Vite code.jQuery
The Admin, Store and Vendor panels load
wwwroot/administration/build/js/jquery.min.js, which is jQuery 2.2.4. It is affected by the known jQuery XSS advisories fixed in 3.0, 3.4 and 3.5 (CVE-2015-9251, CVE-2019-11358, CVE-2020-11022, CVE-2020-11023): HTML passed to.html(),.append()and$()can run script, and$.extend(true, …)allows prototype pollution. Dependabot reports the same version through thejquerydev dependency ofadminapp(the copy the serializer tests compare against), but the copy the browsers actually run is the vendored file, which Dependabot does not see.jQuery cannot simply be removed: about 300 admin views,
admin.common.js,admin.search.js, the form validation (jquery.validate+ unobtrusive), summernote, elFinder, jQuery UI (autocomplete), magnific-popup, typeahead, tagEditor, fineuploader, farbtastic, daterangepicker and jquery.tmpl depend on it.Solution
Vite
viteraised to^8.3.5(the latest 8.3.x; the advisories are fixed from 8.3.3) in bothpackage.jsonfiles, with the lock files regenerated bynpm install. Both projects rebuilt withnpm run buildand the committed bundles updated. The bundle changes are minifier output only (if/return rewritten as conditional expressions); no source changed. The lock files are generated with npm 11, which keeps thelibcfields npm uses to pick the glibc or musl native bindings of rolldown on Linux.jQuery
build/js/jquery.min.jsreplaced with jQuery 3.7.1 (the npmjquery@3.7.1dist file,sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=, the same as the official CDN SRI).build/js/custom.js:$(window).load(fn)(removed in jQuery 3.0) →$(window).on('load', fn). The block only runs whenNProgressis loaded, which no panel does today.adminapp: thejquerydev dependency raised to^3.7.1(lock file: only the jquery entry changes).param.test.jscompares the grid serializer with jQuery 3, which writes a space as%20where jQuery 2 (and the Kendo transports) wrote+; the serializer keeps+, the tests treat the two as equal (the model binders decode both the same). README updated.Nothing else needed changing. jQuery Migrate 3.5.2 (used only during testing, not shipped) reported no removed API in use; what it reports is deprecated-but-present API (
.bind, event shorthands like.click(),$.isFunction,$.trim,jQuery.expr[':'], mostly inside the vendored plugins), which jQuery 3.7.1 still supports and only jQuery 4 removes. The one behaviour change it flagged,removeAttr('disabled')in daterangepicker, has the same effect in 3.x becausedisabledis a reflected attribute.Breaking changes
.size(),.andSelf(),.load(fn)/.unload(fn)/.error(fn)event aliases,jqXHR.success/error/complete,$(document).on('ready'),.selector) will need updating. None of the shipped plugins or panels uses them.Testing
Vite
cd src/Web/Grand.Web/vueapp && npm ci && npm run lint && npm run build→ lint clean, build succeeds,git statusshows no changes inwwwroot/bundlesbeyond this PR.cd src/Web/Grand.SharedUIResources/adminapp && npm ci && npm run lint && npm test && npm run build→ lint clean, 218 tests passed, build succeeds.node -e "console.log(require('./node_modules/vite/package.json').version)"in both folders →8.3.5.jQuery
Done on a fresh install with sample data (Admin, a store manager and a vendor account), comparing jQuery 2.2.4 with 3.7.1 on the same database:
cd src/Web/Grand.SharedUIResources/adminapp && npm ci && npm test && npm run lint→ 218 tests passed, lint clean.jquery.validate+ unobtrusive);code(), code view) and the elFinder dialog from its "Manage pictures" button;npm run e2e -- --project=en-US --project=foreign-localeagainst the same instance: 49 passed, 13 failed, 1 skipped, and the same 13 fail with jQuery 2.2.4. They click a.dropdown-item(Delete, Copy product, Import) without opening its dropdown first, so they are out of date and unrelated to this change.Unrelated, seen on both jQuery versions and left for a separate change: elFinder thumbnails return HTTP 500 (
MissingMethodExceptionforSixLabors.ImageSharp.Image.Load(Stream, out IImageFormat)inelFinder.Net.Core1.5.0), so the file manager shows no thumbnails; uploading, picking and deleting files work.