jfrog / jfrog/jfrog-cli-security

JAS scan - return scanner result when applicability is false

Open
#288 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request
Dominant language
Go
Stars
13
Forks
50
Avg merge
3d 48m
Merged PRs (30d)
26

Description

Is your feature request related to a problem? Please describe.
When running jf docker scan <imageName>:<imageTag> --format=simplejson, we do get the applicability for a CVE and when it's false, we might want to return the reason of the "non applicability"

Describe the solution you'd like to see
As behind the scene, we're calling the Xray api GET /api/v1/scan/graph/<scanID>?include_vulnerabilities=true which returns a field info that we should return as well

here is the result of the Xray api :

{
  "artifacts": [
    { ...},
      "issues": [
        {
          "issue_id": "XRAY-607947",
           ...    
          "applicability": [
            {
              "scanner_available": true,
              "component_id": "docker://webapi:1.0.1-alpine",
              "source_comp_id": "alpine://3.8:zlib:1.2.11-r1",
              "cve_id": "CVE-2018-25032",
              "scan_status": 1,
              "applicability": false,
              "scanner_explanation": "<p>The scanner checks whether the vulnerable function <code>deflateInit2</code> is called.</p>", 
              "evidence": null,
              "info": "The vulnerable function deflateInit2 is never called",
              "details": null
            }
          ],

We could improve the current response of the jf docker scan with a new attribute called scannerResult in vulnerabities[*].cves[*].applicability

{
  "vulnerabilities": [
    {
      "severity": "High",
      "impactedPackageName": "3.8:zlib",
      "impactedPackageVersion": "1.2.11-r1",
      "impactedPackageType": "Alpine",
      "components": [
        {
          "name": "sha256__d9ff549177a94a413c425ffe14ae1cc0aa254bc9c7df781add08e7d2fba25d27.tar",
          "version": ""
        }
      ],
      "summary": "zlib before 1.2.12 allows memory corruption when deflating (i.e., when compressing) if the input has many distant matches.",
      "applicable": "Not Applicable",
      "fixedVersions": [
        "[1.2.11-r4]"
      ],
      "cves": [
        {
          "id": "CVE-2018-25032",
          "cvssV2": "5.0",
          "cvssV3": "7.5",
          "applicability": {
            "status": "Not Applicable",
            "scannerDescription": "The scanner checks whether the vulnerable function `deflateInit2` is called."
            "scannerResult": "The vulnerable function deflateInit2 is never called",
          }
        }
      ],
    }
   ]

We would need to update the Applicability struct and set the info field in the GetCveApplicabilityField()

Describe alternatives you've considered
NA

Additional context
NA

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Applicability struct in utils/formats/simplejsonapi.go and GetCveApplicabilityField() in utils/results/common.go. Trace how the Xray applicability info is mapped into the simple JSON response, then add the scanner result to vulnerabilities[].cves[].applicability and verify that the returned field contains the Xray info value.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli, security
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.