CycloneDX / cyclonedx-cli

CycloneDX CLI tool for SBOM analysis, merging, diffs and format conversions.
https://cyclonedx.org/
Apache License 2.0
297 stars 60 forks source link

Unable to convert from Github Generated SPDX to CycloneDX #370

Open bhafner13 opened 3 months ago

bhafner13 commented 3 months ago

Converting between SPDX (JSON) format to CycloneDX (JSON or XML) does not seem to work. To test it I:

1) Downloaded an SPDX file from Gitub as a sample Firefox 2) Downloaded the latest CLI tool 3) Changed the name of the tool to make it easier to use from the command line 4) I have attached the offending SPDX SBOM 5) Attempted to do the conversion using the following command cyclonedx.exe convert --input-file firefox-ios_mozilla-mobile_5021.spdx --output-file firefox-ios_mozilla-mobile_5021.json --input-format spdxjson 5) The following errors are reported: Unhandled exception: System.IO.FileNotFoundException: Could not find file 'C:\Users\tstUser\Desktop\tstFolder\firefox-ios_mozilla-mobile_5021.spdx'. File name: 'C:\Users\tstUser\Desktop\tstFolder\firefox-ios_mozilla-mobile_5021.spdx' at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options) at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize) at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize) at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize) at System.IO.Strategies.FileStreamHelpers.ChooseStrategy(FileStream fileStream, String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize) at System.IO.File.OpenRead(String path) at CycloneDX.Cli.CliUtils.InputBomHelper(String filename, ConvertFormat format) at CycloneDX.Cli.Commands.ConvertCommand.Convert(ConvertCommandOptions options) at System.CommandLine.Invocation.CommandHandler.GetExitCodeAsync(Object value, InvocationContext context) at System.CommandLine.Invocation.ModelBindingCommandHandler.InvokeAsync(InvocationContext context) at System.CommandLine.Invocation.InvocationPipeline.<>cDisplayClass4_0.<b0>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Builder.CommandLineBuilderExtensions.<>cDisplayClass23_0.<b0>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Builder.CommandLineBuilderExtensions.<>cDisplayClass16_0.<b0>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Builder.CommandLineBuilderExtensions.<>cDisplayClass27_0.<b1>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Builder.CommandLineBuilderExtensions.<>cDisplayClass25_0.<b0>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<b24_0>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Builder.CommandLineBuilderExtensions.<>cDisplayClass22_0.<b0>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Builder.CommandLineBuilderExtensions.<>cDisplayClass11_0.<b0>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<b10_0>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass14_0.<b__0>d.MoveNext()

mtsfoni commented 3 months ago

Stack kind of clearly says it cannot find the file. Could not find file 'C:\Users\tstUser\Desktop\tstFolder\firefox-ios_mozilla-mobile_5021.spdx'.

I assume you triple checked that the file is really there in the right folder and the name is written 100% correctly and so on. Maybe try the absolute path after --input-file

bhafner13 commented 3 months ago

My copy paste was caching a prior error...will send update

Sent from Samsung Galaxy smartphone. Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Michael Tsfoni @.> Sent: Wednesday, May 22, 2024 4:07:40 PM To: CycloneDX/cyclonedx-cli @.> Cc: bruce hafner @.>; Author @.> Subject: Re: [CycloneDX/cyclonedx-cli] Unable to convert from Github Generated SPDX to CycloneDX (Issue #370)

Stack kind of clearly says it cannot find the file. Could not find file 'C:\Users\tstUser\Desktop\tstFolder\firefox-ios_mozilla-mobile_5021.spdx'.

I assume you triple checked that the file is really there in the right folder and the name is written 100% correctly and so on. Maybe try the absolute path after --input-file

— Reply to this email directly, view it on GitHubhttps://github.com/CycloneDX/cyclonedx-cli/issues/370#issuecomment-2125657859, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BIUR5WJXOWRLQJIBYKG5BIDZDT3IZAVCNFSM6AAAAABIDUFDHWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMRVGY2TOOBVHE. You are receiving this because you authored the thread.Message ID: @.***>