Skip to content

Update bundled jQuery to 3.7.1 - #1016

Open
cuong09m wants to merge 2 commits into
LinkStackOrg:mainfrom
cuong09m:oss-agent/995
Open

cuong09m wants to merge 2 commits into
LinkStackOrg:mainfrom
cuong09m:oss-agent/995

Conversation

@cuong09m

Copy link
Copy Markdown

Closes #995

Replaces the bundled assets/js/jquery.min.js (jQuery 3.3.1, flagged by security scanners) with the official jQuery 3.7.1 build from https://code.jquery.com/jquery-3.7.1.min.js, unmodified. Its SHA-256 matches the published SRI hash: sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=.

Scope: one file. The pages that load it (linkstack, studio/edit-link, url-validation) don't use any API that was removed or changed between 3.3.1 and 3.7.1. Checked: self-closing tag HTML (3.5 htmlPrefilter change), .size(), $.trim, .bind/.delegate, $.isArray.

Testing: loaded the new file in jsdom and checked the version string, ready, click/trigger, addClass, val, attr, css, each, find, and that $.ajax exists. All passed.

Not changed (possible follow-ups): other bundled jQuery copies are still old and may also be flagged:

  • assets/external-dependencies/jquery-1.11.1.min.js, jquery-1.12.4.min.js, jquery-3.4.1.min.js, jquery.slim.min.js (3.5.1)
  • assets/button-editor/js/jquery-1.7.js
  • assets/linkstack/js/jquery.min.js (3.6.0)
  • assets/js/core/libs.min.js (bundles 3.6.1)
  • themes/PolySleek/extra/custom-assets/jquery.min.js (3.6.0)

AI disclosure: this change was prepared, reviewed and tested with AI assistance (Claude and Codex).

