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

Machine Readable OSCAL Resources by Release #692

Closed
4 tasks
brian-ruf opened this issue Jun 11, 2020 · 9 comments
Closed
4 tasks

Machine Readable OSCAL Resources by Release #692

brian-ruf opened this issue Jun 11, 2020 · 9 comments
Assignees
Labels
Aged A label for issues older than 2023-01-01 enhancement User Story

Comments

@brian-ruf
Copy link
Contributor

User Story:

As an OSCAL tool developer, it would be helpful to have a machine-readable file published by NIST, which enumerates each release of OSCAL, the models available in each release, the resources available for each model (syntax validators, format converters, and release version translators), and the links to those resources.

With a file like this, an OSCAL tool can always know of the latest OSCAL releases, and the current location of each resource for any release. This also also enable NIST to relocate old resources at a later date and make the revised links available to OSCAL tools seamlessly.

Goals:

  • Define format(s) and location for the authoritative reseas/resources tool
  • Define content and structure
  • Compile current releases and resource information into file
  • Incorporate future file updates into the release process (Ideally as part of CI/CD pipeline)

Dependencies:

None

Acceptance Criteria

  • All OSCAL website and readme documentation affected by the changes in this issue have been updated. Changes to the OSCAL website can be made in the docs/content directory of your branch.

  • A Pull Request (PR) is submitted that fully addresses the goals of this User Story. This issue is referenced in the PR.

  • The CI-CD build process runs without any reported errors on the PR. This can be confirmed by reviewing that all checks have passed in the PR.

  • Depending on decisions made while working this issue, there may be an additional model for this. Perhaps as part of the "Governance" Layer described in Issue [EPIC] Adjudication or Governance Model #640.

@david-waltermire david-waltermire added this to the OSCAL 1.1.0 milestone Oct 30, 2020
@david-waltermire david-waltermire modified the milestones: OSCAL 1.1.0, Backlog Jun 7, 2021
@aj-stein-nist aj-stein-nist removed this from the Backlog milestone Jul 27, 2023
@aj-stein-nist
Copy link
Contributor

aj-stein-nist commented Sep 27, 2023

@brian-ruf, this requirements in this request, given the repository reorganization and new release artifacts process, is the GitHub Releases API insufficient and not meet these requirements. Can we close this for now? I can see potential future work in adding model metadata in back-matter to point to those for a given OSCAL version of a document with props, but we will need more feedback. As it stands, it looks like the MVP requirements you were looking for that were missing prior to that change have been met.

@aj-stein-nist aj-stein-nist self-assigned this Sep 27, 2023
@aj-stein-nist
Copy link
Contributor

To track down a potential requirements gap and outstanding questioned posed here, I will mark this as Further Analysis Needed and assign myself to communicate with Brian or other community members. If no follow-up occurs after a time, I will close the issue to be reopened later.

@brian-comply0
Copy link

@aj-stein-nist I don't have enough familiarity with the new spec to say for certain. The two big items from a requirements stand point are:

  • How can a tool query for all valid versions of OSCAL?
  • How can a tool subsequently find the schema validation and converter assets for a known valid version of OSCAL?
    If the API can satisfy both of those questions, I would agree this is essentially addressed.

@aj-stein-nist
Copy link
Contributor

aj-stein-nist commented Oct 6, 2023

OK, @brian-easyd, so GitHub as an official REST and GraphQL API, the former is simpler to understand. If this makes sense what I summarize below, we can refine this issue to document this as the preferred approach in a follow-on ADR. Documentation is in the official GitHub API website. A fun fringe benefit of the previous ADR and communication of not auto-committing finish artifacts like schemas and converters into the git repo but only on tagged releases makes this a bit easier and cleaner because we no longer publish everything exclusively in just a zip file or tarball, you can get assets directly.

So let's look at your questions.

