stig-manager icon indicating copy to clipboard operation
stig-manager copied to clipboard

/collections/{collectionId}/findings ccis projection response does not match schema.

Open crodriguez6497 opened this issue 5 months ago • 0 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Are you using the latest version of STIG Manager?

  • [X] I am using the latest Release.
  • [ ] I am NOT using the latest Release. I am aware that the first thing I will be asked to do is update the application so that I have the latest bugfixes.

Where are you experiencing the issue?

  • [X] API
  • [ ] UI or other client
  • [ ] Deployment
  • [ ] Elsewhere

Current Behavior

Response data from requests to /collections/{collectionId}/findings with the ccis projection does not include "control" in the ccis response.

CCI specification schema:

"ccis": [
   {
     "apAcronym": "string",
     "cci": "string",
     "control": "string",
     "definition": "string"
   }
 ],

Response schema:

        "ccis": [
            {
                "cci": "string",
                "apAcronym": "string",
                "definition": "string"
            }
        ]

Issue arises from CollectionService.js L324-336:

  if (inProjection.includes('ccis')) {
    columns.push(`cast(concat('[', 
    coalesce(
      group_concat(distinct 
      case when cci.cci is not null
      then json_object(
        'cci', cci.cci,
        'definition', cci.definition,
        'apAcronym', cci.apAcronym)
      else null end order by cci.cci),
      ''),
    ']') as json) as "ccis"`)
  }

crodriguez6497 avatar Sep 05 '24 15:09 crodriguez6497