Security scanners flag the bundled jQuery 3.3.1 (LinkStackOrg#995).
Replace assets/js/jquery.min.js with the official 3.7.1 build:
https://code.jquery.com/jquery-3.7.1.min.js
sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=

Pages loading this file (linkstack, edit-link, url-validation)
use no APIs removed or changed between 3.3.1 and 3.7.1.
Other bundled copies (1.x, 3.4.1, slim, libs.min.js, PolySleek)
are left for a separate change.
@JulianPrieber

Copy link
Copy Markdown
Member

Ii think we may want to confirm we use/update every instance of jQuery to the latest version

Address LinkStackOrg#995 across standalone copies using unmodified code.jquery.com
full and slim distributions.

Files before -> after:
- assets/external-dependencies/jquery-3.4.1.min.js -> jquery-3.7.1.min.js
  (full 3.4.1 -> 3.7.1).
- assets/external-dependencies/jquery.slim.min.js: slim 3.5.1 -> 3.7.1.
- assets/linkstack/js/jquery.min.js: full 3.6.0 -> 3.7.1.
- themes/PolySleek/extra/custom-assets/jquery.min.js: full 3.6.0 -> 3.7.1.
- resources/views/components/config/config.blade.php:498,
  resources/views/installer/installer.blade.php:244 and
  resources/views/linkstack/modules/block-libraries.blade.php:23:
  jquery-3.4.1.min.js -> jquery-3.7.1.min.js.
- resources/views/vendor/env-editor/layout.blade.php:25:
  replace slim 3.5.1 SRI with the slim 3.7.1 SHA-384.
- resources/views/panel/config-editor.blade.php:189:
  jquery-1.11.1.min.js -> jquery-3.7.1.min.js; retain the 1.11.1 file.

SHA-256 (base64):
Full: /JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=
Slim: kmHvs0B+OpCW5GVHUNjv9rOmY0IvSIRcf7zGUDTDQM8=
Slim SHA-384: 5AkRS45j4ukf+JbWAfHL8P4onPA9p0KwwP7pUdjSQA3ss9edbJUJc/XcYAiheSSz

Compatibility audit (paths under resources/views unless noted):
- components/config/config.blade.php:501-508 uses ready/on/scrollTop;
  installer/installer.blade.php:247-258 uses change/val/hide/show.
- linkstack/modules/block-libraries.blade.php:23 only loads the library;
  linkstack/modules/admin-bar.blade.php:15-21 uses ready/click/toggle.
  User-authored custom HTML cannot be audited from repository sources.
- vendor/env-editor/index.blade.php:68-70 uses append/Bootstrap alert;
  :91 uses fetch; components/_itemModal.blade.php:107,132 uses modal.
  No Ajax/effect dependency on slim, removed APIs or self-closing
  non-void HTML tags found in the audited page scripts/includes.
- themes/PolySleek/extra/custom-body-end.blade.php:38,41,44 uses event
  shorthands; :53 uses animate; :147 uses $.trim, all retained in 3.7.1.
- panel/config-editor.blade.php:198-220 uses on/attr/tab/scroll/animate;
  assets/external-dependencies/bootstrap.min.js:2 identifies v3.2.0;
  :6 has no jQuery upper-version restriction or removed API calls.
  Its modal .load takes a URL, not an event handler. Switch this page
  to full 3.7.1 without application changes; browser checks remain.

Keep assets/js/jquery.min.js at 3.7.1. Leave assets/js/core/libs.min.js
(3.6.1 combined bundle) for a rebuild; do not splice vendor code.
Keep button-editor 1.7 ($.browser/.size dependencies), external 1.12.4
(iframe .load(handler)), unused button-editor/jquery.js and 1.11.1.

Checks: official-byte/SHA-256 comparisons, slim SRI, node --check,
protected-file byte comparisons with parent and origin/main,
git diff --check, and no git grep matches for jquery-3.4.1.
@cuong09m

Copy link
Copy Markdown
Author

Thanks! I pushed a follow-up commit that updates every standalone jQuery 3.x copy to the official 3.7.1 build (unmodified, SHA-256 matches the published SRI):

File Before After
assets/js/jquery.min.js 3.3.1 3.7.1 (first commit)
assets/external-dependencies/jquery-3.4.1.min.js 3.4.1 renamed to jquery-3.7.1.min.js; config, installer and block-libraries views updated
assets/external-dependencies/jquery.slim.min.js 3.5.1 slim 3.7.1 slim; integrity in vendor/env-editor/layout.blade.php updated
assets/linkstack/js/jquery.min.js 3.6.0 3.7.1
themes/PolySleek/extra/custom-assets/jquery.min.js 3.6.0 3.7.1
panel/config-editor.blade.php loaded 1.11.1 now loads 3.7.1 (Bootstrap 3.2 tabs tested with it)

I left these alone on purpose, because upgrading them would break existing code or needs a rebuild:

  • assets/button-editor/js/jquery-1.7.js: the button editor uses $.browser (utils.js:208) and .size() (layout.js:7), both removed, plus an old jQuery UI build.
  • assets/external-dependencies/jquery-1.12.4.min.js: studio/links.blade.php:348 and studio/theme.blade.php:181 use .load(fn) as an event handler, which was removed in 3.0.
  • assets/js/core/libs.min.js: jQuery 3.6.1 is re-minified inside this bundle together with other libraries, so it should be rebuilt from source rather than patched.
  • assets/button-editor/js/jquery.js: a very old copy that nothing seems to load; it could probably be deleted.

Happy to do the 1.x pages (switch .load(fn) to .on('load', fn), replace $.browser/.size()) in a separate PR if you'd like.

Testing: each updated file loaded in jsdom (version, events, DOM and attribute ops, $.ajax present in full and absent in slim), SRI checked, plus Bootstrap 3.2 tabs from config-editor with 3.7.1. Not tested in a real browser.

AI disclosure: prepared, reviewed and tested with AI assistance (Claude and Codex), like the first commit.

This branch has not been deployed

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

Labels

None yet

2 participants