To start for the sake of discussion and because the API responses can be quite large (ironically because of the release notes embedded in them, that is the only significant size of the response payload, I will use an example response downloaded to a file (with the curl utility) and use the jq utility to parse the JSON responses to show my examples. You can write much more idiomatic API client code in the language of your choice, but many commercial and open source tools rely on this as a client, so I think it is better than reinventing wheels. So let's begin, I am going to save that response as a file.

curl -L https://api.github.com/repos/usnistgov/OSCAL/releases | jq | tee github_api_response_usnistgov_oscal.json # use jq without arguments to lazily format the JSON with common pretty-printed style.

I saved it as a file here for you if you have trouble with curl or other alternatives.

How can a tool query for all valid versions of OSCAL?

That is the first step here.

$ cat ~/code/github_api_response_usnistgov_oscal.json | jq .[].tag_name
"v1.1.1"
"v1.1.0"
"v1.0.6"
"v1.0.5"
"v1.0.4"
"v1.0.3"
"v1.0.2"
"v1.0.1"
"v1.0.0-rc2"
"v1.0.0"
"v1.0.0-rc1"
"v1.0.0-milestone3"
"v1.0.0-milestone2"
"v1.0.0-milestone1"
# This is equivalent to:
# curl -L https://api.github.com/repos/usnistgov/OSCAL/releases | jq

We only have tagged releases of "valid versions" and that you get from the GitHub Releases API for free.

How can a tool subsequently find the schema validation and converter assets for a known valid version of OSCAL?

You can inspect each release and pull down the relevant files by API, not just its metadata I can look in the array of releases for each release, look at each array of assets in a release, and pull out the name of the artifacts. We can look at the first ([0] in jq syntax) or all ([] in jq syntax).

$ cat ~/code/github_api_response_usnistgov_oscal.json | jq .[0].assets[].name
"oscal-1.1.1.tar.bz2"
"oscal-1.1.1.zip"
"oscal_assessment-common_metaschema_RESOLVED.xml"
"oscal_assessment-plan_json-to-xml-converter.xsl"
"oscal_assessment-plan_metaschema_RESOLVED.xml"
"oscal_assessment-plan_schema.json"
"oscal_assessment-plan_schema.xsd"
"oscal_assessment-plan_xml-to-json-converter.xsl"
"oscal_assessment-results_json-to-xml-converter.xsl"
"oscal_assessment-results_metaschema_RESOLVED.xml"
"oscal_assessment-results_schema.json"
"oscal_assessment-results_schema.xsd"
"oscal_assessment-results_xml-to-json-converter.xsl"
"oscal_catalog_json-to-xml-converter.xsl"
"oscal_catalog_metaschema_RESOLVED.xml"
"oscal_catalog_schema.json"
"oscal_catalog_schema.xsd"
"oscal_catalog_xml-to-json-converter.xsl"
"oscal_complete_json-to-xml-converter.xsl"
"oscal_complete_metaschema_RESOLVED.xml"
"oscal_complete_schema.json"
"oscal_complete_schema.xsd"
"oscal_complete_xml-to-json-converter.xsl"
"oscal_component_json-to-xml-converter.xsl"
"oscal_component_metaschema_RESOLVED.xml"
"oscal_component_schema.json"
"oscal_component_schema.xsd"
"oscal_component_xml-to-json-converter.xsl"
"oscal_control-common_metaschema_RESOLVED.xml"
"oscal_implementation-common_metaschema_RESOLVED.xml"
"oscal_metadata_metaschema_RESOLVED.xml"
"oscal_poam_json-to-xml-converter.xsl"
"oscal_poam_metaschema_RESOLVED.xml"
"oscal_poam_schema.json"
"oscal_poam_schema.xsd"
"oscal_poam_xml-to-json-converter.xsl"
"oscal_profile_json-to-xml-converter.xsl"
"oscal_profile_metaschema_RESOLVED.xml"
"oscal_profile_schema.json"
"oscal_profile_schema.xsd"
"oscal_profile_xml-to-json-converter.xsl"
"oscal_ssp_json-to-xml-converter.xsl"
"oscal_ssp_metaschema_RESOLVED.xml"
"oscal_ssp_schema.json"
"oscal_ssp_schema.xsd"
"oscal_ssp_xml-to-json-converter.xsl"
# curl -L https://api.github.com/repos/usnistgov/OSCAL/releases |  jq .[0].assets[].name
$ cat ~/code/github_api_response_usnistgov_oscal.json | jq .[].assets[].name
"oscal-1.1.1.tar.bz2"
"oscal-1.1.1.zip"
"oscal_assessment-common_metaschema_RESOLVED.xml"
# Theere is going to be a lot truncated
# curl -L https://api.github.com/repos/usnistgov/OSCAL/releases |  jq .[].assets[].name

You can adapt the name of the asset to url or filter that in code to make a decision, but this is the kind of bread-and-butter DevOps task people often do in shell scripting or Python, we can discuss further based on your feedback.

Our names are computer generated and consistent, so you can write code to filter based on what you want. We can discuss in more in follow-on comments. You can write more complex code to pick a particular version on partial tag_name filter or other criteria (date published, who published, you probably have much better criteria than these examples).

If the API can satisfy both of those questions, I would agree this is essentially addressed.

On that note, let me now how you feel about this thus far.

I will declare up-front: I am strongly inclined to rely on this and not invest limited staff resources in productionalizing a novel API. I guess there could be a way of rigging up something through our static website and storing structured JSON information to emulate a dynamic REST API, but that is going to cause quality and resiliency concerns from my end (pages.nist.gov is not implemented or designed with that in mind).

@Compton-US Compton-US added the Aged A label for issues older than 2023-01-01 label Nov 2, 2023
@brian-comply0
Copy link

@ohsh6o I'm realizing I hadn't responded to this here. I believe we chatted verbally since you posted this. I agree that provided NIST continues to use the GitHub capabilities for published versions, this satisfies the requirement for tools to "know" all valid versions of OSCAL by querying this official source of truth from NIST.

Unfortunately, with the more recent restructuring of the OSCAL repository, it is no longer possible to use this information to get directly to a specific resource. The use case I was targeting is as follows:

  • OSCAL content, such as an SSP, is imported into a tool with a value in the oscal-version field that the tool does not recognize.
  • The tool queries the NIST OSCAL repository to determine if the encountered version is valid.
  • Upon the tool finding that the version is valid, the tool is then able to retrieve and use the syntax validation and converters for that model and version.

With this approach, tools can automatically handle new versions of OSCAL with no human intervention. At least in terms of schema validation and conversion capabilities are concerned.

With the revised repository structure, the above is still possible, only the tool is forced to download and uncompress the entire ZIP file for all models and formats. Often with information the tool doesn't need at all (or at least doesn't need right now). The prior structure allowed a tool to get exactly what it needed. No more and no less.

