Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions etc/scripts/purl_type_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,3 +254,11 @@ class NamespaceDefinition(PurlComponentDefinition):
),
title="Namespace requirement",
)
valid_values: Optional[list[str]] = Field(
None,
description=(
"Optional set of allowed values for this namespace. If provided, the namespace value"
" MUST be one of these."
),
title="Valid values",
)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we need a set of known values rather than a set of valid values. If implementations are validating that they are receiving only the expected values then adding new values (eg adding Linux Mint) is a breaking change.

9 changes: 9 additions & 0 deletions schemas/purl-type-definition.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,15 @@
"$ref": "#/definitions/prohibited_requirement"
}
]
},
"valid_values": {
"title": "Valid values",
Copy link
Member

Choose a reason for hiding this comment

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

Since we cannot really be exclusive, I would rather could this "known_values"

"description": "Optional set of allowed values for this namespace. If provided, the namespace value MUST be one of these.",
Copy link
Member

Choose a reason for hiding this comment

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

MUST is a problem as I cannot enumerate ALL the known RPM-based distros at all times, so SHOULD would be better. We can also ensure in validation tests that we can return a warning as this would round up the thing nicely.

Copy link
Contributor

Choose a reason for hiding this comment

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

Another aspect to consider here are custom packages you add to an OS image/installation, say you build and install your own, patched version of the kernel. In my eyes, an ideal SBOM scanner should detect that the vendor for this package is not debian/opensuse/... and set the namespace accordingly to gernot-patched or unknown. Not sure if this should explicitly be mentioned in the spec or we simply leave it at SHOULD which would allow this degree of freedom?

"type": "array",
"items": {
"type": "string"
},
"uniqueItems": true
}
},
"allOf": [
Expand Down
2 changes: 1 addition & 1 deletion types-doc/cpan-definition.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The structure of a PURL for this package type is:

- **Requirement:** Required
- **Native Label:** CPAN ID of the author/publisher
- **Note:** `It MUST be written uppercase and is required.`
- **Note:** `It MUST be written uppercase and is required`

## Name definition

Expand Down
6 changes: 5 additions & 1 deletion types/deb-definition.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
"native_name": "vendor",
"case_sensitive": false,
"note": "The namespace is the \"vendor\" name such as \"debian\" or \"ubuntu\". It is not case sensitive and must be lowercased.",
"requirement": "required"
"requirement": "required",
"valid_values": [
"debian",
"ubuntu"
]
},
"name_definition": {
"requirement": "required",
Expand Down
13 changes: 12 additions & 1 deletion types/rpm-definition.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,18 @@
"case_sensitive": false,
"native_name": "vendor",
"note": "The namespace is the vendor such as Fedora or OpenSUSE. It is not case sensitive and must be lowercased.",
"requirement": "required"
"requirement": "required",
"valid_values": [
"redhat",
"centos",
"fedora",
"almalinux",
"rockylinux",
"opensuse",
"oraclelinux",
"amazonlinux",
"azurelinux"
]
},
"name_definition": {
"requirement": "required",
Expand Down