chore/SYNC-263/replace vulnerable request package with axios and add mock tests#297
chore/SYNC-263/replace vulnerable request package with axios and add mock tests#297shannamurry merged 11 commits intomainfrom
Conversation
Summary of ChangesHello @shannamurry, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses critical technical debt and security concerns by replacing the outdated and vulnerable Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request replaces the deprecated request package with axios to resolve a security vulnerability. While this is a positive security improvement, a high-severity path traversal vulnerability was identified where the _transmit function in resourceBase.js does not sanitize the uri parameter, potentially allowing access to unintended API endpoints. Additionally, critical issues exist with the specified versions for axios and form-data in package.json and package-lock.json, which will cause dependency installation to fail. Suggestions for improving error handling and object iteration logic have also been provided.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace request with axios and add comprehensive test mocking
Overview
This PR modernizes the lob-node SDK's HTTP client and test infrastructure to improve security, reliability, and developer experience.
Changes
The request library has been deprecated and contains a critical security vulnerability. This PR migrates all HTTP requests to axios, a modern, actively maintained HTTP client.
Previously, running the test suite required valid Lob API keys, which created barriers for:
The new mock suite using nock intercepts all HTTP requests, allowing the full unit test suite (94 tests) to run without any API keys. This means:
A separate integration test suite runs against the real Lob API to verify actual behavior:
Discovered and fixed a bug where bulk verification endpoints (/bulk/us_verifications, /bulk/intl_verifications) were failing because the SDK sent form-encoded data instead of JSON. The API requires JSON for requests containing nested objects. The SDK now automatically detects arrays of objects and sends JSON with the appropriate Content-Type header.