I'll leave it to the NIST OSCAL Team to decide whether to revert to the old structure to better support this use case. I have to acknowledge that requirement is still satisfied, even if under less efficient circumstances.

@iMichaela
Copy link
Contributor

@brian-comply0 - NIST is publishing all OSCAL assets separately (a total of 48), in addition to the compressed package. Am I missing something in your comment above?
Please see, for example, the latest release, OSCAL v1.1.2:
oscal-1.1.2.tar.bz2
274 KB
last week
oscal-1.1.2.zip
655 KB
last week
oscal_assessment-common_metaschema_RESOLVED.xml
134 KB
last week
oscal_assessment-plan_json-to-xml-converter.xsl
266 KB
last week
oscal_assessment-plan_metaschema_RESOLVED.xml
9.04 KB
last week
oscal_assessment-plan_schema.json
123 KB
last week
oscal_assessment-plan_schema.xsd
311 KB
last week
oscal_assessment-plan_xml-to-json-converter.xsl
230 KB
last week
oscal_assessment-results_json-to-xml-converter.xsl
520 KB
last week
oscal_assessment-results_metaschema_RESOLVED.xml
19.7 KB
last week
oscal_assessment-results_schema.json
130 KB
last week
oscal_assessment-results_schema.xsd
330 KB
last week
oscal_assessment-results_xml-to-json-converter.xsl
404 KB
last week
oscal_catalog_json-to-xml-converter.xsl
162 KB
last week
oscal_catalog_metaschema_RESOLVED.xml
20.5 KB
last week
oscal_catalog_schema.json
42.2 KB
last week
oscal_catalog_schema.xsd
109 KB
last week
oscal_catalog_xml-to-json-converter.xsl
132 KB
last week
oscal_complete_json-to-xml-converter.xsl
1.56 MB
last week
oscal_complete_metaschema_RESOLVED.xml
1.16 KB
last week
oscal_complete_schema.json
212 KB
last week
oscal_complete_schema.xsd
516 KB
last week
oscal_complete_xml-to-json-converter.xsl
1.18 MB
last week
oscal_component_json-to-xml-converter.xsl
167 KB
last week
oscal_component_metaschema_RESOLVED.xml
38.1 KB
last week
oscal_component_schema.json
66.1 KB
last week
oscal_component_schema.xsd
165 KB
last week
oscal_component_xml-to-json-converter.xsl
139 KB
last week
oscal_control-common_metaschema_RESOLVED.xml
20.5 KB
last week
oscal_implementation-common_metaschema_RESOLVED.xml
65.5 KB
last week
oscal_metadata_metaschema_RESOLVED.xml
78.2 KB
last week
oscal_poam_json-to-xml-converter.xsl
385 KB
last week
oscal_poam_metaschema_RESOLVED.xml
11.9 KB
last week
oscal_poam_schema.json
126 KB
last week
oscal_poam_schema.xsd
318 KB
last week
oscal_poam_xml-to-json-converter.xsl
299 KB
last week
oscal_profile_json-to-xml-converter.xsl
175 KB
last week
oscal_profile_metaschema_RESOLVED.xml
29.3 KB
last week
oscal_profile_schema.json
52.6 KB
last week
oscal_profile_schema.xsd
134 KB
last week
oscal_profile_xml-to-json-converter.xsl
147 KB
last week
oscal_ssp_json-to-xml-converter.xsl
301 KB
last week
oscal_ssp_metaschema_RESOLVED.xml
82 KB
last week
oscal_ssp_schema.json
90.6 KB
last week
oscal_ssp_schema.xsd
232 KB
last week
oscal_ssp_xml-to-json-converter.xsl
246 KB
last week
Source code
(zip)
last week
Source code
(tar.gz)
last week

@iMichaela
Copy link
Contributor

@brian-comply0 - If you are referring to the oscal-content, your re correct, we are only releasing today the compressed packages but the release branch exists: release-1.2.1 and it is tagged with the semantic version v1.2.1.
Should you consider necessary for us to publish the NIST maintain content unpackaged, please open an issue on the oscal-content repo for us to track and address your concern .

@brian-comply0
Copy link

@iMichaela you are correct. I missed this when I commented. With that, I agree the issue is satisfied.

@iMichaela
Copy link
Contributor

@brian-comply0 - Thank you. Closing the issue as satisfied.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Aged A label for issues older than 2023-01-01 enhancement User Story
Projects
Status: Done
Development

No branches or pull requests

6 participants