SK-2868 dependency upgrades (#702)#704
Open
skyflow-bharti wants to merge 2 commits into
Open
Conversation
* SK-2868 dependency upgrades
|
✅ Gitleaks Findings: No secrets detected. Safe to proceed! |
1 similar comment
|
✅ Gitleaks Findings: No secrets detected. Safe to proceed! |
|
Semgrep Findings: Issues with Error level severity are found (Error is Highest severity in Semgrep), Please resolve the issues before merging. |
1 similar comment
|
Semgrep Findings: Issues with Error level severity are found (Error is Highest severity in Semgrep), Please resolve the issues before merging. |
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.
Dependencies in
skyflow-jshad accumulated significant version debt — several runtimepackages were multiple major versions behind (
framebusv4→v6,inject-stylesheetv2→v7,jwt-decodev3→v4 EOL,mimev3→v4), two production dependencies (jquery,jquery-mask-plugin) had zero import references anywhere in the source tree, and thetest infrastructure was frozen at Jest 27 / jsdom 16. Running
npm auditagainst the oldlockfile flagged multiple vulnerabilities including two CRITICAL findings in
handlebars(JS Injection + Prototype Pollution, pulled in transitively by Jest 27) andHIGH ReDoS findings in
cross-spawnandsemver(pulled in by ESLint 7).GOAL
Bring all dependencies to their current supported versions within the 14-day cooling
period policy, eliminate the two unused production packages (
jquery,jquery-mask-plugin)along with their types, migrate all source call sites to the breaking APIs introduced by
framebusv6,inject-stylesheetv7, andjwt-decodev4, fix all test suite failurescaused by Jest 27→30 / jsdom 16→26 breaking changes, and restore the framebus singleton
pattern that was inadvertently lost in the class-based v6 API.
Changes
Production runtime (
dependencies)framebus4.0.56.0.5inject-stylesheet2.0.07.0.2injectWithAllowlistAPImime3.0.04.1.0core-js3.44.03.49.0lodash4.17.214.18.1jwt-decode3.1.2^4.0.0jquery3.7.1jquery-mask-plugin1.14.16Dev tooling — upgraded
typescript4.9.56.0.3jest+jest-environment-jsdom27.5.1/ —30.4.2/^30.4.1@types/jest27.5.230.0.0@typescript-eslint/eslint-plugin4.33.07.18.0@typescript-eslint/parser4.33.07.18.0eslint7.32.08.57.1eslint-config-airbnb-base14.2.115.0.0eslint-config-airbnb-typescript14.0.218.0.0@babel/*(6 packages)7.27.x–7.28.x7.29.7babel-loader9.2.110.1.1compression-webpack-plugin8.0.112.0.0fork-ts-checker-webpack-plugin6.5.39.1.0html-webpack-plugin5.6.35.6.7node-polyfill-webpack-plugin2.0.14.1.0webpack5.100.25.107.2webpack-bundle-analyzer4.10.25.3.0webpack-cli4.10.07.0.3webpack-dev-server4.15.25.2.4webpack-manifest-plugin4.1.16.0.1webpack-merge5.10.06.0.1@types/mime3.0.44.0.0@types/node14.18.6325.9.1@types/jquery-mask-plugin1.14.6Source changes
framebusv4 → v6 — singleton consolidation (src/libs/bus.ts+ 16 files)v4 exported a singleton instance; v6 exports the
Framebusclass. All 16 consuming fileswere updated to
new Framebus(), which created 17 independentwindow.messagelistenersand silently broke
Bus.teardown(). Fixed by exporting a single shared instance(
framebusInstance) fromsrc/libs/bus.tsand replacing everyimport Framebus / new Framebus()pair across the codebase withimport { framebusInstance as bus }, restoring the v4 singleton behaviour.Also fixed a pre-existing bug in
Bus.teardown()wherelistener.handlerwas referencedinstead of the stored key
listener.callback, meaning teardown never removed any listeners.jwt-decodev3 → v4 (src/utils/jwt-utils/index.ts)Replaced the default import with the named
jwtDecodeexport introduced in v4.inject-stylesheetv2 → v7 (src/core/internal/frame-element-init.ts,composable-frame-element-init.ts)Updated call sites to the new
injectWithAllowlistAPI.Test infrastructure
Custom jsdom environment (
tests/custom-environment.js) (new)jsdom 20+ makes
window.locationnon-configurable;Object.definePropertyon it throws.Added a custom
JSDOMEnvironmentsubclass that intercepts location redefinitions andredirects them to
history.pushState.Framebus mock (
tests/__mocks__/framebus.js) (rewritten + relocated)Rewrote the manual mock for the v6 class API: exports a constructable
Framebusfunctionwith static
emit/on/off/targetmock methods. AProxyforwards every instanceproperty lookup back to the class so that
jest.spyOn(bus, 'emit')installed on the classis automatically visible to all source-code instances. Moved from repo-root
__mocks__/into
tests/__mocks__/alongside all other test helpers; updatedjest.config.jsonmoduleNameMapperaccordingly.Jest 30 — removed matchers (across all test files)
Replaced all matchers removed in Jest 29/30:
toBeCalled→toHaveBeenCalled,toBeCalledWith→toHaveBeenCalledWith,toBeCalledTimes→toHaveBeenCalledTimes,toThrowError→toThrow.jsdom 26 — non-configurable
window(tests/core/internal/*,tests/index-internal.test.js)jest.spyOn(global, 'window', 'get')throws in jsdom 20+ becausewindowisnon-configurable. Replaced all such patterns with direct property assignment —
window.name = '...',window.history.pushState({}, '', '/?ENCODED'),window.parent.postMessage = jest.fn()— with save/restore inbeforeEach/afterEach.iframe-form.test.jsChanged
targetSpy.mockReturnValue(...)tomockImplementation(opts => { bus.origin = opts?.origin; ... })so
bus.originis set as a side effect ofbus.target({origin}), matching the v4behaviour that
IFrameFormElementrelies on for its focus-event origin guard.threeds.test.jsReplaced the hardcoded jsdom 16 user-agent string with
navigator.userAgentto stayversion-agnostic.