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

Utility does not pass a valid SBOM #119

Open
qwelol opened this issue Feb 17, 2025 · 3 comments
Open

Utility does not pass a valid SBOM #119

qwelol opened this issue Feb 17, 2025 · 3 comments
Assignees
Labels
invalid This doesn't seem right working as designed The description indicates the tool is working as designed

Comments

@qwelol
Copy link

qwelol commented Feb 17, 2025

Describe the bug

The value "http://private%20package/" is a valid iri-reference.

Screenshots or output-paste

Problematic part of the SBOM file:

  {
     "type": "library",
     "name": "utils",
     "group": "@mui",
     "version": "5.14.17",
     "bom-ref": "pkg:npm/%40mui/[email protected]?vcs_url=git%2Bhttps%3A//github.com/mui/material-ui.git#packages/mui-utils",
     "author": "MUI Team",
     "description": "Utility functions for React components.",
     "licenses": [
       {
         "license": {
           "id": "MIT"
         }
       }
     ],
     "purl": "pkg:npm/%40mui/[email protected]?vcs_url=git%2Bhttps%3A//github.com/mui/material-ui.git#packages/mui-utils",
     "externalReferences": [
       {
         "url": "https://github.com/mui/material-ui/issues",
         "type": "issue-tracker",
         "comment": "as detected from PackageJson property \"bugs.url\""
       },
       {
         "url": "git+https://github.com/mui/material-ui.git#packages/mui-utils",
         "type": "vcs",
         "comment": "as detected from PackageJson property \"repository.url\" and \"repository.directory\""
       },
       {
         "url": "http://private%20package",
         "type": "website",
         "comment": "as detected from PackageJson property \"homepage\""
       }
     ]
   },

Util output:

Image

Expected behavior

Validation passed

Additional context

At first I thought that the problem was in the sbom file generator, and created a issue for it. Perhaps it will also be interesting

@mrutkows
Copy link
Contributor

mrutkows commented Feb 17, 2025

@qwelol The utility is validating (using a JSON, draft 7 schema validator lib.) against the the JSON schema file published by by the cyclone DX Spec. repo. ... the utility is just reporting the error as returned by the validation library the utility uses when passed a field with:

"format": "iri-reference",

for fun we can look at what IETF says (as it is hard to believe that using the http protocol in your example does not have restrictions for what goes in effectivelt the domain name (or iauthority):

According to IETF docs: https://www.ietf.org/archive/id/draft-ietf-iri-3987bis-13.pdf whose ABNF indicates:

IRI = scheme ":" ihier-part [ "?" iquery ] [ "#" ifragment ]

ihier-part = "//" iauthority ipath-abempty 
                      / ipath-absolute
                      / ipath-rootless
                     / ipath-empty

where:

iauthority = [ iuserinfo "@" ] ihost [ ":" port ]
ihost = IP-literal / IPv4address / ireg-name
ireg-name = *( iunreserved / sub-delims )

and

iunreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" / ucschar
ucschar = %xA0-D7FF / %xF900-FDCF / %xFDF0-FFEF
/ %x10000-1FFFD / %x20000-2FFFD / %x30000-3FFFD
/ %x40000-4FFFD / %x50000-5FFFD / %x60000-6FFFD
/ %x70000-7FFFD / %x80000-8FFFD / %x90000-9FFFD
/ %xA0000-AFFFD / %xB0000-BFFFD / %xC0000-CFFFD
/ %xD0000-DFFFD / %xE1000-EFFFD

sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
/ "*" / "+" / "," / ";" / "="

noting that percent sign is:

x0025

@qwelol
Copy link
Author

qwelol commented Feb 18, 2025

@mrutkows Hmm, i tried to create issue on validation library. But it seems to no longer maintained. Maybe try another tool?

@mrutkows mrutkows added the invalid This doesn't seem right label Feb 19, 2025
@mrutkows mrutkows self-assigned this Feb 19, 2025
@mrutkows
Copy link
Contributor

mrutkows commented Feb 19, 2025

@qwelol

@mrutkows Hmm, i tried to create issue on validation library. But it seems to no longer maintained. Maybe try another tool?

There really is no other library to use and the ABNF shared above suggests the assertion that encoded space chars is valid for an iauthority may not be valid (esp. when using http as a protocol prefix).

@mrutkows mrutkows added the working as designed The description indicates the tool is working as designed label Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right working as designed The description indicates the tool is working as designed
Projects
None yet
Development

No branches or pull requests

2 participants