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

metaschema allowed-values target attribute path validation #1001

Closed
GaryGapinski opened this issue Jul 25, 2021 · 2 comments
Closed

metaschema allowed-values target attribute path validation #1001

GaryGapinski opened this issue Jul 25, 2021 · 2 comments

Comments

@GaryGapinski
Copy link

While inspecting OSCAL/src/metaschema/oscal_ssp_metaschema.xml I found something unexpected.

The <allowed-values> element has a target attribute which routinely contains what appears to be an XPath expression. The related metaschema XML schema (../../build/metaschema/toolchains/xslt-M4/validate/metaschema.xsd) indicates that the target attribute is a metaschema-path-type but these strings appear indistinguishable from XPath expressions.

Are all <allowed-values> element target attributes XPath expressions?

src/metaschema/oscal_ssp_metaschema.xml has what appears to be an XPath expression which is syntactically invalid (the expression ends in a right curly bracket rather than a right parenthesis). It seems unlikely that it would be a correct metaschema path.

Should this have been detected and corrected?

@wendellpiez
Copy link
Contributor

wendellpiez commented Jul 29, 2021

@GaryGapinski this is a good topic for Lunch with the Devs or anywhere there is an interest in Metaschema.

The short version is that we have posited an expression language (naturally called 'Metapath') that would serve to address both XML and JSON flavors of OSCAL.

So far it is a clean subset of XPath 2.0, except adding a single function, called value(). We need this function because the nominal 'value' of a field in JSON or XML is found in the tree in a different way (and in XML it could be mixed content). We have left out variable references, the axes that do not look down (so permitting self::, child::, descendant:: and descendant-or-self::), and grouped steps apart from union steps (so we do a/(b|c)/d but not a/(* except c)/d.

However this is all in the context of development -- in this case, including the capability to cast from paths to address XML OSCAL to paths that address OSCAL JSON (as expanded into XPath JSON XML).

As for your question, actually the error (and there are more) has been detected, just not corrected yet. Indeed those paths (even when actual paths not random strings) have not been validated operationally yet, either.

@iMichaela iMichaela added the bug label Jul 29, 2021
@GaryGapinski
Copy link
Author

Thanks @wendellpiez for the detailed explanation. I think AJ had shown me a reference to a related parser.

What had surprised me is that a flaw in a Metapath might preclude correct generation of documentation regarding <constraint>s. A pointer to the related (e.g., producing allowed values) transform(s) would be appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants