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

packages updated #1492

Merged
merged 2 commits into from
Nov 14, 2023
Merged

packages updated #1492

merged 2 commits into from
Nov 14, 2023

Conversation

rv0lt
Copy link
Member

@rv0lt rv0lt commented Nov 13, 2023

Read this before submitting the PR

  1. Always create a Draft PR first
  2. Go through sections 1-5 below, fill them in and check all the boxes
  3. Make sure that the branch is updated; if there's an "Update branch" button at the bottom of the PR, rebase or update branch.
  4. When all boxes are checked, information is filled in, and the branch is updated: mark as Ready For Review and tag reviewers (top right)
  5. Once there is a submitted review, implement the suggestions (if reasonable, otherwise discuss) and request an new review.

If there is a field which you are unsure about, enter the edit mode of this description or go to the PR template; There are invisible comments providing descriptions which may be of help.

1. Description / Summary

Updating vulnerable node packages


The vulnerabilities identified by Trivy are:

  • minimatch: 3.04 → 3.0.5
  • request: 2.88.2 → No fixed version
  • semver: 7.0.0 → 7.5.2
  • tough-cookie: 2.5.0 → 4.1.3

To solve the dependencies, running

npm audit --fix

Gives the packages that are needed to update to solve the vulnerabilities:

  • minimatch is fixed by updating serve
    • 13.0.4 → 14.2.1
  • semver is fixed by updating nodemon
    • 2.0.22 → 3.0.1
  • tough cookie is fixed by updating node-sass
    • 7.0.3 → 9.0.0

Perfrom update:

npm install [email protected] [email protected] [email protected] --save-dev

Check for breaking changes:

  1. Re-build the image and execute the suite of tests to check no breaking tests.

  2. Read the changelogs

  • Serve
    • Release notes
    • The breaking change is rewritting the module in TypeScript, serve is used to serve the web. Test manually web functions
  • nodemon
    • Release notes
    • The breaking change is dropping support for node 8 (we use 18 currently)
  • node-sass
    • Release notes
    • Breaking changes are dropping support for node 17 or previous.
  1. Run Trivy scanner again to check that node vuln are fixed

2. Jira task / GitHub issue

https://scilifelab.atlassian.net/jira/software/projects/DDS/boards/13?selectedIssue=DDS-1837

3. Type of change

What type of change(s) does the PR contain?

Check the relevant boxes below. For an explanation of the different sections, enter edit mode of this PR description template.

  • New feature
    • Breaking: Why / How? Add info here.
    • Non-breaking
  • Database change: Remember the to include a new migration version, or explain here why it's not needed.
  • Bug fix
  • Security Alert fix
    • Package update
      • Major version update
  • Documentation
  • Workflow
  • Tests only

4. Additional information

5. Actions / Scans

Check the boxes when the specified checks have passed.

For information on what the different checks do and how to fix it if they're failing, enter edit mode of this description or go to the PR template.

  • Black
  • Prettier
  • Yamllint
  • Tests
  • CodeQL
  • Trivy
  • Snyk

Copy link

codecov bot commented Nov 13, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (9d337f6) 91.48% compared to head (be6d35f) 91.48%.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #1492   +/-   ##
=======================================
  Coverage   91.48%   91.48%           
=======================================
  Files          29       29           
  Lines        4617     4617           
=======================================
  Hits         4224     4224           
  Misses        393      393           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rv0lt rv0lt self-assigned this Nov 13, 2023
@rv0lt rv0lt marked this pull request as ready for review November 13, 2023 15:56
@rv0lt rv0lt requested a review from a team November 14, 2023 08:52
@i-oden
Copy link
Member

i-oden commented Nov 14, 2023

I'm a little confused. Why can't we update the packages that are pop up in the vulnerabilities?
minimatch: 3.04 → 3.0.5
semver: 7.0.0 → 7.5.2
tough-cookie: 2.5.0 → 4.1.3

These package versions aren't changed, only the ones that they depend on? Feels like it should be both in that case? Updating minimatch etc and also serve etc?

@rv0lt
Copy link
Member Author

rv0lt commented Nov 14, 2023

I'm a little confused. Why can't we update the packages that are pop up in the vulnerabilities? minimatch: 3.04 → 3.0.5 semver: 7.0.0 → 7.5.2 tough-cookie: 2.5.0 → 4.1.3

These package versions aren't changed, only the ones that they depend on? Feels like it should be both in that case? Updating minimatch etc and also serve etc?

Because we don't use them directly. They are, instead, used by the other libraries we need.

Packages.json defines the libraries we need for the application to work. Node automatically updates packages-dev which the dependencies for that libraries.

Is the same issue with the pyhton packages and the dependency tree, but in this case node automatically resolves the conflict and tells you what you need to update.
https://umarfarooquekhan.medium.com/difference-between-package-json-and-package-lock-json-6225f83f247c

Example of the output of audit for minimatch
image

@i-oden
Copy link
Member

i-oden commented Nov 14, 2023

I'm a little confused. Why can't we update the packages that are pop up in the vulnerabilities? minimatch: 3.04 → 3.0.5 semver: 7.0.0 → 7.5.2 tough-cookie: 2.5.0 → 4.1.3
These package versions aren't changed, only the ones that they depend on? Feels like it should be both in that case? Updating minimatch etc and also serve etc?

Because we don't use them directly. They are, instead, used by the other libraries we need.

Packages.json defines the libraries we need for the application to work. Node automatically updates packages-dev which the dependencies for that libraries.

Is the same issue with the pyhton packages and the dependency tree, but in this case node automatically resolves the conflict and tells you what you need to update. https://umarfarooquekhan.medium.com/difference-between-package-json-and-package-lock-json-6225f83f247c

Example of the output of audit for minimatch image

Ah ok!

Copy link
Member

@i-oden i-oden left a comment

Choose a reason for hiding this comment

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

I've tested manually and from what I can tell there should be no issues.

@rv0lt rv0lt merged commit 055e7c8 into dev Nov 14, 2023
14 checks passed
@rv0lt rv0lt deleted the DDS-1837-Update-Node-packages branch November 14, 2023 12:40
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