NUWCDIVNPT / stig-manager

An API and client for managing STIG assessments
Other
120 stars 28 forks source link

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

Open crodriguez6497 opened 2 months ago

crodriguez6497 commented 2 months ago

Is there an existing issue for this?

Are you using the latest version of STIG Manager?

Where are you experiencing the issue?

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"`)
  }