Skip to content

SARIF short titles by filling tool.driver.rules and CVSS score - #75

Open
dancewithheart wants to merge 10 commits into
MangoIV:mainfrom
dancewithheart:sarif-github-code-scanning
Open

SARIF short titles by filling tool.driver.rules and CVSS score#75
dancewithheart wants to merge 10 commits into
MangoIV:mainfrom
dancewithheart:sarif-github-code-scanning

Conversation

@dancewithheart

@dancewithheart dancewithheart commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Changes in SARIF

  1. fill properties.tags

SARIF support for code scanning states that:

properties.tags[]
Code scanning uses tags to allow you to filter results on GitHub. For example, it is possible to filter to all results that have the tag security.

  1. fills properties.security-severity (recently improved in add CVSS 3.1 temporalMetrics and environmentalMetrics haskell/security-advisories#322 and Support missing features CVSS V4 haskell/security-advisories#327))

properties.security-severity
the results with the highest security-severity, and highest precision are shown first. Code scanning translates numerical scores as follows: over 9.0 is critical, from 7.0 to 8.9 is high, from 4.0 to 6.9 is medium and from 0.1 to 3.9 is low

tags includes security

this is why there is security in tags

before:

"properties": {}

now they are emitted:

"properties": {
  "security-severity": "7.5",
  "tags": [
    "security",
    "external/hsec/HSEC-2023-0007",
    "external/cwe/cwe-1284",
    "external/cwe/cwe-789"
  ]
}

I tested on Github code scanning UI properly render by severity and allow filtering using tags.

  1. fills tool.driver.rules that allows GitHub code scanning to show concise alert titles

before

"tool": {
  "driver": {
  "name": "cabal-audit",
  "rules": [],
  "version": "1.0.0.0"
}

after:

"tool": {
  "driver": {
    "name": "cabal-audit",
    "rules": [
      {
         "defaultConfiguration": { "level": "error" },
          "fullDescription": {
             "text": "Haskell Security Advisory: readFloat: memory exhaustion with large exponent. Keywords: toml, parser, dos"
          },
          "helpUri": "https://haskell.github.io/security-advisories/advisory/HSEC-2023-0007",
          "id": "HSEC-2023-0007",
          "name": "HSEC-2023-0007",
          "properties": {},
          "shortDescription": {
              "text": "readFloat: memory exhaustion with large exponent"
           }
          }
    ],
  "version": "1.0.0.0"
},

This fixes blackheaven/haskell-security-action#2

Pictures before and after rendering on Github: blackheaven/haskell-security-action#2 (comment)

* improvement in file locations
* replace single global SARIF location with one location per result:
 - compute (sarifLocation, sarifRegion) per advisory result
  - use concernedInfo package names to choose the location
add tests for matching file and location, regen nix after adding seri dependency

ignore comments and choose full words match

drop TODOs that are handled and fix spellings in tests

ignore empty keywords, drop isHorizontalSpace, one isBoundry instead of isLeftBoundary and isRightBoundary

refactor replace String => Text, extract findCabalFiles

refactor drop duplication for finding cabal/freeze files in chooseSarifLocation and chooseSarifLocationForPackages

refactor do not read and check existance of cabal files

refactor findMap
drop unused test dependency
@dancewithheart
dancewithheart force-pushed the sarif-github-code-scanning branch from ae23f99 to e1661c8 Compare May 30, 2026 17:42
@dancewithheart dancewithheart changed the title Short titles and file locations in output SARIF SARIF short titles by filling tool.driver.rules and CVSS score May 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Give short titles

1 participant