Skip to content

Commit 12df863

Browse files
Merge pull request #879 from github/michaelrfairhurt/add-additional-cert-rules
Add additional CERT-C rules to rules.csv
2 parents a088de2 + d39ec8d commit 12df863

12 files changed

+63
-31
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
- description: CERT C 2016 (Default)
2+
- qlpack: codeql/cert-c-coding-standards
3+
- include:
4+
kind:
5+
- problem
6+
- path-problem
7+
- external/cert/obligation/rule
8+
- exclude:
9+
tags contain:
10+
- external/cert/default-disabled
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
- description: CERT C 2016 (Recommendations)
2+
- qlpack: codeql/cert-c-coding-standards
3+
- include:
4+
kind:
5+
- problem
6+
- path-problem
7+
- external/cert/obligation/recommendation
8+
- exclude:
9+
tags contain:
10+
- external/cert/default-disabled
+2-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,2 @@
1-
- description: CERT C 2016 (Default)
2-
- qlpack: codeql/cert-c-coding-standards
3-
- include:
4-
kind:
5-
- problem
6-
- path-problem
7-
- exclude:
8-
tags contain:
9-
- external/cert/default-disabled
1+
- description: "DEPRECATED - CERT C 2016 - use cert-c-default.qls instead"
2+
- import: codeql-suites/cert-c-default.qls

c/cert/src/qlpack.yml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ version: 2.45.0-dev
33
description: CERT C 2016
44
suites: codeql-suites
55
license: MIT
6+
default-suite-file: codeql-suites/cert-c-default.qls
67
dependencies:
78
codeql/common-c-coding-standards: '*'
89
codeql/cpp-all: 2.1.1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
- The following query suites have been added or modified for CERT C:
2+
- A new query suite has been created `cert-c-default.qls` to avoid confusion with the CERT C++ query suites. The `cert-default.qls` suite has been deprecated, and will be removed in a future releases, and is replaced by the `cert-c-default.qls` suite.
3+
- The `cert-c-default.qls` suite has been specified as the default for the pack, and will include our most up-to-date coverage for CERT C.
4+
- One new query suite, `cert-c-recommended.qls` has been added to enable running CERT recommendations (as opposed to rules) that will be added in the future.
5+
- The default query suite, `cert-c-default.qls` has been set to exclude CERT recommendations (as opposed to rules) that will be added in the future.
6+
- The following query suites have been added or modified for CERT C++:
7+
- A new query suite has been created `cert-cpp-default.qls` to avoid confusion with the CERT C query suites. The `cert-default.qls` suite has been deprecated, and will be removed in a future releases, and is replaced by the `cert-cpp-default.qls` suite.
8+
- The `cert-cpp-default.qls` suite has been specified as the default for the pack, and will include our most up-to-date coverage for CERT C.
9+
- A new query suite has been created `cert-cpp-single-translation-unit.qls` to avoid confusion with the CERT C query suites. The `cert-single-translation-unit.qls` suite has been deprecated, and will be removed in a future releases, and is replaced by the `cert-cpp-single-translation-unit.qls` suite.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
- description: CERT C++ 2016 (Default)
2+
- qlpack: codeql/cert-cpp-coding-standards
3+
- include:
4+
kind:
5+
- problem
6+
- path-problem
7+
- exclude:
8+
tags contain:
9+
- external/cert/default-disabled
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
- description: CERT C++ 2016 (Single Translation Unit)
2+
- qlpack: codeql/cert-cpp-coding-standards
3+
- include:
4+
kind:
5+
- problem
6+
- path-problem
7+
tags contain:
8+
- scope/single-translation-unit
9+
- exclude:
10+
tags contain:
11+
- external/cert/default-disabled
+2-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,2 @@
1-
- description: CERT C++ 2016 (Default)
2-
- qlpack: codeql/cert-cpp-coding-standards
3-
- include:
4-
kind:
5-
- problem
6-
- path-problem
7-
- exclude:
8-
tags contain:
9-
- external/cert/default-disabled
1+
- description: "DEPRECATED - CERT C++ 2016 - use cert-cpp-default.qls instead"
2+
- import: codeql-suites/cert-cpp-default.qls
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,2 @@
1-
- description: CERT C++ 2016 (Single Translation Unit)
2-
- qlpack: codeql/cert-cpp-coding-standards
3-
- include:
4-
kind:
5-
- problem
6-
- path-problem
7-
tags contain:
8-
- scope/single-translation-unit
9-
- exclude:
10-
tags contain:
11-
- external/cert/default-disabled
1+
- description: "DEPRECATED - CERT C++ 2016 (Single Translation Unit) - use cert-cpp-single-translation-unit.qls instead"
2+
- import: codeql-suites/cert-cpp-single-translation-unit.qls

cpp/cert/src/qlpack.yml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ version: 2.45.0-dev
33
description: CERT C++ 2016
44
suites: codeql-suites
55
license: MIT
6+
default-suite-file: codeql-suites/cert-cpp-default.qls
67
dependencies:
78
codeql/cpp-all: 2.1.1
89
codeql/common-cpp-coding-standards: '*'

rules.csv

+4-1
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,7 @@ c,CERT-C,ERR30-C,Yes,Rule,,,Take care when reading errno,M19-3-1,Contracts4,Hard
515515
c,CERT-C,ERR32-C,Yes,Rule,,,Do not rely on indeterminate values of errno,,Contracts5,Hard,
516516
c,CERT-C,ERR33-C,Yes,Rule,,,Detect and handle standard library errors,MEM52-CPP,Contracts5,Hard,
517517
c,CERT-C,ERR34-C,OutOfScope,Rule,,,Detect errors when converting a string to a number,,,,
518+
c,CERT-C,EXP16-C,Yes,Recommendation,,,Do not compare function pointers to constant values,,Expressions2,Medium,
518519
c,CERT-C,EXP30-C,Yes,Rule,,,Do not depend on the order of evaluation for side effects,EXP50-CPP,SideEffects1,Easy,
519520
c,CERT-C,EXP32-C,Yes,Rule,,,Do not access a volatile object through a nonvolatile reference,,Pointers3,Easy,
520521
c,CERT-C,EXP33-C,Yes,Rule,,,Do not read uninitialized memory,EXP53-CPP,InvalidMemory1,Import,
@@ -530,6 +531,8 @@ c,CERT-C,EXP44-C,Yes,Rule,,,"Do not rely on side effects in operands to sizeof,
530531
c,CERT-C,EXP45-C,Yes,Rule,,,Do not perform assignments in selection statements,M6-2-1,SideEffects1,Medium,
531532
c,CERT-C,EXP46-C,Yes,Rule,,,Do not use a bitwise operator with a Boolean-like operand,,Expressions,Easy,
532533
c,CERT-C,EXP47-C,OutOfScope,Rule,,,Do not call va_arg with an argument of the incorrect type,,,,
534+
c,CERT-C,FIO03-C,Yes,Recommendation,,,Do not make assumptions about fopen() and file creation,,IO5,Hard,
535+
c,CERT-C,FIO21-C,Yes,Recommendation,,,Do not create temporary files in shared directories,,IO5,Easy,
533536
c,CERT-C,FIO30-C,Yes,Rule,,,Exclude user input from format strings,A27-0-1,IO1,Import,
534537
c,CERT-C,FIO32-C,Yes,Rule,,,Do not perform operations on devices that are only appropriate for files,,IO3,Medium,
535538
c,CERT-C,FIO34-C,Yes,Rule,,,Distinguish between characters read from a file and EOF or WEOF,,IO1,Hard,
@@ -569,7 +572,7 @@ c,CERT-C,MSC38-C,Yes,Rule,,,Do not treat a predefined identifier as an object if
569572
c,CERT-C,MSC39-C,Yes,Rule,,,Do not call va_arg() on a va_list that has an indeterminate value,,Contracts7,Hard,
570573
c,CERT-C,MSC40-C,Yes,Rule,,,Do not violate constraints,,Contracts,Very Hard,
571574
c,CERT-C,MSC41-C,OutOfScope,Rule,,,Never hard code sensitive information,,,,
572-
c,CERT-C,POS30-C,OutOfScope,Rule,,,Use the readlink() function properly,,,,
575+
c,CERT-C,POS30-C,Yes,Rule,,,Use the readlink() function properly,,IO5,Hard,
573576
c,CERT-C,POS34-C,OutOfScope,Rule,,,Do not call putenv() with a pointer to an automatic variable as the argument,,,,
574577
c,CERT-C,POS35-C,OutOfScope,Rule,,,Avoid race conditions while checking for the existence of a symbolic link,,,,
575578
c,CERT-C,POS36-C,OutOfScope,Rule,,,Observe correct revocation order while relinquishing privileges,,,,

schemas/rule-package.schema.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@
141141
"obligation": {
142142
"type": "string",
143143
"enum": [
144-
"rule"
144+
"rule",
145+
"recommendation"
145146
]
146147
}
147148
},

0 commit comments

Comments
 (0)