fix: resolve SOC2 security vulnerabilities in dependencies#19
Conversation
Production vulnerabilities fixed (all HIGH/MODERATE): - semver: ^5.5.1 -> ^5.7.2 (CVE-2022-25883, ReDoS) - graphql-request: ^1.8.2 -> ^3.7.0 (fixes node-fetch <=2.6.6 GHSA-r683-j2x4-v87g: forwards secure headers to untrusted sites; GHSA-w7rc-rwvf-8q5r: size option not honored after redirect) - Transitive: minimatch ReDoS, hosted-git-info ReDoS, brace-expansion ReDoS all resolved via updated dependency tree Dev dependency updates: - standard: ^11.0.1 -> ^17.1.2 (fixes ajv, acorn, braces, ansi-regex vulns) - dependency-check: ^3.2.1 -> ^4.1.0 (fixes braces/micromatch/globby vulns) - Update test:deps script for dependency-check v4 API change (--quiet removed, explicit --missing flag required) Code fixes for standard v17 rules: - Remove unnecessary destructuring renames (no-useless-rename) - Change let -> const where variable is never reassigned (prefer-const) Result: npm audit reports 0 vulnerabilities (all deps, including dev)
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
package.json (1)
12-17: Declareengines.nodewith a minimum Node version floor.The package.json has no
enginesfield despite upgrading dependencies with Node requirements. The upgradedstandard@17.1.2requiresnode ^12.22.0 || ^14.17.0 || >=16.0.0, which will cause install/runtime failures on older Node versions. Add anenginesfield (e.g.,"engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }) to declare the minimum supported runtime.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@package.json` around lines 12 - 17, Add an "engines" field to package.json to declare the minimum supported Node version so installs won't fail with newer dependencies (e.g., add "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }); update the package.json JSON object (next to "dependencies" / "devDependencies") to include this "engines" key and ensure the version string matches the requirements of standard@17.1.2.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@index.js`:
- Around line 11-14: Validate and clamp/guard the caller-provided pageSize and
concurrency before they’re used for batching: ensure pageSize is a positive
integer within a safe upper bound (e.g., 1..1000) and concurrency is a positive
integer within a safe upper bound (e.g., 1..50); if values are invalid, fallback
to the default constants (pageSize = 50, concurrency = 5) or throw a clear
error. Apply this validation in the same scope where pageSize and concurrency
are read (before any batching/looping or calls to fetchData or spawn workers),
so downstream code like the batching logic and fetchData calls never receive
non-positive or excessively large values. Use Number.isInteger checks and clamp
or replace values rather than trusting raw inputs.
---
Nitpick comments:
In `@package.json`:
- Around line 12-17: Add an "engines" field to package.json to declare the
minimum supported Node version so installs won't fail with newer dependencies
(e.g., add "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }); update
the package.json JSON object (next to "dependencies" / "devDependencies") to
include this "engines" key and ensure the version string matches the
requirements of standard@17.1.2.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 442931fc-17fc-47c5-ad2e-8af3c6627013
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (2)
index.jspackage.json
jdaison
left a comment
There was a problem hiding this comment.
LGTM but
I checked this branch against master, and there are two separate issues in npm test.
master already fails later because example.js points to https://api.nodesource.com/ncm2/api/v2/graphql, which currently returns 404. That looks like an existing issue, not something introduced here.
This PR does introduce a new earlier failure, though: the updated package-lock.json uses lockfile v3, and universal-module-tree@2.2.0 still expects the older lockfile structure. As a result, npm run test:deps now fails with:
TypeError: Cannot read properties of undefined (reading 'graphql-request')
So I think the dependency update needs one more adjustment before this can be considered safe to merge.
|
Fixed in d530580. I regenerated package-lock.json as npm lockfile v2 so universal-module-tree@2.2.0 can read it again. Verified that npm run test:deps now passes. I also re-checked the separate example.js failure and it remains an existing endpoint/network issue, not part of this change. |
Summary
Resolves all
npm auditvulnerabilities (26 on default branch → 0) to satisfy SOC2 compliance requirements.Production Vulnerabilities Fixed
semver^5.5.1^5.7.2graphql-request^1.8.2^3.7.0node-fetchforwards secure headers to untrusted sitesnode-fetch(transitive)≤2.6.6sizeoption ignored after redirectminimatch(transitive)≤3.1.3hosted-git-info(transitive)<2.8.9brace-expansion(transitive)≤1.1.12npm audit --omit=dev→ 0 vulnerabilities ✅Dev Dependency Updates
standard:^11.0.1→^17.1.2— fixes transitive vulns inajv,acorn,braces,ansi-regexdependency-check:^3.2.1→^4.1.0— fixes transitive vulns inbraces/micromatch/globbynpm audit(all deps) → 0 vulnerabilities ✅Code Changes
Minor fixes required by
standardv17's stricter rules (auto-fixed viastandard --fix):index.js: remove unnecessary destructuring renames (no-useless-rename)index.js:let data→const data(prefer-const)package.json: updatetest:depsscript —dependency-checkv4 removed--quiet, requires explicit--missingflagBackwards Compatibility
graphql-requestv3 maintains the sameGraphQLClientconstructor andclient.request()API as v1 — no changes tolib/graphql.jsrequired.Summary by CodeRabbit