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(nodejs): detect direct dependencies when using latest version for files yarn.lock + package.json #7110

Merged
merged 3 commits into from
Jul 30, 2024

Conversation

DmitriyLewen
Copy link
Contributor

Description

Correctly detect direct dependencies when using latest version for files yarn.lock + package.json.
See #6747 for more details.

Related issues

Checklist

  • I've read the guidelines for contributing to this repository.
  • I've followed the conventions in the PR title.
  • I've added tests that prove my fix is effective or that my feature works.
  • I've updated the documentation with the relevant information (if needed).
  • I've added usage information (if the PR introduces new options)
  • I've included a "before" and "after" example to the description (if the PR is a user interface change).

@DmitriyLewen DmitriyLewen self-assigned this Jul 8, 2024
@DmitriyLewen DmitriyLewen marked this pull request as ready for review July 8, 2024 09:24
dependencies:
ms "2.1.2"

js-tokens@npm:latest:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is it latest? package.json specifies "js-tokens": "^9.0.0". I thought this line would be js-tokens@^9.0.0.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated this manually to test that new logic worked correctly.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it's better to keep using an original file as much as possible so we can understand how it actually works.

Also, instead of using latest in the package ID, what if we return package patterns somehow and do an exact match? Or, we may want to pass package.json to the yarn lock parser.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's better to keep using an original file as much as possible so we can understand how it actually works.

okay, i will remove this.

Also, instead of using latest in the package ID, what if we return package patterns somehow and do an exact match? Or, we may want to pass package.json to the yarn lock parser.

Hm... i will think about this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

what if we return package patterns somehow and do an exact match

@knqyf263 I implemented your idea. Take a look, when you have time.

@DmitriyLewen DmitriyLewen marked this pull request as draft July 25, 2024 12:00
@DmitriyLewen DmitriyLewen marked this pull request as ready for review July 26, 2024 15:28
@knqyf263 knqyf263 added this pull request to the merge queue Jul 30, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 30, 2024
@DmitriyLewen DmitriyLewen added this pull request to the merge queue Jul 30, 2024
Merged via the queue into aquasecurity:main with commit 54bb8bd Jul 30, 2024
12 checks passed
@DmitriyLewen DmitriyLewen deleted the fix-yarn/latest-version branch July 30, 2024 07:01
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.

Trivy Node scan can't parse package.json when latest is used as a package version
2 participants