dependency-check / dependency-check/DependencyCheck

SARIF "ruleId" for NPM findings is just a number; should be NPM- prefixed

Open
#4,515 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
7.7k
Forks
1.4k
Avg merge
9d 22h
Merged PRs (30d)
13

Description

**Describe the bug**
In SARIF report output, the "ruleId" for NPM findings is just a number. That make it hard to understand what database to look that number up in, adding the NPM- prefix would make the meaning of the number much more obvious.

For example, here's an excerpt from a SARIF report:
```json
"results": [ {"ruleId": "1070273","level": "warning","message": {"text": "1070273 - ansi-regex is vulnerable to Inefficient Regular Expression Complexity"},"partialFingerprints": {"vulnerabilityHash": "ecc887814803262bb6af684fd4dd8791"},"locations": [{"physicalLocation": {"artifactLocation": {"uri": "\/src\/frontend\/yarn.lock?ansi-regex","index": 16094 }},"logicalLocations": [{"fullyQualifiedName": "pkg:npm\/ansi-regex@3.0.0"}]}]}]
```

In the HTML report, the information presented is much more helpful/readable:
![image](https://user-images.githubusercontent.com/194713/169151663-b7ed269d-1779-4703-ab3e-01181a257f40.png)

Note that the SARIF report generator already has code to special handle NPM and add the `NPM-` prefix in another place:
https://github.com/jeremylong/DependencyCheck/blob/07bd05189ee4a3635365bd72e8d265c4ea49385e/core/src/main/resources/templates/sarifReport.vsl#L23

**Version of dependency-check used**
cli version 7.1.0

**Log file**
n/a

**To Reproduce**
Steps to reproduce the behavior:
1. Run OWASP dependency check on a project that has NPM findings
2. View the SARIF report

**Expected behavior**
The `ruleId` field should contain a full reference uniquely identifying the finding; part of that unique identifier should be the database (in this case `NPM`).

**Additional context**
Add any other context about the problem here.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.