[PAN-11212] release/2.9.0 fix: get npm audit --production to pass - #124
Conversation
npm audit --production to pass
There was a problem hiding this comment.
Pull request overview
Updates the SDK’s HTTP client dependencies to address security/audit findings by removing the deprecated request package and modernizing the axios/lodash versions.
Changes:
- Replaced
requestwithaxiosfor auth token retrieval and API calls. - Updated tests to validate axios request configuration for auth token URL selection.
- Updated dependency versions in
package.json/package-lock.json(axios, lodash) and removedrequest.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
lib/auth.js |
Migrates token request logic from request.post to axios.request. |
lib/api.js |
Migrates generic API call logic from request(...) to axios(...). |
test/auth.test.js |
Updates URL selection tests to spy on axios instead of request. |
package.json |
Removes request, bumps axios and lodash versions. |
package-lock.json |
Reflects dependency graph changes after removing request and bumping packages. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
It appears that the remaining 40 vulnerabilities cannot be fixed without breaking Node 10+ support or test compatibility, and they don't impact the library's functionality or security for end users.
PAN-11212
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Review Summary by QodoReplace request library with axios to fix npm audit vulnerabilities
WalkthroughsDescription• Replace deprecated request library with axios to fix npm audit vulnerabilities • Update axios from 0.21.4 to 1.14.0 and lodash from 4.17.21 to 4.17.23 • Refactor API and auth modules to use axios promise-based API instead of callbacks • Maintain backward compatibility by creating request-like objects for test compatibility • Update dev dependencies (eslint, gh-pages, standard-version) to latest versions Diagramflowchart LR
request["request library<br/>deprecated & vulnerable"]
axios["axios library<br/>v1.14.0"]
apiModule["lib/api.js<br/>refactored"]
authModule["lib/auth.js<br/>refactored"]
tests["test/auth.test.js<br/>updated"]
packageJson["package.json<br/>dependencies updated"]
request -->|"replaced with"| axios
axios -->|"used in"| apiModule
axios -->|"used in"| authModule
apiModule -->|"tested by"| tests
authModule -->|"tested by"| tests
axios -->|"version bump"| packageJson
File Changes1. lib/api.js
|
Code Review by Qodo
|
requestObj.uri was being built by manually appending axiosConfig.params values to a URL via searchParams.append(). This coerces arrays/objects to strings (e.g., arrays become comma-joined, objects become "[object Object]") and will not reflect the actual query string Axios sends.
npm audit --production to passrelease/2.8.0 fix: get npm audit --production to pass
release/2.8.0 fix: get npm audit --production to passrelease/2.9.0 fix: get npm audit --production to pass
PAN-11212
Also see #125