Skip to content

cdx:npm:package:path - #35

Merged
stevespringett merged 1 commit into
CycloneDX:mainfrom
jkowalleck:cdx-npm-component-path
Nov 11, 2022
Merged

cdx:npm:package:path#35
stevespringett merged 1 commit into
CycloneDX:mainfrom
jkowalleck:cdx-npm-component-path

Conversation

@jkowalleck

@jkowalleck jkowalleck commented Nov 9, 2022

Copy link
Copy Markdown
Member

caused by CycloneDX/cyclonedx-node-npm#305


NodeJS's module system is file-system based. It works regardless of package dependencies,
When code in module "foo" tries to use/require/access code from a different module "bar", then node will look in "foo";s own/direct "node_module" folder (depth 1). if it did not find any "bar" there, then node traverses all folders upwards and does the same lookup there, until it finds any "bar".

This file-based loading behavior happens regardless of components' "dependency graph"
To make this loader-environment visible in an SBOM, a property should reflect a modules install path.

It could even happen that an SBOM's component is installed in multiple places.
Therefore, a property should indicate all install locations. This meansthe property could appear multiple times with different values
This way it is possible to answer the question "is this component 'A' actually using component 'B1' or does it load 'B2' instead?"

An alternative would be to have the actual file tree represented as sub-components.
But component flattening or component de-duplication might change these prepared structures, which could lead to information loss.
So a property is preferred.


property value should be a representation of the install-path relative to the root directory of the project under analysis.
no absolute paths, so private data (internal file path structures or mountpoints) are not published.

property value should be posix-like path, regardless of the actual runtime nor input nor detected path-patterns.

to represent the same dir as the root dir, an empty string is expected.


Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
@jkowalleck

jkowalleck commented Nov 9, 2022

Copy link
Copy Markdown
Member Author

@stevespringett @coderpatros @nscuro may i ask for your opinion?
I am not certain how to name the new property. path? installPath? location?

an example for the usage can be seen in the example data generated by https://github.com/CycloneDX/cyclonedx-node-npm/pull/308/files

@stevespringett

Copy link
Copy Markdown
Member

IMO, path or location make sense to me

@jkowalleck

Copy link
Copy Markdown
Member Author

@stevespringett @coderpatros please merge this.
i am happy with current docs

@stevespringett
stevespringett merged commit 32920b6 into CycloneDX:main Nov 11, 2022
@jkowalleck
jkowalleck deleted the cdx-npm-component-path branch June 10, 2023 08:29
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