Festo-se / cyclonedx-editor-validator

Tool for creating, modifying and validating CycloneDX SBOMs.
https://festo-se.github.io/cyclonedx-editor-validator/
GNU General Public License v3.0
21 stars 4 forks source link

Should validate silently overwrite `issues.json`? #193

Closed mmarseu closed 5 months ago

mmarseu commented 6 months ago

When the --report-format option is set to anything but stdout, the validate command requires an output path to write the report file. Currently, this path defaults to issues.json, if the --output option isn't given. Leaving aside the fact that this might not be sufficiently clear to the user, what happens if issues.json already exists?

Expected behavior: As a user I would expect the program to abort with an error message.

Actual behavior: The program silently overwrites issues.json.

To be clear, I'm only talking about the case where there is no --output option. If the user provides a filename, it is their responsibility to ensure they don't overwrite anything important. But an implicitly chosen default value shouldn't lead to overwriting an existing file.

I see two possible solutions:

italvi commented 5 months ago

@mmarseu the reason is that we started with Jenkins being supported and them wanting a JSON with an issues-array, making the name issues.json the most obvious one.

I would also prefer the first solution, as the tool is still in development, i.e. still on 0.y.z, we can be more open regarding breaking changes.