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

Add cdx:maven for Maven ecosystem taxonomy #107

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

skhokhlov
Copy link
Member

@skhokhlov skhokhlov commented Nov 7, 2024

fixes #106

Signed-off-by: skhokhlov <me@skhlv.nyc>
@skhokhlov skhokhlov requested a review from a team as a code owner November 7, 2024 11:20
@jkowalleck jkowalleck changed the title Add Maven ecosystem taxonomy (#106) Add cdx:maven for Maven ecosystem taxonomy Nov 7, 2024
Copy link
Member

@jkowalleck jkowalleck left a comment

Choose a reason for hiding this comment

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

In case the docs are intended to document taxonomy that is already used, I have nothing to add.

In case the taxonomy is still in planning phase, I've added some remarks

| Property | Description |
|----------|-------------|
| `cdx:maven:package:test` | Whether the package is used only within `test` scope for Maven and `test.*` configurations for Gradle. _Boolean value_. If the property is missing, then assume the value to be `false`. May appear once. |
| `cdx:maven:package:projectsAndScopes` | Comma separated list of pairs of project and scope (configuration) names. In case if component is used in multiply scopes for a project, dedicated pair will be used for it. Example value: `project1:scopeA,project1:scopeB,project2:scopeA` |
Copy link
Member

Choose a reason for hiding this comment

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

no need for comma separated. Better go with a multi-use.

Applied, it would be like

{
  "properties": [
  { "name": "cdx:maven:package:projectsAndScope", "value":"project1:scopeA" },
  { "name": "cdx:maven:package:projectsAndScope", "value":"project1:scopeB" },
  { "name": "cdx:maven:package:projectsAndScope", "value":"project2:scopeA" },
]
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I agree, multi-property way is better

@jkowalleck
Copy link
Member

@skhokhlov, are these properties used already? if not, i'd suggest a change - #107 (comment)

@skhokhlov
Copy link
Member Author

These properties are not used yet in CycloneDX plugins.

For cdx:maven:package:projectsAndScopes I also thought about using bom-ref instead of project name. Then it's possible to actually link project to a component from BOM. However, there is problem that bom-ref can be any string and it's not clear then how to split key from the value. As a solution, bom-ref can be encoded. @jkowalleck what of you think about it?

@jkowalleck
Copy link
Member

jkowalleck commented Nov 13, 2024

These properties are not used yet in CycloneDX plugins.

For cdx:maven:package:projectsAndScopes I also thought about using bom-ref instead of project name. Then it's possible to actually link project to a component from BOM. However, there is problem that bom-ref can be any string and it's not clear then how to split key from the value. As a solution, bom-ref can be encoded. @jkowalleck what of you think about it?

Sorry, I do not understand. could you craft an example SBOM?

@skhokhlov
Copy link
Member Author

Sorry, I do not understand. could you craft an example SBOM?

Sure

{
  "bomFormat" : "CycloneDX",
  "metadata" : {
    "component" : {
      "type" : "library",
      "bom-ref" : "bom-ref-root-project-1",
      "name": "root-project-1"
    }
  },
  "components" : [
    {
      "type" : "library",
      "bom-ref" : "bom-ref-sub-project-1",
      "name": "sub-project-1",
      "properties": [
        { "name": "cdx:maven:package:projectsAndScope", "value":"bom-ref-root-project-1:scopeA" },
        { "name": "cdx:maven:package:projectsAndScope", "value":"bom-ref-root-project-1:scopeB" }
      ]
    },
    {
      "type" : "library",
      "bom-ref" : "bom-ref-library-1",
      "name": "library-1",
      "properties": [
        { "name": "cdx:maven:package:projectsAndScope", "value":"bom-ref-sub-project-1:scopeA" },
        { "name": "cdx:maven:package:projectsAndScope", "value":"bom-ref-root-project-1:scopeB" }
      ]
    }
  ],
  "dependencies": [
    {
      "ref": "bom-ref-root-project-1",
      "dependsOn": ["bom-ref-sub-project-1", "bom-ref-library-1"]
    },
    {
      "ref": "bom-ref-sub-project-1",
      "dependsOn": ["bom-ref-library-1"]
    }
  ]
}

Using cdx:maven:package:projectsAndScope we know that bom-ref-library-1 is used in scopeA of project bom-ref-sub-project-1 and scopeB of project bom-ref-root-project-1. Instead of just project names, we have references to component from the SBOM. If we use project name as a key, we cannot certainly link it to a component.

So the question is should we use

{ "name": "cdx:maven:package:projectsAndScope", "value":"bom-ref-sub-project-1:scopeA" }

instead of

{ "name": "cdx:maven:package:projectsAndScope", "value":"sub-project-1:scopeA" },

?

@jkowalleck
Copy link
Member

re: #107 (comment)

I understand, but this seems debatable, especially with https://cyclonedx.org/capabilities/bomlink/ in mind.

I'd suggest omitting cdx:maven:package:projectsAndScope from the taxonomy for now.
This way you have the required cdx:maven:package:test in place soon, and can continue implementing it.

The taxonomy can be extended and modified at any time.
After discussing the cdx:maven:package:projectsAndScope with your community, you can add it later, still.

How does this sound to you?

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.

New namespace for Maven ecosystem proposal
2 participants