codeql-action icon indicating copy to clipboard operation
codeql-action copied to clipboard

`upload-sarif@v3`: could not convert rules: invalid security severity value, is not a number: undefined

Open NiccoloFei opened this issue 5 months ago • 14 comments

Hi, recently I'm seeing the following error when running the upload-sarif@v3 GH action. Example failure: https://github.com/cloudnative-pg/postgres-containers/actions/runs/8196632252/job/22417260216

Uploading results
  Processing sarif files: ["snyk.sarif"]
  Uploading results
  Successfully uploaded results
Waiting for processing to finish
  Analysis upload status is pending.
  Analysis upload status is failed.
Error: Code Scanning could not process the submitted SARIF file:
could not convert rules: invalid security severity value, is not a number: undefined
Error: Code Scanning could not process the submitted SARIF file:
could not convert rules: invalid security severity value, is not a number: undefined
    at Object.waitForProcessing (/home/runner/work/_actions/github/codeql-action/v3/lib/upload-lib.js:359:[27](https://github.com/cloudnative-pg/postgres-containers/actions/runs/8196632252/job/22417260216#step:11:28))
    at async run (/home/runner/work/_actions/github/codeql-action/v3/lib/upload-sarif-action.js:58:13)
    at async runWrapper (/home/runner/work/_actions/github/codeql-action/v3/lib/upload-sarif-action.js:76:9)

I'm not sure what could cause that. The upload was working just fine and started failing the last few days. Any help is appreciated, thanks in advance!

NiccoloFei avatar Mar 08 '24 10:03 NiccoloFei

Hi @NiccoloFei 👋

I'll check with the team to see if we have made any changes to the SARIF upload recently that could be responsible for this, but have you verified that the file generated by Snyk is actually a valid SARIF file? If so, could you make the SARIF file available?

mbg avatar Mar 08 '24 11:03 mbg

Attaching the SARIF content below:

Sarif content:
{
  "$schema": "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json",
  "version": "2.1.0",
  "runs": [
    {
      "tool": {
        "driver": {
          "name": "Snyk Container",
          "properties": {
            "artifactsScanned": 169
          },
          "rules": [
            {
              "id": "SNYK-DEBIAN11-EXPAT-6227598",
              "shortDescription": {
                "text": "High severity - Resource Exhaustion vulnerability in expat"
              },
              "fullDescription": {
                "text": "(CVE-2023-52425) expat/[email protected]+deb11u5"
              },
              "help": {
                "text": "",
                "markdown": "## NVD Description\n**_Note:_** _Versions mentioned in the description apply only to the upstream `expat` package and not the `expat` package as distributed by `Debian`._\n_See `How to fix?` for `Debian:11` relevant fixed versions and status._\n\nlibexpat through 2.5.0 allows a denial of service (resource consumption) because many full reparsings are required in the case of a large token for which multiple buffer fills are needed.\n## Remediation\nThere is no fixed version for `Debian:11` `expat`.\n## References\n- [ADVISORY](https://security-tracker.debian.org/tracker/CVE-2023-52425)\n- [[email protected]](https://github.com/libexpat/libexpat/pull/789)\n"
              },
              "defaultConfiguration": {
                "level": "error"
              },
              "properties": {
                "tags": [
                  "security",
                  "CWE-400",
                  "deb"
                ],
                "cvssv3_baseScore": 7.5,
                "security-severity": "7.5"
              }
            },
            {
              "id": "SNYK-DEBIAN11-SYSTEMD-6277510",
              "shortDescription": {
                "text": "High severity - Allocation of Resources Without Limits or Throttling vulnerability in systemd"
              },
              "fullDescription": {
                "text": "(CVE-2023-50387) systemd/[email protected]+deb11u4"
              },
              "help": {
                "text": "",
                "markdown": "## NVD Description\n**_Note:_** _Versions mentioned in the description apply only to the upstream `systemd` package and not the `systemd` package as distributed by `Debian`._\n_See `How to fix?` for `Debian:11` relevant fixed versions and status._\n\nCertain DNSSEC aspects of the DNS protocol (in RFC 4033, 4034, 4035, 6840, and related RFCs) allow remote attackers to cause a denial of service (CPU consumption) via one or more DNSSEC responses, aka the "KeyTrap" issue. One of the concerns is that, when there is a zone with many DNSKEY and RRSIG records, the protocol specification implies that an algorithm must evaluate all combinations of DNSKEY and RRSIG records.\n## Remediation\nThere is no fixed version for `Debian:11` `systemd`.\n## References\n- [ADVISORY](https://security-tracker.debian.org/tracker/CVE-2023-50387)\n- [[email protected]](https://datatracker.ietf.org/doc/html/rfc4035)\n- [[email protected]](https://docs.powerdns.com/recursor/security-advisories/powerdns-advisory-2024-01.html)\n- [[email protected]](https://kb.isc.org/docs/cve-2023-50387)\n- [[email protected]](https://news.ycombinator.com/item?id=39367411)\n- [[email protected]](https://nlnetlabs.nl/news/2024/Feb/13/unbound-1.19.1-released/)\n- [[email protected]](https://www.athene-center.de/aktuelles/key-trap)\n- [[email protected]](https://www.isc.org/blogs/2024-bind-security-release/)\n- [[email protected]](https://www.securityweek.com/keytrap-dns-attack-could-disable-large-parts-of-internet-researchers/)\n- [[email protected]](https://www.theregister.com/2024/02/13/dnssec_vulnerability_internet/)\n- [[email protected]](https://news.ycombinator.com/item?id=39372384)\n- [[email protected]](https://gitlab.nic.cz/knot/knot-resolver/-/releases/v5.7.1)\n- [[email protected]](https://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2024q1/017430.html)\n- [[email protected]](https://access.redhat.com/security/cve/CVE-2023-50387)\n- [[email protected]](https://bugzilla.suse.com/show_bug.cgi?id=1219823)\n- [[email protected]](https://msrc.microsoft.com/update-guide/vulnerability/CVE-2023-50387)\n- [[email protected]](https://www.athene-center.de/fileadmin/content/PDF/Technical_Report_KeyTrap.pdf)\n- [[email protected]](http://www.openwall.com/lists/oss-security/2024/02/16/2)\n- [[email protected]](http://www.openwall.com/lists/oss-security/2024/02/16/3)\n- [[email protected]](https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/SVYA42BLXUCIDLD35YIJPJSHDIADNYMP/)\n- [[email protected]](https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/BUIP7T7Z4T3UHLXFWG6XIVDP4GYPD3AI/)\n- [[email protected]](https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/PNNHZSZPG2E7NBMBNYPGHCFI4V4XRWNQ/)\n- [[email protected]](https://lists.debian.org/debian-lts-announce/2024/02/msg00006.html)\n- [[email protected]](https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/TEXGOYGW7DBS3N2QSSQONZ4ENIRQEAPG/)\n- [[email protected]](https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/UQESRWMJCF4JEYJEAKLRM6CT55GLJAB7/)\n- [[email protected]](https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/HVRDSJVZKMCXKKPP6PNR62T7RWZ3YSDZ/)\n- [[email protected]](https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/RGS7JN6FZXUSTC2XKQHH27574XOULYYJ/)\n"
              },
              "defaultConfiguration": {
                "level": "error"
              },
              "properties": {
                "tags": [
                  "security",
                  "CWE-770",
                  "deb"
                ],
                "cvssv3_baseScore": 7.5,
                "security-severity": "7.5"
              }
            },
            {
              "id": "SNYK-DEBIAN11-ZLIB-6008961",
              "shortDescription": {
                "text": "Critical severity - Integer Overflow or Wraparound vulnerability in zlib"
              },
              "fullDescription": {
                "text": "(CVE-2023-45853) zlib/zlib1g@1:1.2.11.dfsg-2+deb11u2"
              },
              "help": {
                "text": "",
                "markdown": "## NVD Description\n**_Note:_** _Versions mentioned in the description apply only to the upstream `zlib` package and not the `zlib` package as distributed by `Debian`._\n_See `How to fix?` for `Debian:11` relevant fixed versions and status._\n\nMiniZip in zlib through 1.3 has an integer overflow and resultant heap-based buffer overflow in zipOpenNewFileInZip4_64 via a long filename, comment, or extra field. NOTE: MiniZip is not a supported part of the zlib product. NOTE: pyminizip through 0.2.6 is also vulnerable because it bundles an affected zlib version, and exposes the applicable MiniZip code through its compress API.\n## Remediation\nThere is no fixed version for `Debian:11` `zlib`.\n## References\n- [ADVISORY](https://security-tracker.debian.org/tracker/CVE-2023-45853)\n- [[email protected]](https://chromium.googlesource.com/chromium/src/+/d709fb23806858847131027da95ef4c548813356)\n- [[email protected]](https://chromium.googlesource.com/chromium/src/+/de29dd6c7151d3cd37cb4cf0036800ddfb1d8b61)\n- [[email protected]](https://github.com/madler/zlib/blob/ac8f12c97d1afd9bafa9c710f827d40a407d3266/contrib/README.contrib#L1-L4)\n- [[email protected]](https://github.com/madler/zlib/pull/843)\n- [[email protected]](https://www.winimage.com/zLibDll/minizip.html)\n- [[email protected]](http://www.openwall.com/lists/oss-security/2023/10/20/9)\n- [[email protected]](https://lists.debian.org/debian-lts-announce/2023/11/msg00026.html)\n- [[email protected]](https://security.netapp.com/advisory/ntap-20231130-0009/)\n- [[email protected]](https://pypi.org/project/pyminizip/#history)\n- [[email protected]](https://security.gentoo.org/glsa/202401-18)\n- [[email protected]](http://www.openwall.com/lists/oss-security/2024/01/24/10)\n"
              },
              "defaultConfiguration": {
                "level": "error"
              },
              "properties": {
                "tags": [
                  "security",
                  "CWE-190",
                  "deb"
                ],
                "cvssv3_baseScore": 9.8,
                "security-severity": "9.8"
              }
            }
          ]
        }
      },
      "results": [
        {
          "ruleId": "SNYK-DEBIAN11-EXPAT-6227598",
          "level": "error",
          "message": {
            "text": "This file introduces a vulnerable expat package with a high severity vulnerability."
          },
          "locations": [
            {
              "physicalLocation": {
                "artifactLocation": {
                  "uri": "Debian/14/Dockerfile"
                },
                "region": {
                  "startLine": 1
                }
              },
              "logicalLocations": [
                {
                  "fullyQualifiedName": "[email protected]+deb11u5"
                }
              ]
            }
          ]
        },
        {
          "ruleId": "SNYK-DEBIAN11-SYSTEMD-6277510",
          "level": "error",
          "message": {
            "text": "This file introduces a vulnerable systemd package with a high severity vulnerability."
          },
          "locations": [
            {
              "physicalLocation": {
                "artifactLocation": {
                  "uri": "Debian/14/Dockerfile"
                },
                "region": {
                  "startLine": 1
                }
              },
              "logicalLocations": [
                {
                  "fullyQualifiedName": "[email protected]+deb11u4"
                }
              ]
            }
          ]
        },
        {
          "ruleId": "SNYK-DEBIAN11-ZLIB-6008961",
          "level": "error",
          "message": {
            "text": "This file introduces a vulnerable zlib package with a critical severity vulnerability."
          },
          "locations": [
            {
              "physicalLocation": {
                "artifactLocation": {
                  "uri": "Debian/14/Dockerfile"
                },
                "region": {
                  "startLine": 1
                }
              },
              "logicalLocations": [
                {
                  "fullyQualifiedName": "zlib@1:1.2.11.dfsg-2+deb11u2"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "tool": {
        "driver": {
          "name": "Snyk Container",
          "properties": {
            "artifactsScanned": 39
          },
          "rules": [
            {
              "id": "snyk:lic:pip:barman:GPL-3.0",
              "shortDescription": {
                "text": "High severity - GPL-3.0 license vulnerability in barman"
              },
              "fullDescription": {
                "text": "[email protected]"
              },
              "help": {
                "text": "",
                "markdown": "GPL-3.0 license"
              },
              "defaultConfiguration": {
                "level": "error"
              },
              "properties": {
                "tags": [
                  "security",
                  "pip"
                ],
                "security-severity": "undefined"
              }
            }
          ]
        }
      },
      "results": [
        {
          "ruleId": "snyk:lic:pip:barman:GPL-3.0",
          "level": "error",
          "message": {
            "text": "This file introduces a vulnerable barman package with a high severity vulnerability."
          },
          "locations": [
            {
              "physicalLocation": {
                "artifactLocation": {
                  "uri": "/requirements.txt"
                },
                "region": {
                  "startLine": 1
                }
              },
              "logicalLocations": [
                {
                  "fullyQualifiedName": "[email protected]"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "tool": {
        "driver": {
          "name": "Snyk Container",
          "properties": {
            "artifactsScanned": 2
          },
          "rules": []
        }
      },
      "results": []
    }
  ]
}

NiccoloFei avatar Mar 08 '24 11:03 NiccoloFei

I'm pretty sure it's because your sarif has "security-severity": "undefined". I don't know what this value is supposed to be, but you should probably check with snyk to see if there is a known workaround. Otherwise, you can try post-processing the sarif before uploading.

aeisenberg avatar Mar 08 '24 15:03 aeisenberg

@aeisenberg your assessment seems accurate to me. I tried to downgrade upload-sarif to v2 and the issue persists.

abstractj avatar Mar 11 '24 16:03 abstractj

I'd recommend post-processing the SARIF that snyk produces to remove the undefined. I am not sure what value should replace it, but it should be numeric.

aeisenberg avatar Mar 11 '24 18:03 aeisenberg

Is there any issue opened within the Snyk? I'm getting the same exact error, except of undefined replaced with null: https://github.com/warriors-life/yokohama-proxy/actions/runs/8211361886/job/22460200402.

LeviPesin avatar Mar 14 '24 05:03 LeviPesin

There are no issues that I am aware of. I'd recommend that you raise one. This appears to be a recent change seeing as how there are multiple reports in this issue.

aeisenberg avatar Mar 14 '24 16:03 aeisenberg

Where can I create an issue? It seems like issues are disabled in the https://github.com/snyk/actions repository.

LeviPesin avatar Mar 14 '24 16:03 LeviPesin

See here https://github.com/snyk/actions/blob/master/CONTRIBUTING.md#reporting-issues.

aeisenberg avatar Mar 14 '24 16:03 aeisenberg

Same problem here: https://github.com/fledge-power/fledgepower-deployment/actions/runs/8286079944/job/22675227175

aklira avatar Mar 14 '24 19:03 aklira

See here https://github.com/snyk/actions/blob/master/CONTRIBUTING.md#reporting-issues.

Thank you, submitted a ticket there!

LeviPesin avatar Mar 15 '24 10:03 LeviPesin

See here https://github.com/snyk/actions/blob/master/CONTRIBUTING.md#reporting-issues.

Thank you, submitted a ticket there!

Are there any updates regarding the submitted ticket?

mykolaveremeichyk avatar Mar 20 '24 15:03 mykolaveremeichyk

They've replied only today with a request to provide the full SARIF file (well, they could've downloaded it from just any run).

LeviPesin avatar Mar 21 '24 20:03 LeviPesin

This behavior is expected - licenses and vulnerabilities were originally designed with a common structure but license-related findings are now managed differently. That is, license-related findings do not indicate a security vulnerability and are labeled as 'undefined'. You can use use the --sarif-file-output=snyk.sarif arg and add the following lines to fix it:

   - name: Replace security-severity undefined for license-related findings 
     run: sed -i 's/"security-severity": "undefined"/"security-severity": "0"/g' snyk.sarif

mprado-enclave avatar Apr 08 '24 16:04 mprado-enclave