Risks Reports endpoint only returning open risks

When consuming the https://api.sonarcloud.io/sca/risk-reports endpoint, it only returns the open dependency risks. I was expecting to receive all dependency risks (accepted, confirmed, fixed, and safe)

I tested this at different scopes (with a portfolio and a project), and the behavior is the same. For example, I can see fixed dependency risks through SonarCloud’s interface, but not by querying the api

Is this intended? Based on the description of the endpoint and the object structure returned by the api, it seems not to be the intended behavior

This is the api response structure, notice the “riskStatus” property:

[
  {
    "branchKey": "string",
    "confirmedReachable": true,
    "createdAt": "string",
    "cvssScore": 0,
    "cweIds": [
      "string"
    ],
    "dependencyChains": [
      [
        "string"
      ]
    ],
    "epssPercentile": 0,
    "epssScore": 0,
    "knownExploited": true,
    "packageUrl": "string",
    "productionScope": true,
    "projectKey": "string",
    "projectName": "string",
    "publishedOn": "string",
    "riskSeverity": "INFO",
    "riskStatus": "OPEN",
    "riskTitle": "string",
    "riskType": "VULNERABILITY",
    "riskUrl": "string",
    "scope": "string",
    "statusChanges": [
      {
        "comment": "string",
        "createdAt": "string",
        "newStatus": "string"
      }
    ],
    "vulnerabilityId": "string"
  }
]
1 Like