Write NOASSERTION for artifacts resolved from a local repository - #193
Write NOASSERTION for artifacts resolved from a local repository#193arpitjain099 wants to merge 2 commits into
Conversation
Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
|
I think this might need to happen at the SpdxDocumentBuilder level - after the task extension has mutated the object: https://github.com/spdx/spdx-gradle-plugin/blob/main/src/main/java/org/spdx/sbom/gradle/utils/SpdxDocumentBuilder.java#L365 |
Moves the check to after the task extension has had its chance to rewrite the repository URI, and nulls the URI instead of special-casing the download location. The existing null path already emits NOASSERTION and skips the package-manager external reference, so the purl no longer gets a file: repository_url either. Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
|
Moved, thanks. Reading it again you're right, and for a stronger reason than the ordering: the That also fixes something my version missed. Special-casing On placement, it sits right after Now 9 lines in one file. I removed the |
| // An artifact resolved from a local repository (mavenLocal(), or | ||
| // maven { url = uri("file:...") }) has no location a consumer can fetch it from. | ||
| // Its file: URL is neither a valid SPDX download location nor a usable purl | ||
| // repository_url, so treat the repository as unknown: the null path below already | ||
| // renders that as NOASSERTION with no package-manager external reference. |
There was a problem hiding this comment.
This comment is too verbose.
|
Please limit AI generated text as much as possible. Condense what you can where you can either through prompting or human involvement. I should not be exposed to the direct output of your conversation with an LLM. |
Fixes #192.
toDownloadLocationresolves the artifact path against whatever repository URI Gradle reports. FormavenLocal(), or anymaven { url = uri("file:...") }, that is afile:URL, and SPDX 2 does not accept a local path as a download location. Before 0.12.0 the plugin wrote it anyway and produced an invalid SBOM; since 0.12.0 the same value reachessetDownloadLocationand the build fails withInvalidSPDXAnalysisException: Invalid download location, so no SBOM is written at all.A
file:repository now returnsNOASSERTION, next to the existingNOASSERTIONpassthrough in the same method, so the caller inSpdxDocumentBuilderneeds no change.I left the package-manager external ref alone. It still carries
repository_url=file:/...in the purl for these artifacts, which is odd but not what breaks the build, and dropping or rewriting it is a separate decision.URIsTest.toDownloadLocation_localRepositorycovers it and fails on main with anAssertionFailedError../gradlew testand./gradlew spotlessCheckboth pass, run in aneclipse-temurin:21-jdkcontainer.