usnistgov/oscal-cli

Converting from Json to XML fails for SAR

Telos-sa opened this issue · 8 comments

Describe the bug

When attempting to convert SAR json file into XML, error occurs when converting from json to XML.
Command:
oscal-cli ar convert --to xml /Users/13503/Downloads/SAR.json SAR.xml

Error:
Skipping unhandled top-level JSON field 'assessment-results'.
java.io.IOException: Failed to find root field 'assessment-plan'.

Error indicates that it may be trying to reference the assessment plan instead of the assessment results.

Who is the bug affecting

Anytime running the oscal-cli to convert a SAR.

What is affected by this bug

Tooling & API

How do we replicate this issue

Generate a json SAR. Use the oscal-cli to convert from json to xml.

Expected behavior (i.e. solution)

Conversion from SAR.json to SAR.xml

Other comments

No response

At first glance, this is a duplicate of #96 and should be in this repo. I will move it there in the time being.

This was addressed in #96 but apologies for the delays. I am currently trying to forward a pre-release (SNAPSHOT in Maven terms) into a full release as of Friday and this morning. In the meantime, you can very this bug is fixed with the pre-release here?

https://oss.sonatype.org/content/repositories/snapshots/gov/nist/secauto/oscal/tools/oscal-cli/cli-core/0.3.3-SNAPSHOT/

That's ... odd. Let me test locally and see if the wrong build was uploaded. But that was the whole point of this release and I thought I verified this with another community contributor recently. So can you pull down develop branch of this repo and try the following?

cd path/to/git/repos
https://github.com/usnistgov/oscal-cli.git -b develop # The last part is important.
cd oscal-cli
git submodule update --init --recursive
mvn clean install # You'll need a recent version of Maven for this important part.
# To run on Linux or macOS:
./cli-core/target/cli-core-0.3.3-oscal-cli/bin/oscal-cli ar convert --to xml /Users/13503/Downloads/SAR.json SAR.xml
# To run on Windows:
cli-core/target/cli-core-0.3.3-oscal-cli/bin/oscal-cli.bat ar convert --to xml /Users/13503/Downloads/SAR.json SAR.xml

OK, it seems I caused some build weirdness and inappropriately shifted some commits. Can you test this snapshot release?

https://oss.sonatype.org/content/repositories/snapshots/gov/nist/secauto/oscal/tools/oscal-cli/cli-core/0.3.3-SNAPSHOT/cli-core-0.3.3-20230417.204512-18-oscal-cli.zip

Also, now that I found where I made some of those mistakes in the develop branch, updated it, fixed the release tag, and pushed out the release. There is a release notification forthcoming. #108 and #96 have associated unit tests that run during the build, thus I scratched my head.

Thanks for calling this discrepancy out at exactly the correct time! :-)

OK, release out, sorry for the delays on this too everyone involved. Feel free to reopen this issue if it is not fixed.

https://github.com/usnistgov/oscal-cli/releases/tag/v0.3.3