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

Added Kics Error count properties TEST_KEYWORDS=repository_kics_test #3402

Merged
merged 8 commits into from
Mar 5, 2024

Conversation

TommyE123
Copy link
Contributor

@TommyE123 TommyE123 commented Mar 3, 2024

Link to issue: #3392

Fixes

The Kics linter is incorrectly reporting the number of errors. This discrepancy becomes apparent when running the linter on files with multiple warnings or errors, as MegaLinter incorrectly displays "1" error instead of the actual count in the summary.

The linter descriptor must contain properties cli_lint_errors_count and cli_lint_errors_regex to be able to count the errors by getting info from the linter output log.

Proposed Changes

  1. Added to: KICS descriptor
cli_lint_errors_count: regex_number
cli_lint_errors_regex: "TOTAL: ([0-9]+)"

Readiness Checklist

Author/Contributor

  • Add entry to the CHANGELOG listing the change and linking to the corresponding issue (if appropriate)

Reviewing Maintainer

  • Label as breaking if this is a large fundamental change
  • Label as either automation, bug, documentation, enhancement, infrastructure, or performance

@TommyE123
Copy link
Contributor Author

HI @nvuillam,

I believe I have implemented the change you suggested, but I'm not certain how to verify it is working correctly. Do you simply need to approve the test workflow?

I also considered adding ERROR and SUCCESS reports to the automation tests for additional testing when KICS runs. However, since KICS produces quite a bit of output compared to other linters, I wasn't sure if that would work well? I also wasnt sure if this was even needed.
Please advise if you think adding error/success reports would be beneficial or if the current test workflow is sufficient.

Any guidance you can provide on testing the change would be greatly appreciated. Please let me know if you need any clarification or have additional suggestions.

regards
Tom

@nvuillam
Copy link
Member

nvuillam commented Mar 3, 2024

@TommyE123 error and success report files are from a previous version of MegaLinter and i think i broke it somehow ^^

You can add the example fils if you want, it's still good for documentation :)

@nvuillam nvuillam marked this pull request as ready for review March 5, 2024 13:17
Copy link
Member

@nvuillam nvuillam left a comment

Choose a reason for hiding this comment

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

Works for me, thanks for your contribution :)

@nvuillam nvuillam merged commit fed8f3e into oxsecurity:main Mar 5, 2024
6 checks passed
@TommyE123 TommyE123 deleted the kics_count_fix branch April 1, 2024 17:56
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.

None yet

2 participants