Frontend audit hardening: pin vulnerable transitive deps via npm overrides#225
Closed
Copilot wants to merge 3 commits into
Closed
Frontend audit hardening: pin vulnerable transitive deps via npm overrides#225Copilot wants to merge 3 commits into
Copilot wants to merge 3 commits into
Conversation
Agent-Logs-Url: https://github.com/Stanzin7/ExtensionShield/sessions/709f9b54-61b6-4aae-9c22-4da3a69dd7bd Co-authored-by: sapnilbiswas <230308982+sapnilbiswas@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Stanzin7/ExtensionShield/sessions/709f9b54-61b6-4aae-9c22-4da3a69dd7bd Co-authored-by: sapnilbiswas <230308982+sapnilbiswas@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix moderate and high npm audit vulnerabilities in frontend
Frontend audit hardening: pin vulnerable transitive deps via npm overrides
Apr 16, 2026
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.
npm run audit:ciwas failing in CI due to frontend dependency vulnerabilities (including transitive packages pulled via the Vite/Vitest toolchain). This PR constrains vulnerable packages infrontendso the audit gate can resolve to patched versions through lockfile regeneration.Dependency security updates (
frontend/package.json)axios→^1.15.0overridesfor vulnerable/flagged packages:axios,follow-redirects,esbuild,vite,vitestpicomatch-related override structure intact and removed duplicate/ambiguous override key usage.Lockfile alignment (
frontend/package-lock.json)Resulting override pattern
{ "overrides": { "axios": "^1.15.0", "follow-redirects": "^1.16.0", "esbuild": "^0.28.0", "vite": "^7.3.2", "vitest": "^3.2.4" } }Original prompt
The
npm run audit:cistep in GitHub Actions workflows is failing becauseviteandvitestdepend on vulnerable versions ofesbuildand other nested dependencies.Please fix these "Moderate" and "High" frontend npm audit vulnerabilities.
Requirements:
frontend/directory (specificallyfrontend/package.jsonandfrontend/package-lock.json).main.py,database.py) or UI React components (.jsx).overridesblock infrontend/package.jsonto force secure versions ofesbuild,vite,vitest, and any other flagged dependencies (likepicomatchandaxiosif applicable) to ensurenpm auditreturns 0 vulnerabilities.npm installinside thefrontendfolder to update thepackage-lock.jsonfile accordingly.npm auditreturns zero vulnerabilities before committing.The following is the prior conversation context from the user's chat exploration (may be truncated):
User: is there a issue with vite in this repo tha the pr are failing audit tests?
Assistant: Yes, there are issues related to
viteand failing audit tests in this repository.Specifically, Issue #112 ("Frontend NPM Dependency Vulnerabilities") was opened because
npm auditidentified vulnerabilities in frontend dependencies.viteandvitestwere flagged with moderate severity vulnerabilities due to their dependency onesbuild.This has caused problems in Pull Requests, notably where the GitHub Actions Security Audit workflow (
npm run audit:ci) failed. In some attempts to fix this vulnerability, PRs encountered further CI failures whenvitewas bumped to a non-existent version (likevite@^7.4.0), breaking thenpm installstep.User: what should we do?
Assistant: To resolve the
viteandesbuildaudit failures, you have a couple of options depending on how you want to proceed:1. Review the Open Pull Request
There is currently an open PR (PR #214) titled "Update idb-keyval version in package.json" where a contributor notes they have "resolved the npm audit vulnerabilities and made the necessary overrides."
npm auditchecks and don't break the frontend build, you can approve and merge it.2. Fix it Manually using NPM Overrides
If the PR isn't ready or you prefer to fix it yourself, the issue stems from
viteandvitestrelying on a vulnerable version ofesbuild. You can force npm to use a patched version ofesbuildvia thepackage.jsonoverrides feature.frontend/package.json.overridesblock to force a secure version ofesbuild(and any other flagged packages likecross-spawnorpicomatch):(Make sure to check the latest stable versions of these packages that contain the security patches).
cd frontend npm install npm auditnpm auditreturns 0 vulnerabilities, commit the updatedpackage.jsonandpackage-lock.jsonfiles to fix the CI workflow.User: if i merge pr 214 will it be ok?
Assistant: Merging PR #214 is not recommended.
Although the author claims it resolves the npm audit issues, a review of the files modified in the PR shows several major red flags:
idb-keyval, but that package isn't even modified in thepackage.json. Furthermore, while the PR adds someoverridesforpicomatchandaxios, it completely misses theesbuildoverride needed to actually fix theviteandvitestvulnerabilities.database.pyandmain.py) by hardcoding paths toPath.cwd() / "data" / .... This overrides the application's existing configuration setup and could break production deployments that rely on environment variables for file paths.ReportDetailPage.jsx,ScanResultsPageV2.jsx,ScannerPage.jsx), making it very risky to merge.What you should do instead:
Close PR #214 and manually apply the correct, minimal fix just for the frontend.
You can do this by adding the following
overridestofrontend/package.jsonyourself:Then run
npm installandnpm auditin thefrontendfolder to safely generate a cleanpackage-lock.jsonwithout introducing unrelated bugs to the rest of your app.User: you create a pr to fix the issue
Assistant: I'm preparing a pull request with the secure depe...
This pull request was created from Copilot chat.