-
Notifications
You must be signed in to change notification settings - Fork 316
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
CWE taxonomy in SARIF report #6373
Comments
Are there any news or updates about this feature request? Are you considering putting this into KICS or is this completely out of scope? |
Thank you guys for this request (and ping). Adding the CWE field to the SARIF output is the easy part, adding the CWE IDs to each query is the meticulous work. If you are willing to contribute to that (even partially), we can start a community effort to cover all the queries. |
Generally, I agree. However, please keep in mind SARIF uses taxonomies for CWE.
We are willing to contribute. However, could you give us some hint/direction on how we should get started? As far as I understood, all the queries are written in Rego. This rule for example: https://github.com/Checkmarx/kics/blob/master/assets/queries/k8s/weak_tls_cipher_suites/query.rego It could be categorized as CWE-326. How/where should we add the CWE information to the query? |
That's great, looking forward to work on this together. And of course would guide you as needed. The CWE would be added to the metadata file of each query - metadata.json in the same directory as the rego file. I'll update here after we add that field and ready to start adding the metadata to the queries. |
@kaplanlior thanks, for working on this. I saw that in the metadata field you have already a field called Is there a way to get a list of all the categories (for example by using: kics, a rego tool or bash/python script/command)? |
That field is used to classify our queries and documentation. See https://docs.kics.io/latest/queries/ for the current values. |
@kaplanlior any updates? |
HI @Jeeppler , We are currently working on adding the CWE field to the queries structure. On the end of next week it should be available. |
@anterosilva1985 awesome, thanks for the update. |
@anterosilva1985 perfect 💯 |
@anterosilva1985 I created a pull-request, adding some CWE numbers: #6839. |
@anterosilva1985 we would like to have the CWE information as Taxonomy in the SARIF report. See my first comment: #6373 (comment). What files would we have to look at? How can we start implementing this feature? Or do you plan to implement this feature? |
Hi @Jeeppler we are already working of this https://github.com/Checkmarx/kics/pull/6845/files#diff-dae007130536ae0dee5d54a30b674656c37a838875ad885f6f1f2bff3371e768R150 |
@anterosilva1985 no, you just add the CWE information as property (a property can be anything). We would like to see the CWE as taxonomy as described here: https://docs.oasis-open.org/sarif/sarif/v2.1.0/os/sarif-v2.1.0-os.html#_Toc34317536. Here is an example of a taxonomy created by GoSec: https://github.com/mercedes-benz/sechub/blob/develop/sechub-pds-solutions/gosec/docker/mocks/mock.sarif.json#L1060 The This is a bit more involved, but has a number of important advantages:
|
Hi @Jeeppler, Be aware of the 2 examples presented in these files:
Note: Examples of empty CWE fields will not exist in the future, as we will complete the values of all queries with the corresponding CWE field as soon as possible. This is just an example for testing purposes in the current KICS version. As you can see in lines 273 to 298, we have information about the taxonomies field and each taxa field related to the CWE item. Does this align with your expectation for the output sarif file? Thanks for the feedback. |
@ArturRibeiro-CX thanks for the detailed explanation. Helped me to understand quickly what the files are about. Generally, it goes into the right direction. However, I validated the files using: https://sarifweb.azurewebsites.net/Validation. I got the following error message: The issue is this section:
The correct would be, that there are multiple relationships. Each relationship has a target: https://docs.oasis-open.org/sarif/sarif/v2.1.0/os/sarif-v2.1.0-os.html#_Toc34317872. With other words: the target is not an array. |
Thanks for the feedback! This is the implementation we want to achieve, having in mind your latest suggestion (in the image below you can see the full relationships list):
Note: We used the Sarif Validator to assure the relationships field was valid. |
@ArturRibeiro-CX the structure in the screenshot looks good. However, I would need to have the entire sarif report, otherwise it is difficult to give a definitive answer. |
Hi Jeeppler, I appreciate your prompt and agile responses! After reviewing the code and implementing the necessary changes, I wanted to share the updated SARIF report format with you:
Note1: It's important to note that these decisions were made following validations with the SARIF validator and Nist Software. While some issues may surface during these validations, we believe that the overall structure and the final SARIF report align with our expectation. We welcome any further discussion on potential improvements or adjustments based on your feedback. Thank you for your insights, and I look forward to hearing from you soon. |
@ArturRibeiro-CX looks good to me. Checked it and tested it with SecHub. Works for us. In addition, thanks for the link to the NIST Validator. |
feat(query): added CWE infos to common and dockerfile queries #6373
Hi @Jeeppler @haerter-tss , Thank you for your feedback and contributions! Just to let you know that the PRs in charge to add this feature into KICS were merged. In the next weeks we will release a new KICS version (v1.7.13), and that version will contain this new feature as well. |
@gabriel-cx thank you for the collaboration 🥇 |
Description
Common Weakness Enumerations (CWE) are a general taxonomy for classes of security issues. They are commonly used in security products. For example, some static application security testing tools providing CWE IDs: Checkmarx SAST, FindSecurityBugs and GoSec.
The SARIF output of Kics does not contain CWE IDs. It would be nice to have the CWE taxonomy implemented in Kics. The SARIF standard contains an element for taxonomies in general and the CWE taxonomy in particular: https://docs.oasis-open.org/sarif/sarif/v2.1.0/os/sarif-v2.1.0-os.html#_Toc34317536.
The text was updated successfully, but these errors were encountered: