Skip to content

Modernize qlpacks #72

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

Closed
wants to merge 18 commits into from
Closed

Modernize qlpacks #72

wants to merge 18 commits into from

Conversation

mbaluda
Copy link
Contributor

@mbaluda mbaluda commented Aug 31, 2022

Description

Merges into main the PR #4

This PR updates the qlpacks and related files to use CodeQL packaging to declare and resolve dependencies. Neither the codeql_modules submodule nor the codeql_home/codeql-stdlib checkout of github/codeql are required anymore. The necessary dependencies can be installed by running python3 scripts/install-packs.py. This need only be run when we update to a new standard library version, but it doesn't hurt to run it after every pull.

None of the codeql commands we run should require --search-path or --additional-packs any longer. References within our repo are resolved automatically because all of our packs are in the same "CodeQL Workspace" (defined by our .codeqlmanifest.json file. References to the standard library are resolved from the package download cache.

Details:

  • Adds codeql/ scope to all pack names, which is necessary to publish packs to the pack registry. Note that we don't actually publish to the package registry yet.
  • Uses dependencies: map instead of libraryPathDependencies: list. The '*' version indicates that the referenced pack will be found in the local workspace, rather than downloaded from the registry.
  • Folds the .codeqlmanifest.json in the cpp directory into the root .codeqlmanifest.json. All pack references should resolve automatically now, without a need for --search-path
  • Adds .codeql directories to .gitignore. .codeql is where the output of building a query or library pack is placed.
  • Removes --search-path and --additional-packs from all of our CI workflows.
  • Adds a new composite Action to install the standard library dependencies.
  • Adds a new workflow to validate that the actual standard library dependencies specified in the various qlpack.yml files match the versions in the github/codeql commit specified in supported_codeql_configs.json. The script used by this workflow will also be used, in a future PR, in the workflow to update to a new toolset version.
  • Updates the developer handbook with the necessary information.

Change request type

  • Release or process automation (GitHub workflows, internal scripts)
  • Internal documentation
  • External documentation
  • Query files (.ql, .qll, .qls or unit tests)
  • External scripts (analysis report or other code shipped as part of a release)

Rules with added or modified queries

  • No rules added
  • Queries have been added for the following rules:
    • rule number here
  • Queries have been modified for the following rules:
    • rule number here

Release change checklist

A change note (development_handbook.md#change-notes) is required for any pull request which modifies:

  • The structure or layout of the release artifacts.
  • The evaluation performance (memory, execution time) of an existing query.
  • The results of an existing query in any circumstance.

If you are only adding new rule queries, a change note is not required.

Author: Is a change note required?

  • Yes
  • No

Reviewer: Confirm that either a change note is not required or the change note is required and has been added.

  • Confirmed

Query development review checklist

For PRs that add new queries or modify existing queries, the following checklist should be completed by both the author and reviewer:

Author

  • Have all the relevant rule package description files been checked in?
  • Have you verified that the metadata properties of each new query is set appropriately?
  • Do all the unit tests contain both "COMPLIANT" and "NON_COMPLIANT" cases?
  • Are the alert messages properly formatted and consistent with the style guide?
  • Have you run the queries on OpenPilot and verified that the performance and results are acceptable?
    As a rule of thumb, predicates specific to the query should take no more than 1 minute, and for simple queries be under 10 seconds. If this is not the case, this should be highlighted and agreed in the code review process.
  • Does the query have an appropriate level of in-query comments/documentation?
  • Have you considered/identified possible edge cases?
  • Does the query not reinvent features in the standard library?
  • Can the query be simplified further (not golfed!)

Reviewer

  • Have all the relevant rule package description files been checked in?
  • Have you verified that the metadata properties of each new query is set appropriately?
  • Do all the unit tests contain both "COMPLIANT" and "NON_COMPLIANT" cases?
  • Are the alert messages properly formatted and consistent with the style guide?
  • Have you run the queries on OpenPilot and verified that the performance and results are acceptable?
    As a rule of thumb, predicates specific to the query should take no more than 1 minute, and for simple queries be under 10 seconds. If this is not the case, this should be highlighted and agreed in the code review process.
  • Does the query have an appropriate level of in-query comments/documentation?
  • Have you considered/identified possible edge cases?
  • Does the query not reinvent features in the standard library?
  • Can the query be simplified further (not golfed!)

mbaluda and others added 3 commits August 31, 2022 17:17
Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com>
@mbaluda mbaluda marked this pull request as ready for review August 31, 2022 16:51
@mbaluda mbaluda requested a review from a team August 31, 2022 16:53
@mbaluda mbaluda self-assigned this Aug 31, 2022
@mbaluda
Copy link
Contributor Author

mbaluda commented Sep 2, 2022

The new qlpacks break the release automation
https://github.com/github/codeql-coding-standards-release-engineering/runs/8157624290
I created another PR that just updates CodeQL: #77

@mbaluda mbaluda changed the title Modernize qlpacks and update to CodeQL 2.9.4 Modernize qlpacks Sep 2, 2022
@jketema
Copy link
Collaborator

jketema commented Dec 8, 2022

Once this is revisited, this will also need the changes from #151

@mbaluda mbaluda closed this Feb 3, 2023
@mbaluda mbaluda deleted the mbaluda/updateql2.9.4 branch March 2, 2023 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

2 participants