Skip to content

Upgrading lodash 3 to 4

Breaking3.10.1 → 4.18.1Breaking3Security10New5Changed2Fixed1Other3

BreakingUpgrade verdict

3 breaking changes and 10 security fixes.

  • Lodash 4 no longer works in very old browsers such as Internet Explorer 8 and earlier.
  • You can now import a single method without knowing its category folder.
  • Upgrading may require code changes; a migration tool is available.
  • A crafted path could delete properties from built-in JavaScript prototypes; that is now blocked.
Top 5 of 13 that need code or config changes

lodash publishes an official migration guide for version 4. It covers more than the release notes do.

Lodash-migrate ↗
Breaking3
Drops support for old environments, including IE versions below 9.
Simplifies module paths so methods load directly, e.g. require('lodash/bindAll').
bindAllrequire('lodash/bindAll')
Introduces more breaking changes than any prior release; see the changelog and lodash-migrate for migration help.
lodash-migrate
Security10
Fixes prototype pollution in _.unset and _.omit via constructor/prototype path traversal.
_.unset_.omitconstructorprototypebaseSetModerate · CVSS 6.5
Fixes code injection via _.template imports keys, completing the CVE-2021-23337 patch.
_.templateimportsvariablereForbiddenIdentifierCharsimportsKeysFunction()High · CVSS 8.1
Lodash has Prototype Pollution Vulnerability in _.unset and _.omit functions
Moderate · CVSS 6.5
Command Injection in lodash
High · CVSS 7.2
Regular Expression Denial of Service (ReDoS) in lodash
Moderate · CVSS 5.3
Prototype Pollution in lodash
High · CVSS 7.4
Prototype Pollution in lodash
Critical · CVSS 9.1
Prototype Pollution in lodash
High
Regular Expression Denial of Service (ReDoS) in lodash
Moderate · CVSS 6.5
Prototype Pollution in lodash
Moderate · CVSS 6.5