Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce number of CVE collisions dependency-check/dependency-check-son… #763

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jordannstrong
Copy link

…ar-plugin#682

Uses the CVE number as a line offset to reduce overlap.

@Reamer
Copy link
Member

Reamer commented Feb 24, 2023

Can you please provide a screenshot of how the offset affects the SonarQube UI?

@jordannstrong
Copy link
Author

image

Please let me know if this isn't what you meant, or if you'd like any other screenshots or information.

Copy link
Member

@Reamer Reamer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that I don't like the solution. If I'm looking over the changes correctly, then take the vulnerability e.g. CVE-2022-23305, make it 202223305 and use this number as a direct text offset (202223305) or as a text offset + 1 (202223306). Do I understand the approach correctly?

putDependencyMap(dependency, new TextRangeConfidence(buildGradle.selectLine(linenumber), Confidence.HIGHEST));
putDependencyMap(dependency, vulnerability, new TextRangeConfidence(buildGradle.selectLine(linenumber), Confidence.HIGHEST));
return;
} else {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The else is unnecessary because we have a return in the if.

@jordannstrong
Copy link
Author

Yes, with the result of the issue being attached to the lines at offset 202223305, instead of the entire line, allowing for multiple vulnerabilities on the same line without colliding. It's certainly not a complete solution, since if the vulnerability has no numbers in the name it will default to offset 0, allowing for collisions. Or if one line has multiple vulnerabilities with the same CVE. Otherwise, nothing changes visually, just the location that the issues are tracked internally by SonarQube.

@Reamer Reamer added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. enhancement labels May 5, 2023
@Reamer
Copy link
Member

Reamer commented May 5, 2023

I don't like the solution with the offsets because it has an unclean taste. Since the solution probably works, I leave the pull request open for people who also want to solve the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants