Skip to content

fix(validation): flag empty or missing package name as invalid (#850, #885) - #910

Open
ShivanshhhG wants to merge 1 commit into
spdx:mainfrom
ShivanshhhG:fix-850-package-name-validation
Open

ShivanshhhG wants to merge 1 commit into
spdx:mainfrom
ShivanshhhG:fix-850-package-name-validation

Conversation

@ShivanshhhG

Copy link
Copy Markdown

Summary

Per clause 7.1 of the SPDX specification (Package Name), package name is a mandatory field for every package. Previously, validate_package in package_validator.py verified other fields (download location, checksums, verification codes), but did not check whether package.name was populated. As reported in #850 and #885, a package with a missing, empty (""), or whitespace-only name passed validation without raising an error.

Changes

  • In package_validator.py (validate_package): check if package.name is None or not str(package.name).strip(), and emit an actionable ValidationMessage when empty.
  • In test_package_validator.py: added parametrized unit test test_invalid_package_name verifying that empty strings, spaces, and whitespace triggers the expected validation error.

Fixes #850
Fixes #885

, spdx#885)

Per clause 7.1 of the SPDX specification, package name is a mandatory
field. Previously, package_validator.py only validated download_location,
homepage, checksums, etc., but did not check whether package.name is
present and non-empty. This allowed packages with missing, empty, or
whitespace-only names to pass validation undetected.

Validate that package.name is non-empty and emit an actionable
ValidationMessage if it is missing or blank. Add unit test coverage in
test_package_validator.py.

Fixes spdx#850
Fixes spdx#885

Signed-off-by: SHIVANSH-ux-ys <singaser78@gmail.com>

This branch has not been deployed

No deployments
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.

Package without a name is not flagged as invalid Empty package name not detected despite being required

1 participant