Skip to content

Bug in oscal-unique-link-in-context-location #155

@JoseGHdz

Description

@JoseGHdz

Describe the bug

Issue is that the Metaschema is not taking into consideration the resource-fragment when determining link uniqueness, therefore when running the following (Catalog -> Groups -> Controls):

"controls": [
                    {
                        "id": "c_b6688b56-df1b-4f41-8988-2e90088b0a42",
                        "links": [
                            {
                                "rel": "reference",
                                "href": "#3dee4f20-a636-4726-aebf-b80e74736373",
                                "resource-fragment": "sc-5", 
                                "text": "SC-5"
                            },
                            {
                                "rel": "reference",
                                "href": "#3dee4f20-a636-4726-aebf-b80e74736373",
                                "resource-fragment": "sc-7", 
                                "text": "SC-7"
                            },
                            {
                                "rel": "reference",
                                "href": "#3dee4f20-a636-4726-aebf-b80e74736373",
                                "resource-fragment": "sc-12", 
                                "text": "SC-12"
                            },
                            {
                                "rel": "reference",
                                "href": "#3dee4f20-a636-4726-aebf-b80e74736373",
                                "resource-fragment": "sc-39", 
                                "text": "SC-39"
                            },
                            {
                                "rel": "reference",
                                "href": "#3dee4f20-a636-4726-aebf-b80e74736373",
                                "resource-fragment": "sr-12", 
                                "text": "SR-12"
                            }
                        ]

An error shows up stating:

[ERROR] [/catalog/group[1]/control[1]/link[2]] oscal-unique-link-in-context-location: Unique constraint violation at paths '/catalog/group[1]/control[1]/link[1]' and '/catalog/group[1]/control[1]/link[2]'

The way to fix this is to include resource-fragment in the check for uniqueness.

https://github.com/metaschema-framework/liboscal-java/blob/a2c3b93dd32ff8bb253f92b7b136455e7ebca9dd/src/main/metaschema-constraints/oscal-external-constraints.xml#L35C13-L42

OSCAL CLI Version used: 2.5.0

Who is the bug affecting

This issue is affecting the Catalog OSCAL File Formats

How do we replicate this issue

Run the following Catalog: https://github.com/SunStone-Secure-LLC/OSCAL-Plugfest-2025/blob/main/Catalog/Untested/FedRAMP%20RFC-0006%2020x%20Phase%20One%20Key%20Security%20Indicators.json

Expected behavior (i.e. solution)

The expected behavior is that it validates.

Other comments

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions