-
Couldn't load subscription status.
- Fork 70
Enhance CERT rules with priority and level tags #895
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Enhance existing CERT C rule queries by adding priority and level metadata tags.
- Inserted
external/cert/priorityandexternal/cert/leveltags into rule headers. - No changes to query logic or tests.
Reviewed Changes
Copilot reviewed 115 out of 115 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| c/cert/src/rules/CON40-C/AtomicVariableTwiceInExpression.ql | Added priority and level metadata |
| c/cert/src/rules/CON39-C/ThreadWasPreviouslyJoinedOrDetached.ql | Added priority and level metadata |
| c/cert/src/rules/CON38-C/PreserveSafetyWhenUsingConditionVariables.ql | Added priority and level metadata |
| c/cert/src/rules/CON37-C/DoNotCallSignalInMultithreadedProgram.ql | Added priority and level metadata |
| c/cert/src/rules/CON36-C/WrapFunctionsThatCanSpuriouslyWakeUpInLoop.ql | Added priority and level metadata |
| c/cert/src/rules/CON35-C/DeadlockByLockingInPredefinedOrder.ql | Added priority and level metadata |
| c/cert/src/rules/CON34-C/ThreadObjectStorageDurationsNotInitialized.ql | Added priority and level metadata |
| c/cert/src/rules/CON34-C/AppropriateThreadObjectStorageDurations.ql | Added priority and level metadata |
| c/cert/src/rules/CON33-C/RaceConditionsWhenUsingLibraryFunctions.ql | Added priority and level metadata |
| c/cert/src/rules/CON32-C/PreventDataRacesWithMultipleThreads.ql | Added priority and level metadata |
| c/cert/src/rules/CON31-C/DoNotDestroyAMutexWhileItIsLocked.ql | Added priority and level metadata |
| c/cert/src/rules/CON31-C/DoNotAllowAMutexToGoOutOfScopeWhileLocked.ql | Added priority and level metadata |
| c/cert/src/rules/CON30-C/CleanUpThreadSpecificStorage.ql | Added priority and level metadata |
| c/cert/src/rules/ARR39-C/DoNotAddOrSubtractAScaledIntegerToAPointer.ql | Added priority and level metadata |
| c/cert/src/rules/ARR38-C/LibraryFunctionArgumentOutOfBounds.ql | Added priority and level metadata |
| c/cert/src/rules/ARR37-C/DoNotUsePointerArithmeticOnNonArrayObjectPointers.ql | Added priority and level metadata |
| c/cert/src/rules/ARR36-C/DoNotSubtractPointersThatDoNotReferToTheSameArray.ql | Added priority and level metadata |
| c/cert/src/rules/ARR36-C/DoNotRelatePointersThatDoNotReferToTheSameArray.ql | Added priority and level metadata |
| c/cert/src/rules/ARR32-C/VariableLengthArraySizeNotInValidRange.ql | Added priority and level metadata |
| c/cert/src/rules/ARR30-C/DoNotFormOutOfBoundsPointersOrArraySubscripts.ql | Added priority and level metadata |
|
I would eventually want to create a set of suites per level, but i see another PR that is in the middle of refactoring suites for CertC #880 ex: - description: CERT C 2016 Level 1 Rules (Priority 12 - Priority 27)
- qlpack: codeql/cert-c-coding-standards
- include:
kind:
- problem
- path-problem
tags contain:
- external/cert/level/l1 |
|
Looks like i have some work to do to automate the generation here 🫤 Was not aware this was a thing |
|
Shutting down this PR 💟 Also this work led to creating a few suites for a quick help - with the
cert-p1.qls#- description: "CERT C Priority P1 (lowest priority) Rules"
# - c/cert/dcl39-c/information-leakage-across-trust-boundaries-c
# - c/cert/sig35-c/do-not-return-from-a-computational-exception-handler
- qlpack: codeql/cert-c-coding-standards
- include:
id:
- c/cert/information-leakage-across-trust-boundaries-c
- c/cert/do-not-return-from-a-computational-exception-handlercert-p2.qls#- description: "CERT C Priority P2 (low priority) Rules"
# - c/cert/dcl40-c/incompatible-object-declarations
# - c/cert/dcl40-c/incompatible-function-declarations
# - c/cert/dcl40-c/excess-length-names-identifiers-not-distinct
# - c/cert/exp39-c/do-not-access-variable-via-pointer-of-incompatible-type
# - c/cert/exp40-c/do-not-modify-constant-objects
# - c/cert/msc38-c/do-not-treat-a-predefined-identifier-as-object
# - c/cert/msc40-c/do-not-violate-in-line-linkage-constraints
# - c/cert/int34-c/expr-shiftedby-negative-or-greater-precision-operand
# - c/cert/int35-c/use-correct-integer-precisions
# - c/cert/int36-c/converting-a-pointer-to-integer-or-integer-to-pointer
# - c/cert/con36-c/wrap-functions-that-can-spuriously-wake-up-in-loop
# - c/cert/con38-c/preserve-safety-when-using-condition-variables
# - c/cert/con41-c/wrap-functions-that-can-fail-spuriously-in-loop
# - c/cert/pre32-c/macro-or-function-args-contain-hash-token
- qlpack: codeql/cert-c-coding-standards
- include:
id:
- c/cert/incompatible-object-declarations
- c/cert/incompatible-function-declarations
- c/cert/excess-length-names-identifiers-not-distinct
- c/cert/do-not-access-variable-via-pointer-of-incompatible-type
- c/cert/do-not-modify-constant-objects
- c/cert/do-not-treat-a-predefined-identifier-as-object
- c/cert/do-not-violate-in-line-linkage-constraints
- c/cert/expr-shiftedby-negative-or-greater-precision-operand
- c/cert/use-correct-integer-precisions
- c/cert/converting-a-pointer-to-integer-or-integer-to-pointer
- c/cert/wrap-functions-that-can-spuriously-wake-up-in-loop
- c/cert/preserve-safety-when-using-condition-variables
- c/cert/wrap-functions-that-can-fail-spuriously-in-loop
- c/cert/macro-or-function-args-contain-hash-tokencert-p3.qls#- description: "CERT C Priority P3 (medium-low priority) Rules"
# - c/cert/dcl31-c/declare-identifiers-before-using-them
# - c/cert/dcl37-c/do-not-declare-or-define-a-reserved-identifier
# - c/cert/dcl38-c/declaring-a-flexible-array-member
# - c/cert/exp44-c/unevaluated-operand-with-side-effect
# - c/cert/pre31-c/side-effects-in-arguments-to-unsafe-macros
- qlpack: codeql/cert-c-coding-standards
- include:
id:
- c/cert/declare-identifiers-before-using-them
- c/cert/do-not-declare-or-define-a-reserved-identifier
- c/cert/declaring-a-flexible-array-member
- c/cert/unevaluated-operand-with-side-effect
- c/cert/side-effects-in-arguments-to-unsafe-macroscert-p4.qls#- description: "CERT C Priority P4 (medium priority) Rules"
# - c/cert/con30-c/clean-up-thread-specific-storage
# - c/cert/con31-c/do-not-destroy-a-mutex-while-it-is-locked
# - c/cert/con31-c/do-not-allow-a-mutex-to-go-out-of-scope-while-locked
# - c/cert/con33-c/race-conditions-when-using-library-functions
# - c/cert/con34-c/appropriate-thread-object-storage-durations
# - c/cert/con35-c/deadlock-by-locking-in-predefined-order
# - c/cert/dcl41-c/variables-inside-switch-statement
# - c/cert/env30-c/do-not-modify-the-return-value-of-certain-functions
# - c/cert/env31-c/env-pointer-is-invalid-after-certain-operations
# - c/cert/env34-c/do-not-store-pointers-returned-by-environment-fun-warn
# - c/cert/exp35-c/do-not-modify-objects-with-temporary-lifetime
# - c/cert/exp36-c/do-not-cast-pointer-to-more-strictly-aligned-pointer-type
# - c/cert/exp37-c/do-not-call-functions-with-incompatible-arguments
# - c/cert/exp43-c/do-not-pass-aliased-pointer-to-restrict-qualified-param
# - c/cert/exp43-c/restrict-pointer-references-overlapping-object
# - c/cert/fio32-c/do-not-perform-file-operations-on-devices
# - c/cert/fio38-c/do-not-copy-a-file-object
# - c/cert/fio40-c/reset-strings-on-fgets-or-fgetws-failure
# - c/cert/fio42-c/close-files-when-they-are-no-longer-needed
# - c/cert/fio44-c/only-use-values-for-fsetpos-that-are-returned-from-fgetpos
# - c/cert/fio46-c/undefined-behavior-accessing-a-closed-file
- qlpack: codeql/cert-c-coding-standards
- include:
id:
- c/cert/clean-up-thread-specific-storage
- c/cert/do-not-destroy-a-mutex-while-it-is-locked
- c/cert/do-not-allow-a-mutex-to-go-out-of-scope-while-locked
- c/cert/race-conditions-when-using-library-functions
- c/cert/appropriate-thread-object-storage-durations
- c/cert/deadlock-by-locking-in-predefined-order
- c/cert/variables-inside-switch-statement
- c/cert/do-not-modify-the-return-value-of-certain-functions
- c/cert/env-pointer-is-invalid-after-certain-operations
- c/cert/do-not-store-pointers-returned-by-environment-fun-warn
- c/cert/do-not-modify-objects-with-temporary-lifetime
- c/cert/do-not-cast-pointer-to-more-strictly-aligned-pointer-type
- c/cert/do-not-call-functions-with-incompatible-arguments
- c/cert/do-not-pass-aliased-pointer-to-restrict-qualified-param
- c/cert/restrict-pointer-references-overlapping-object
- c/cert/do-not-perform-file-operations-on-devices
- c/cert/do-not-copy-a-file-object
- c/cert/reset-strings-on-fgets-or-fgetws-failure
- c/cert/close-files-when-they-are-no-longer-needed
- c/cert/only-use-values-for-fsetpos-that-are-returned-from-fgetpos
- c/cert/undefined-behavior-accessing-a-closed-file |
Description
please enter the description of your change here
Change request type
.ql,.qll,.qlsor unit tests)Rules with added or modified queries
Release change checklist
A change note (development_handbook.md#change-notes) is required for any pull request which modifies:
If you are only adding new rule queries, a change note is not required.
Author: Is a change note required?
🚨🚨🚨
Reviewer: Confirm that format of shared queries (not the .qll file, the
.ql file that imports it) is valid by running them within VS Code.
Reviewer: Confirm that either a change note is not required or the change note is required and has been added.
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
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.
Reviewer
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.