Skip to content

Fix first instance rule being used as rule description for all violations of that rule and other SARIF improvements #7640

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

Open
wants to merge 67 commits into
base: main
Choose a base branch
from

Conversation

Nettozx
Copy link

@Nettozx Nettozx commented Jul 2, 2025

  • Fixed issue where the first instance of a rule violation short description would get used for all subsequent rule violations, found that if you make all the rule name and descriptions empty strings, github will default to the instance descriptions
  • Added setting for problem.severity
  • Changed defaultConfiguration.level to use problem.severity instead of security-severity
  • Added more levels for security-severity
  • Added reporting of cwe ID
  • Fixed issue with uncrustify version detection
  • Added unit tests for sarif output

Before:
cppcheck_original_problem

After:
image

@firewave
Copy link
Collaborator

firewave commented Jul 2, 2025

Thanks for you contribution.

I added a remark on how to keep this in sync for future changes. Possibly not something which should addressed before/in this PR.

Also something like --errorlist-sarif might make sense.

Copy link
Owner

@danmar danmar left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution!!

I believe we'll need to rethink that getRuleDescription somehow but unfortunately I don't see a quick/simple method..

@Nettozx Nettozx marked this pull request as ready for review July 15, 2025 22:47
@Nettozx
Copy link
Author

Nettozx commented Jul 15, 2025

@danmar I have simplified the approach significantly. I added genericMessage output for ErrorMessage class like you recommended and have reduced the regex to a minimum. I also removed the security violation list of errors and now I just add security tag if a CWE ID exists.

@Nettozx
Copy link
Author

Nettozx commented Jul 16, 2025

Actually I just made a discovery. If I make all the descriptions for the rules blank strings, github will default to the instance specific description for each and this solves the problem. So this should greatly simplify the addition.

@Nettozx Nettozx requested a review from danmar July 17, 2025 03:27
@Nettozx
Copy link
Author

Nettozx commented Jul 17, 2025

@danmar @firewave I updated the description of this PR with latest results and changes. This is ready for review now.

@danmar
Copy link
Owner

danmar commented Jul 17, 2025

Actually I just made a discovery. If I make all the descriptions for the rules blank strings, github will default to the instance specific description for each and this solves the problem. So this should greatly simplify the addition.

That is so much better 👍

Sounds like it will both simplify our job and make the user experience better.

@Nettozx Nettozx requested a review from danmar July 17, 2025 21:48
Copy link

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.

3 participants