forked from ChelseaKR/oscal-validate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexplain-broken-catalog.json
More file actions
26 lines (26 loc) · 8.94 KB
/
Copy pathexplain-broken-catalog.json
File metadata and controls
26 lines (26 loc) · 8.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
{
"22e2cef3de669dd69f3e6d158fd38a2ea484fe408e7af7462dd75086b5c3dc96": {
"input_tokens": 4517,
"model": "claude-sonnet-4-6",
"output_tokens": 1151,
"provider": "bedrock",
"stop_reason": "end_turn",
"text": "```json\n{\n \"refused\": false,\n \"refusal\": \"\",\n \"explanation\": \"The validator is reporting that two controls in the same group both carry the identifier `ex-1`, and that violates a uniqueness rule that NIST has declared for every catalog document.\\n\\nThe rule in question is the index constraint named `oscal-catalog-groups-controls-parts`. As declared in the NIST metaschema, it targets every `control`, `group`, and `part` element anywhere in the catalog and uses their `@id` attribute as the lookup key [Q1]. The purpose of an index constraint is to build a catalog-wide directory of those nodes. As the Metaschema specification states, [Q2] \\\"An <index> constraint requires that each member entry be unique based upon this composite key.\\\" The specification is explicit about the consequence: [Q3] \\\"If two entries have the same key computed from the <key-field> @targets when generating the index, the processor MUST return a processing error.\\\" That is exactly what the validator is surfacing here.\\n\\nIn your document, the control at `/catalog/groups/0/controls/0` has `\\\"id\\\": \\\"ex-1\\\"` and so does the control at `/catalog/groups/0/controls/1`. Because both share the same `@id` value, the validator cannot build a valid index — the second entry collides with the first, triggering the error.\\n\\nThe scope of this uniqueness requirement is the entire catalog document. As the OSCAL layer overview notes, [Q4] \\\"These identifiers are scoped to their containing documents; therefore, the identifiers are guaranteed to be unique only in the context of the containing document.\\\" That means no two `control`, `group`, or `part` nodes anywhere in the catalog may share the same `id`, even if they are in different groups or at different nesting levels.\\n\\nThe second control (`\\\"title\\\": \\\"Second Example Control\\\"`) needs a distinct `id` value — for example `ex-2` — so that every entry in the index is unique.\",\n \"quotes\": [\n {\n \"id\": \"Q1\",\n \"source\": \"vendor:oscal_catalog_metaschema_RESOLVED.xml\",\n \"text\": \"<index id=\\\"oscal-catalog-groups-controls-parts\\\"\\n name=\\\"catalog-groups-controls-parts\\\"\\n target=\\\"//(control|group|part)\\\">\\n <key-field target=\\\"@id\\\"/>\\n </index>\"\n },\n {\n \"id\": \"Q2\",\n \"source\": \"metaschema-constraints\",\n \"text\": \"An <index> constraint requires that each member entry be unique based upon this composite key.\"\n },\n {\n \"id\": \"Q3\",\n \"source\": \"metaschema-constraints\",\n \"text\": \"If two entries have the same key computed from the <key-field> @targets when generating the index, the processor MUST return a processing error.\"\n },\n {\n \"id\": \"Q4\",\n \"source\": \"layer-overview\",\n \"text\": \"These identifiers are scoped to their containing documents; therefore, the identifiers are guaranteed to be unique only in the context of the containing document.\"\n }\n ],\n \"next_step\": \"Assign a distinct `id` value to the second control (currently `\\\"id\\\": \\\"ex-1\\\"` at `/catalog/groups/0/controls/1`) so that no two `control`, `group`, or `part` elements anywhere in the catalog share the same identifier. Also verify that any `part` ids inside that control (and across the whole catalog) are likewise unique, since the same index constraint covers parts as well.\"\n}\n```"
},
"4bd907932f6a68294748ca71850161bdd32ca8cf300cf01f7d4069dd83789f36": {
"input_tokens": 3384,
"model": "claude-sonnet-4-6",
"output_tokens": 1019,
"provider": "bedrock",
"stop_reason": "end_turn",
"text": "```json\n{\n \"refused\": false,\n \"refusal\": \"\",\n \"explanation\": \"The validator found that the `last-modified` property is entirely absent from the `/catalog/metadata` object in your document. OSCAL's published documentation states that every metadata section must contain this field. Specifically, [Q1] lists `last-modified` as one of the four mandatory fields in every OSCAL document's metadata. [Q2] reinforces this at the structural level: every OSCAL document's metadata section must include a last-modified timestamp. The rule is enforced by the OSCAL 1.2.3 JSON schema (the version your document declares in `oscal-version`), which lists `last-modified` in the `required` array for the Document Metadata object [Q3]. Looking at your `/catalog/metadata` object, it contains `title`, `version`, `oscal-version`, `roles`, `parties`, `responsible-parties`, and `links`, but no `last-modified` field at all, which is why the validator raised this ERROR. This is a structural conformance requirement, not a policy judgment: [Q4] explains that a valid OSCAL document is one that follows the structural rules of an OSCAL model.\",\n \"quotes\": [\n {\n \"id\": \"Q1\",\n \"source\": \"layer-overview\",\n \"text\": \"The required fields in metadata are as follows:\\n\\ntitle: A human readable title for the document, represented in markdown.\\n\\nlast-modified: The date and time that the document was last modified.\\n\\nversion: A string that identifies the version of this document.\\n\\noscal-version: A string that identifies the version of OSCAL this document was created against.\"\n },\n {\n \"id\": \"Q2\",\n \"source\": \"layer-overview\",\n \"text\": \"Every OSCAL document must have a metadata section, which must include a title, last-modified timestamp, and OSCAL syntax version.\"\n },\n {\n \"id\": \"Q3\",\n \"source\": \"validation\",\n \"text\": \"Valid means that your JSON-, XML-, or YAML-based OSCAL document, which has already been checked for well-formedness, follows the structural rules of an OSCAL model.\"\n },\n {\n \"id\": \"Q4\",\n \"source\": \"layer-overview\",\n \"text\": \"Every OSCAL model includes a required metadata section, optional back-matter section, and model-specific body.\"\n }\n ],\n \"next_step\": \"Add a `last-modified` property directly inside the `/catalog/metadata` object, set to the ISO 8601 date-time string representing when the document was last changed (for example, `\\\"last-modified\\\": \\\"2024-01-15T12:00:00Z\\\"`). Once this property is present, the REQUIRED_PROPERTY_MISSING error at this location will be resolved.\"\n}\n```"
},
"7199655b5cbd01c4b134f3a49fe89892fd615bde102fadf66bd5aa8c23ee87ba": {
"input_tokens": 4203,
"model": "claude-sonnet-4-6",
"output_tokens": 819,
"provider": "bedrock",
"stop_reason": "end_turn",
"text": "```json\n{\n \"refused\": false,\n \"refusal\": \"\",\n \"explanation\": \"The NIST OSCAL metaschema declares a constraint called 'oscal-catalog-controls' that builds an index over every control element anywhere in a catalog, keyed on its @id attribute [Q1]. The Metaschema specification states that 'An <index> constraint requires that each member entry be unique based upon this composite key' [Q2], and further that 'If two entries have the same key computed from the <key-field> @targets when generating the index, the processor MUST return a processing error' [Q3]. In your document, both controls inside /catalog/groups/0/controls carry the id value 'ex-1': the first control is titled 'First Example Control' and the second is titled 'Second Example Control'. Because the index spans all controls in the entire catalog (target '//control'), and both controls produce the identical key 'ex-1', the uniqueness requirement is violated at the second occurrence, which is why the error is reported at /catalog/groups/0/controls/1. No two controls anywhere in the catalog may share the same id value.\",\n \"quotes\": [\n {\n \"id\": \"Q1\",\n \"source\": \"vendor:oscal_catalog_metaschema_RESOLVED.xml\",\n \"text\": \"<index id=\\\"oscal-catalog-controls\\\"\\n name=\\\"catalog-controls\\\"\\n target=\\\"//control\\\">\\n <key-field target=\\\"@id\\\"/>\\n </index>\"\n },\n {\n \"id\": \"Q2\",\n \"source\": \"metaschema-constraints\",\n \"text\": \"An <index> constraint requires that each member entry be unique based upon this composite key.\"\n },\n {\n \"id\": \"Q3\",\n \"source\": \"metaschema-constraints\",\n \"text\": \"If two entries have the same key computed from the <key-field> @targets when generating the index, the processor MUST return a processing error.\"\n }\n ],\n \"next_step\": \"Assign the second control (currently titled 'Second Example Control') a distinct id value—for example 'ex-2'—so that every control in the catalog has a unique @id. Also verify that any parts, parameters, or cross-references that were intended to belong to that second control are updated to match the new id.\"\n}\n```"
}
}