Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix npm audit warnings in NPM package #6437

Merged
merged 5 commits into from
Nov 4, 2022
Merged

Conversation

SiarheiFedartsou
Copy link
Member

@SiarheiFedartsou SiarheiFedartsou commented Nov 1, 2022

Issue

At the moment if I run npm audit in project with installed @project-osrm/osrm it complains about a couple of warnings coming from our package:
Screenshot 2022-11-01 at 21 24 32

The reason of this is dependencies we have in package which actually can be made dev-dependencies as they are only needed for build/test purposes.

Tasklist

Requirements / Relations

Link any requirements here. Other pull requests this PR is based on?

@@ -95,6 +95,7 @@ jobs:
./scripts/format.sh && ./scripts/error_on_dirty.sh
node ./scripts/validate_changelog.js
npm run docs && ./scripts/error_on_dirty.sh
npm audit --production
Copy link
Member Author

@SiarheiFedartsou SiarheiFedartsou Nov 1, 2022

Choose a reason for hiding this comment

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

Will alert if we start having this problem again. Unfortunately it can be quite unexpected: e.g. if vulnerability will be found in version of @mapbox/node-pre-gyp we use and NPM will start reporting it.

Copy link
Member Author

@SiarheiFedartsou SiarheiFedartsou Nov 1, 2022

Choose a reason for hiding this comment

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

--production means "audit only non-dev dependencies". Our dev dependencies have a lot of problems at the moment and it is quite difficult to fix(that's why the fix is to just move problematic dependencies from non-dev to dev)

@@ -4,12 +4,7 @@
"private": false,
"description": "The Open Source Routing Machine is a high performance routing engine written in C++14 designed to run on OpenStreetMap data.",
"dependencies": {
"@mapbox/node-pre-gyp": "^1.0.9",
Copy link
Member Author

Choose a reason for hiding this comment

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

cheap-ruler, mkdirp and rimraf are used in tests only
nan and node-cmake are needed to only build binary and not needed to use package after it

Copy link
Member Author

@SiarheiFedartsou SiarheiFedartsou Nov 1, 2022

Choose a reason for hiding this comment

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

Tbh it would be great to somehow check that package will 100% work without them on some clean test project(even though I am 99% confident that it will work :) ), but not sure how to properly do that.

},
"bundleDependencies": [
Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure why we needed it, but it seems there is no need in it too https://docs.npmjs.com/cli/v8/configuring-npm/package-json#bundledependencies

@SiarheiFedartsou SiarheiFedartsou marked this pull request as ready for review November 1, 2022 20:45
Copy link
Collaborator

@DennisOSRM DennisOSRM left a comment

Choose a reason for hiding this comment

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

👍

@SiarheiFedartsou SiarheiFedartsou merged commit 0ae5190 into master Nov 4, 2022
mattwigway pushed a commit to mattwigway/osrm-backend that referenced this pull request Jul 20, 2023
@DennisOSRM DennisOSRM deleted the sf-npm-audit branch May 3, 2024 12:30
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.

2 participants