public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] CodeQL Analysis in edk2
@ 2023-11-07 15:43 Michael Kubacki
  2023-11-13 13:39 ` Laszlo Ersek
  2024-02-27 11:39 ` Gerd Hoffmann
  0 siblings, 2 replies; 10+ messages in thread
From: Michael Kubacki @ 2023-11-07 15:43 UTC (permalink / raw)
  To: devel


[-- Attachment #1.1: Type: text/plain, Size: 2665 bytes --]

The series that makes it easy to run CodeQL locally and have access to results from any PR or push to master.

Those that have access can see the results directly in "Code Scanning" in the "Security" tab of the edk2 repo. That may be affected in times like freezes when permissions are adjusted (write permission is needed).

I am hoping we can work together to improve the overall quality of the code and minimize the number of CodeQL alerts.

This is an example of that interface:

*Overview of Issues (many)*

*Example of Details for a Specific Issue*

*---*

*However, you can always download the results for an individual package* from its GitHub Action run. I encourage people to do so.

1. Go to Actions -> CodeQL ( https://github.com/tianocore/edk2/actions/workflows/codeql.yml ) (https://github.com/tianocore/edk2/actions/workflows/codeql.yml). Anything to "master" are results at that point in time on the master branch. Individual PR branches are shown to get results for a specific PR.

2. Download and open the SARIF file for a package. In the commit to master shown above in https://github.com/tianocore/edk2/actions/runs/6779575049, for MdeModulePkg, I would download "MdeModulePkg-CodeQL-SARIF" and unzip.

3. Open the SARIF file to view results. For example, drag/drop the file "codeql-db-mdemodulepkg-debug-0.sarif" into VS Code with the "SARIF Viewer" ( https://marketplace.visualstudio.com/items?itemName=MS-SarifVSCode.sarif-viewer ) installed. It shows all of the issues by file or rule with click to the problem and more details about it. There are other SARIF viewers available as well.

Keep in mind that CodeQL will often not highlight everything that needs to be done to fix an issue. It alerts the developer to an issue and then you need to inspect the code to determine if other code paths or refactoring should be applied.

I will create a wiki page with more user focused information, but I wanted to share some quick info for getting started.

More technical details about how the plugin itself works and applying exceptions are available in its readme - edk2/BaseTools/Plugin/CodeQL/Readme.md at master · tianocore/edk2 (github.com). ( https://github.com/tianocore/edk2/blob/master/BaseTools/Plugin/CodeQL/Readme.md )

Thanks,
Michael


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#110855): https://edk2.groups.io/g/devel/message/110855
Mute This Topic: https://groups.io/mt/102444916/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



[-- Attachment #1.2: Type: text/html, Size: 3943 bytes --]

[-- Attachment #2: dummyfile.0.part --]
[-- Type: image/png, Size: 77392 bytes --]

[-- Attachment #3: dummyfile.1.part --]
[-- Type: image/png, Size: 110086 bytes --]

[-- Attachment #4: dummyfile.2.part --]
[-- Type: image/png, Size: 134058 bytes --]

[-- Attachment #5: dummyfile.3.part --]
[-- Type: image/png, Size: 92021 bytes --]

[-- Attachment #6: dummyfile.4.part --]
[-- Type: image/png, Size: 297236 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-02-28 11:30 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-07 15:43 [edk2-devel] CodeQL Analysis in edk2 Michael Kubacki
2023-11-13 13:39 ` Laszlo Ersek
2023-11-13 13:42   ` Laszlo Ersek
2023-11-15  0:35     ` Michael Kubacki
2023-11-15 12:00       ` Laszlo Ersek
2024-02-27 11:39 ` Gerd Hoffmann
2024-02-27 16:04   ` Michael Kubacki
2024-02-28  3:43     ` Laszlo Ersek
2024-02-28  3:55       ` Michael Kubacki
2024-02-28 11:29     ` Gerd Hoffmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox