You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a developer or engineer uses the Metapath doc-available() function as documented, an exception is thrown because the base URI is not properly set up for the static context.
Who is the bug affecting
Developers and engineers using the doc-available() function to reliably check if local or remote content is available at a given URL before further processing in Metapath.
How do we replicate this issue
Use the oscal-cli embedded metapath command or the metaschema-cli to example an example URL. See the example output below.
% ~/.asdf/installs/nodejs/20.17.0/bin/oscal-cli --version
oscal-cli 2.2.0 built at 2024-10-08 23:48 from branch 0b9478792d27837a8967cc72a0c98776b24f7102 (0b94787) at https://github.com/metaschema-framework/oscal-cli
liboscal-java built at 2024-10-08 22:12 from branch 0e7de882592dedef37a1fc30101393e6c4fe71f3 (0e7de88) at https://github.com/metaschema-framework/liboscal-java
oscal v1.1.2 built at 2024-10-08 22:12 from branch 4f02dac6f698efda387cc5f55bc99581eaf494b6 (4f02dac) at https://github.com/usnistgov/OSCAL.git
metaschema-java 1.2.0 built at 2024-10-08T20:00:42+0000 from branch 46df8d8fc25c5de1d7cb0485e534f31efe61b2b7 (46df8d8) at https://github.com/metaschema-framework/metaschema-java
metaschema built at 2024-10-08T20:00:42+0000 from branch 7c03ce5844e46cf9d047193a37e44422ae6a7d61 (7c03ce5) at https://github.com/metaschema-framework/metaschema.git
% ~/.asdf/installs/nodejs/20.17.0/bin/oscal-cli metaschema metapath eval -e "doc-available('https://raw.githubusercontent.com/GSA/fedramp-automation/8301e380c88532ebbb22aca55521701750eb0b83/src/content/awesome-cloud/xml/AwesomeCloudSSP1.xml')" --show-stack-trace
An error occurred while evaluating the expression 'doc-available('https://raw.githubusercontent.com/GSA/fedramp-automation/8301e380c88532ebbb22aca55521701750eb0b83/src/content/awesome-cloud/xml/AwesomeCloudSSP1.xml')'.
gov.nist.secauto.metaschema.core.metapath.MetapathException: An error occurred while evaluating the expression 'doc-available('https://raw.githubusercontent.com/GSA/fedramp-automation/8301e380c88532ebbb22aca55521701750eb0b83/src/content/awesome-cloud/xml/AwesomeCloudSSP1.xml')'.
at gov.nist.secauto.metaschema.core.metapath.MetapathExpression.evaluate(MetapathExpression.java:423) ~[dev.metaschema.java.metaschema-core-1.2.0.jar:?]
at gov.nist.secauto.metaschema.cli.commands.metapath.EvaluateMetapathCommand.executeCommand(EvaluateMetapathCommand.java:202) ~[dev.metaschema.java.metaschema-cli-1.2.0.jar:?]
at gov.nist.secauto.metaschema.cli.processor.command.ICommandExecutor$1.execute(ICommandExecutor.java:27) ~[dev.metaschema.java.cli-processor-1.2.0.jar:?]
at gov.nist.secauto.metaschema.cli.processor.CLIProcessor$CallingContext.invokeCommand(CLIProcessor.java:405) ~[dev.metaschema.java.cli-processor-1.2.0.jar:?]
at gov.nist.secauto.metaschema.cli.processor.CLIProcessor$CallingContext.processCommand(CLIProcessor.java:376) [dev.metaschema.java.cli-processor-1.2.0.jar:?]
at gov.nist.secauto.metaschema.cli.processor.CLIProcessor.parseCommand(CLIProcessor.java:175) [dev.metaschema.java.cli-processor-1.2.0.jar:?]
at gov.nist.secauto.metaschema.cli.processor.CLIProcessor.process(CLIProcessor.java:158) [dev.metaschema.java.cli-processor-1.2.0.jar:?]
at gov.nist.secauto.oscal.tools.cli.core.CLI.runCli(CLI.java:69) [dev.metaschema.oscal.oscal-cli-enhanced-2.2.0.jar:?]
at gov.nist.secauto.oscal.tools.cli.core.CLI.main(CLI.java:39) [dev.metaschema.oscal.oscal-cli-enhanced-2.2.0.jar:?]
Caused by: gov.nist.secauto.metaschema.core.metapath.MetapathException: Unable to execute function '{http://csrc.nist.gov/ns/metaschema/metapath-functions}doc-available(arg1 as meta:string?) as meta:boolean'
at gov.nist.secauto.metaschema.core.metapath.function.DefaultFunction.execute(DefaultFunction.java:302) ~[dev.metaschema.java.metaschema-core-1.2.0.jar:?]
at gov.nist.secauto.metaschema.core.metapath.cst.StaticFunctionCall.accept(StaticFunctionCall.java:90) ~[dev.metaschema.java.metaschema-core-1.2.0.jar:?]
at gov.nist.secauto.metaschema.core.metapath.MetapathExpression.evaluate(MetapathExpression.java:420) ~[dev.metaschema.java.metaschema-core-1.2.0.jar:?]
... 8 more
Caused by: gov.nist.secauto.metaschema.core.metapath.function.UriFunctionException: FONS0005: The base-uri is not defined in the static context
at gov.nist.secauto.metaschema.core.metapath.function.library.FnResolveUri.fnResolveUri(FnResolveUri.java:186) ~[dev.metaschema.java.metaschema-core-1.2.0.jar:?]
at gov.nist.secauto.metaschema.core.metapath.function.library.FnDocumentAvailable.fnDocAvailable(FnDocumentAvailable.java:104) ~[dev.metaschema.java.metaschema-core-1.2.0.jar:?]
at gov.nist.secauto.metaschema.core.metapath.function.library.FnDocumentAvailable.fnDocAvailable(FnDocumentAvailable.java:86) ~[dev.metaschema.java.metaschema-core-1.2.0.jar:?]
at gov.nist.secauto.metaschema.core.metapath.function.library.FnDocumentAvailable.execute(FnDocumentAvailable.java:61) ~[dev.metaschema.java.metaschema-core-1.2.0.jar:?]
at gov.nist.secauto.metaschema.core.metapath.function.DefaultFunction.execute(DefaultFunction.java:289) ~[dev.metaschema.java.metaschema-core-1.2.0.jar:?]
at gov.nist.secauto.metaschema.core.metapath.cst.StaticFunctionCall.accept(StaticFunctionCall.java:90) ~[dev.metaschema.java.metaschema-core-1.2.0.jar:?]
at gov.nist.secauto.metaschema.core.metapath.MetapathExpression.evaluate(MetapathExpression.java:420) ~[dev.metaschema.java.metaschema-core-1.2.0.jar:?]
... 8 more
For a valid document at a given URL, the function returns boolean true() for available documents and false() for unavailable documents.
Other comments
NOTE: an example use of the function is shown with an OSCAL model, but this is applicable to any content, whether or not it is OSCAL JSON/XML/YAML, other document instances conforming to a Metaschema model other than OSCAL, or any arbitrary document. This was tested with multiple URLs and the same result occurred.
The text was updated successfully, but these errors were encountered:
Describe the bug
When a developer or engineer uses the Metapath
doc-available()
function as documented, an exception is thrown because the base URI is not properly set up for the static context.Who is the bug affecting
Developers and engineers using the
doc-available()
function to reliably check if local or remote content is available at a given URL before further processing in Metapath.How do we replicate this issue
Use the
oscal-cli
embeddedmetapath
command or themetaschema-cli
to example an example URL. See the example output below.Source
Expected behavior (i.e. solution)
For a valid document at a given URL, the function returns boolean
true()
for available documents andfalse()
for unavailable documents.Other comments
NOTE: an example use of the function is shown with an OSCAL model, but this is applicable to any content, whether or not it is OSCAL JSON/XML/YAML, other document instances conforming to a Metaschema model other than OSCAL, or any arbitrary document. This was tested with multiple URLs and the same result occurred.
The text was updated successfully, but these errors were encountered: