-
Notifications
You must be signed in to change notification settings - Fork 32
fix: Replace unmaintained useragent with ua-parser-js #595
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
fix: Replace unmaintained useragent with ua-parser-js #595
Conversation
…bility Replaced the deprecated 'useragent' package with 'ua-parser-js' to resolve the 'tmp' package security vulnerability reported by 'npm audit'. - Uninstalled 'useragent' and '@types/useragent'. - Installed 'ua-parser-js'. - Updated 'src/hot-reload/HotReloaderServer.ts' to use 'UAParser' for user agent parsing. - Updated 'src/hot-reload/SignEmitter.ts' to use 'UAParser.IResult' and extract browser information. - Refactored 'specs/SignEmitter.specs.ts' to align with 'ua-parser-js' types and 'SignEmitter' constructor changes.
- Removed 'useragent-ng' entry from 'package-lock.json' by re-generating it. - Included changes to 'typings/webpack-ext-reloader.d.ts' which reflect a more structured type definition, ensuring backward compatibility.
Refactor type declarations in 'typings/webpack-ext-reloader.d.ts' to a more structured format. This change was automatically applied during dependency updates and maintains backward compatibility for the public API.
Hi @vialoh, I've put this PR together to migrate from the unmaintained This change should also resolve the Finally, I also corrected some tangled type definitions that seemed incorrect. This might be related to the problem described in #583. Hope this helps! |
@babel/core 7.26.0 → 7.28.0 @babel/eslint-parser 7.25.9 → 7.28.0 @babel/plugin-transform-regenerator 7.25.9 → 7.28.1 @babel/preset-env 7.26.0 → 7.28.0 @types/chai 4.3.20 → 5.2.2 @types/lodash 4.17.12 → 4.17.20 @types/mocha 10.0.9 → 10.0.10 @types/sinon 17.0.3 → 17.0.4 @types/webextension-polyfill ^0.12.0 → ^0.12.3 @types/ws 8.5.12 → 8.18.1 @typescript-eslint/eslint-plugin 6.21.0 → 8.39.0 @typescript-eslint/parser 6.21.0 → 8.39.0 autoprefixer 10.4.20 → 10.4.21 babel-loader 9.2.1 → 10.0.0 chai 4.5.0 → 5.2.1 copy-webpack-plugin 11.0.0 → 13.0.0 cross-env ^7.0.3 → ^10.0.0 css-loader 6.11.0 → 7.1.2 eslint 8.57.1 → 9.33.0 eslint-config-prettier 9.1.0 → 10.1.8 eslint-plugin-import 2.31.0 → 2.32.0 eslint-plugin-jsx-a11y 6.10.1 → 6.10.2 eslint-plugin-prettier 5.2.1 → 5.5.4 eslint-plugin-react 7.37.2 → 7.37.5 eslint-plugin-react-hooks 4.6.2 → 5.2.0 husky 8.0.3 → 9.1.7 lint-staged 15.2.10 → 16.1.5 mini-css-extract-plugin 2.9.1 → 2.9.3 mocha 10.7.3 → 11.7.1 prettier 3.3.3 → 3.6.2 sinon 17.0.1 → 21.0.0 style-loader 3.3.4 → 4.0.0 ts-loader 9.5.1 → 9.5.2 typescript 5.6.3 → 5.9.2 webpack 5.95.0 → 5.101.0 webpack-cli 5.1.4 → 6.0.1 webpack-sources ^3.2.3 → ^3.3.3 ws ^8.14.2 → ^8.18.3
This commit resolves multiple TypeScript and Webpack-related build errors that appeared after updating dependencies to their latest versions. - Fixes the `OutputNormalized` type error (TS2739) in `manifest.ts` due to stricter types in the latest Webpack. - Resolves the type definition (.d.ts) module resolution error (TS2306) by separating internal types into `internal.d.ts` while maintaining external compatibility. - Adds type definitions for the `source-map-support` package to resolve TS7016. - Modernizes the module export in `index.ts` to use the standard `export default`.
- Migrates the legacy .eslintrc.js to the new eslint.config.js standard (Flat Config). - Remove legacy `.eslintrc.js` and `.eslintignore`. - Add `eslint.config.js` using the Flat Config format.
Hi @vialoh, I’m adding this comment to explain the additional work that was included after the initial PR changes. Updated project dependencies - b03c5de
Resolve build errors after dependency updates - ed8601aThis commit resolves multiple TypeScript and Webpack-related build errors that appeared after updating dependencies to their latest versions.
Migrate to ESLint v9 and Flat Config - 43a2317
Etc.
|
Hello @rushilsrivastava, I hope you don't mind me reaching out directly. As a member of Simplify Jobs Inc., I thought you might be able to provide some guidance. I've submitted a pull request for this repository. This pull request primarily addresses a reported security vulnerability by replacing the unmaintained 'useragent' library with 'ua-parser-js'. Since this is my first contribution here, I'm unsure of the review process. Would you be the right person to review these changes, or could you kindly suggest who might be? Any help would be greatly appreciated. Thank you! |
Checklist
Closes #[ISSUE_NUMBER]
Overview
This PR addresses a reported tmp package security vulnerability by replacing the unmaintained useragent library with ua-parser-js.
Changes
useragent
library:ua-parser-js
library:Motivation
An npm audit report identified a security vulnerability in the tmp package, a dependency of useragent. As useragent is no longer actively maintained, replacing it with a modern and actively maintained alternative like ua-parser-js was necessary to
resolve this issue and enhance the project's security posture.
Impact
Testing
The changes have been successfully built and tested using the following commands:
Summary by cubic
Replaced the unmaintained useragent library with ua-parser-js to fix a security vulnerability and update user agent parsing logic.
Dependencies
Removed useragent and @types/useragent.
Added ua-parser-js and @types/ua-parser-js.
Refactors
Updated HotReloaderServer and SignEmitter to use ua-parser-js for browser info.
Refactored related tests and type definitions for compatibility.