Skip to content

fix: resolve critical lodash vulnerabilities (transitive via gitbook-plugin-sharing)#372

Merged
sumn2u merged 3 commits intosumn2u:mainfrom
mhughes2012:fix/lodash-vulnerability
Mar 9, 2026
Merged

fix: resolve critical lodash vulnerabilities (transitive via gitbook-plugin-sharing)#372
sumn2u merged 3 commits intosumn2u:mainfrom
mhughes2012:fix/lodash-vulnerability

Conversation

@mhughes2012
Copy link
Contributor

Description

This PR addresses several critical vulnerabilities identified in lodash (≤ 4.17.20), which is brought in as a transitive dependency via gitbook-plugin-sharing.

Since the plugin is currently unmaintained and hasn't updated its dependencies, I have implemented an overrides block in package.json to force lodash to version ^4.17.21.

Related Issues

Changes

  • Updated package.json with npm overrides.

Verification

  • Ran npm audit locally; critical vulnerabilities related to lodash are now resolved.
  • Verified that GitBook still builds correctly with the overridden version.

- Added npm overrides to force lodash ^4.17.21
- Addresses GHSA-fvqr-27wr-82fm, GHSA-35jh-r3h4-6jhm, and others
- Resolves transitive dependency issues in unmaintained gitbook plugin
@vercel
Copy link

vercel bot commented Mar 9, 2026

@mhughes2012 is attempting to deploy a commit to the Suman Kunwar's projects Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
Copy link

vercel bot commented Mar 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
learn-javascript Ready Ready Preview, Comment Mar 9, 2026 7:26am

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR mitigates known critical lodash vulnerabilities introduced transitively (via gitbook-plugin-sharing) by forcing a safe lodash version through dependency override configuration.

Changes:

  • Added an npm overrides rule to force lodash to ^4.17.21.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

mhughes2012 and others added 2 commits March 8, 2026 20:46
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
add gitbook-plugin-sharing condition

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@mhughes2012
Copy link
Contributor Author

updates made based on copilot's recommendations.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +40 to +44
"overrides": {
"gitbook-plugin-sharing": {
"lodash": "4.17.21"
}
},
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The npm overrides block here only forces lodash for gitbook-plugin-sharing. This repo also uses other GitBook/Honkit plugins that bring in vulnerable lodash versions (e.g., gitbook-plugin-exercises is documented as depending on lodash 3.x in the existing yarn install log), so npm audit may still report lodash advisories when installing with npm. Consider adding a root-level override for lodash (or additional per-plugin overrides) so all transitive lodash copies resolve to >=4.17.21, and re-run npm audit to confirm the advisories are fully cleared.

Copilot uses AI. Check for mistakes.
Comment on lines +40 to 47
"overrides": {
"gitbook-plugin-sharing": {
"lodash": "4.17.21"
}
},
"resolutions": {
"lodash": "^4.17.21"
}
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overrides (npm) and resolutions (Yarn) are both present, but they specify lodash differently (4.17.21 vs ^4.17.21) and the PR description says it forces ^4.17.21. To avoid inconsistent installs across package managers, align these constraints (either both exact or both ranged) and consider documenting/encoding the supported package manager + minimum npm version (since overrides requires newer npm).

Copilot uses AI. Check for mistakes.
Copy link
Owner

@sumn2u sumn2u left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sumn2u sumn2u merged commit ef95e08 into sumn2u:main Mar 9, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Security] Critical Lodash Vulnerabilities via gitbook-plugin-sharing

3 participants