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

Transitive dependency of components in subfolder get detected as components in root. #589

Closed
alimohamad opened this issue May 31, 2023 · 4 comments
Labels
detector:npm The npm detector type:bug Bug fix of existing functionality

Comments

@alimohamad
Copy link

Hello,

Experiencing this interesting bug where given a directory with the following hierarchy:

|-root/
|----package.json
|----package-lock.json
|----src/
|----child/
|--------package.json
|--------package-lock.json
|--------src/

(i.e., a root directory with components managed by a package.json, and a subfolder with its own set of components managed in a separate package.json)

In the event that a vulnerable transitive dependency (let's say, package x) appears in a component in the child directory's set (let's call the parent component A), the component detector seems to group A with all other packages in root that also contain vulnerable transitive dependency x in the bcde-output.json file, with no regard for this difference in directory hierarchy.

Is it possible for this differentiation to be made between levels on component detection? Happy to offer additional context (sorry for the lack of screenshots / examples, this issue is happening in the component detector being leveraged in an internal MSFT tool.)

@melotic
Copy link
Member

melotic commented May 31, 2023

Thanks for the report. Could you open your package-lock.json files and check if lockfileVersion is 3?

My hunch is that because we don't yet support that lockfile version just yet (see #476), they get picked up by our NpmDetector, which just scans package.json files, without root information, and that may be bunching them together under root.

@melotic melotic added type:bug Bug fix of existing functionality detector:npm The npm detector labels May 31, 2023
@alimohamad
Copy link
Author

The lockFileVersion in both is 2.

@JamieMagee
Copy link
Member

@alimohamad can you provide a sample package-lock.json.

@JamieMagee
Copy link
Member

Closing as expected, based on the discussion in #607

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
detector:npm The npm detector type:bug Bug fix of existing functionality
Projects
None yet
Development

No branches or pull requests

3 participants