feat(general): add severity metadata to custom policy
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Description
For custom policies, we need to add information about severity. This severity can be other than Unknown in offline (airgapped environment)
I just add metadata.severity object in yaml custom policy definition.
Fixes #884
Checklist:
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have made corresponding changes to the documentation
- [x] I have added tests that prove my feature, policy, or fix is effective and works
- [x] New and existing tests pass locally with my changes
Great, this exactly what i need.
Hi @dtrouillet! Thanks a lot for contributing
the following unit-tests are failing
tests/arm/checks/resource/test_SkipJsonRegexPattern.py::TestSkipJsonRegexPattern::test_no_skip tests/arm/checks/resource/test_SkipJsonRegexPattern.py::TestSkipJsonRegexPattern::test_skip_specific_check
tests/arm/checks/resource/test_SkipJsonRegexPattern.py::TestSkipJsonRegexPattern::test_skip_specific_check_for_folder
tests/arm/checks/resource/test_SkipJsonRegexPattern.py::TestSkipJsonRegexPattern::test_skip_specific_check_specific_file
seems that somehow even passed-checks become failed with this change. we will appreciate your awareness for it (-:
Hi @itai1357 ,
Theses unit tests are in failure on main branch without my pr : https://github.com/bridgecrewio/checkov/actions/runs/9988292968/job/27604459450
Hi @dtrouillet. TNX you are right. my bad
@itai1357 , @achiar99 , can you review this PR please?
@Saarett or @ChanochShayner can you review this pr please.
@ChanochShayner , I just added UT and fix documentation
@ChanochShayner I've made the modifications
@ChanochShayner , I fixed the mypy issue and I added an UT for empty severity in custom policy
@ChanochShayner sorry for the many mistakes, Python is clearly not my favorite language :/
@itai1357, @omryMen , @achiar99 , can you review this PR please?