File tree Expand file tree Collapse file tree 9 files changed +172
-0
lines changed
csharp/ql/src/Diagnostics
javascript/ql/src/Diagnostics
python/ql/src/Diagnostics
ruby/ql/src/queries/diagnostics
rust/ql/src/queries/diagnostics Expand file tree Collapse file tree 9 files changed +172
-0
lines changed Original file line number Diff line number Diff line change
1
+ /**
2
+ * @name Extraction errors msft
3
+ * @description List all extraction errors for files in the source code directory.
4
+ * @id cpp/extractor-error-msft
5
+ * @kind problem
6
+ * @tags security
7
+ * extraction
8
+ */
9
+
10
+ import cpp
11
+ import ExtractionErrors
12
+
13
+ from ExtractionError error
14
+ select error .getFile ( ) , error .getErrorMessage ( )
15
+
16
+
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @name Extraction error msft
3
+ * @description An error message reported by the extractor, limited to those files where there are no
4
+ * compilation errors. This indicates a bug or limitation in the extractor, and could lead
5
+ * to inaccurate results.
6
+ * @id cs/extractor-error-msft
7
+ * @kind problem
8
+ * @tags security
9
+ * extraction
10
+ */
11
+
12
+ import csharp
13
+ import semmle.code.csharp.commons.Diagnostics
14
+
15
+ from ExtractorError error
16
+ select error .getLocation ( ) .getFile ( ) , error .getText ( )
17
+
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @name Extraction errors msft
3
+ * @description List all extraction errors for files in the source code directory.
4
+ * @id go/extractor-error-msft
5
+ * @kind problem
6
+ * @tags security
7
+ * extraction
8
+ */
9
+
10
+ import go
11
+ import semmle.go.DiagnosticsReporting
12
+
13
+ // Go does not have warnings, so all errors have error severity
14
+ predicate reportableDiagnosticsMsft ( Diagnostic d , File f , string msg ) {
15
+ // Only report errors for files that would have been extracted
16
+ f = d .getFile ( ) and
17
+ exists ( f .getAChild ( ) ) and
18
+ msg = removeAbsolutePaths ( d .getMessage ( ) )
19
+ }
20
+
21
+ from Diagnostic d , File f , string msg
22
+ where reportableDiagnostics ( d , f , msg )
23
+ select f , msg
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @name Extraction errors msft
3
+ * @description A list of extraction errors for files in the source code directory.
4
+ * @id java/extractor-error-msft
5
+ * @kind problem
6
+ * @tags security
7
+ * extraction
8
+ */
9
+
10
+ import java
11
+ import DiagnosticsReporting
12
+
13
+ private predicate knownErrorsMsft ( Diagnostic d , File f , string msg ) {
14
+ d .getSeverity ( ) = [ 6 , 7 , 8 ] and
15
+ f = d .getLocation ( ) .getFile ( )
16
+ msg = d .getMessage ( )
17
+ }
18
+
19
+ private predicate unknownErrorsMsft ( Diagnostic d , File f , string msg ) {
20
+ not knownErrors ( d , _, _) and
21
+ d .getSeverity ( ) > 3 and
22
+ d .getLocation ( ) .getFile ( ) = f and
23
+ exists ( f .getRelativePath ( ) ) and
24
+ msg = "Unknown error"
25
+ }
26
+
27
+ from Diagnostic d , File f , string msg
28
+ where
29
+ knownErrorsMsft ( Diagnostic d , File f , string msg ) or
30
+ unknownErrorsMsft( Diagnostic d, File f , string msg )
31
+ select f, msg
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @name Extraction errors msft
3
+ * @description List all extraction errors for files in the source code directory.
4
+ * @id js/extractor-error-msft
5
+ * @kind problem
6
+ * @tags security
7
+ * extraction
8
+ */
9
+
10
+ import javascript
11
+
12
+ from Error error
13
+ where
14
+ exists ( error .getFile ( ) .getRelativePath ( ) ) and
15
+ error .isFatal ( )
16
+ select error .getFile ( ) , error .getMessage ( )
17
+
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @name Python extraction warnings msft
3
+ * @description List all extraction warnings for Python files in the source code directory.
4
+ * @id py/extractor-error-msft
5
+ * @kind problem
6
+ * @tags security
7
+ * extraction
8
+ */
9
+
10
+ import python
11
+
12
+ from SyntaxError error , File file
13
+ where
14
+ file = error .getFile ( ) and
15
+ exists ( file .getRelativePath ( ) )
16
+ select file , error .getMessage ( )
17
+
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @name Extraction errors msft
3
+ * @description List all extraction errors for files in the source code directory.
4
+ * @id rb/extractor-error-msft
5
+ * @kind problem
6
+ * @tags security
7
+ * extraction
8
+ */
9
+
10
+ import codeql.ruby.AST
11
+ import codeql.ruby.Diagnostics
12
+
13
+ from ExtractionError error , File f
14
+ where
15
+ f = error .getLocation ( ) .getFile ( ) and
16
+ exists ( f .getRelativePath ( ) )
17
+ select f , error .getMessage ( )
18
+
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @name Extraction errors msft
3
+ * @description List all extraction errors for files in the source code directory.
4
+ * @id rust/extractor-error-msft
5
+ * @kind problem
6
+ * @tags security
7
+ * extraction
8
+ */
9
+
10
+ import codeql.rust.Diagnostics
11
+ import codeql.files.FileSystem
12
+
13
+ from ExtractionError error , File f
14
+ where
15
+ f = error .getLocation ( ) .getFile ( ) and
16
+ exists ( f .getRelativePath ( ) )
17
+ select f , error .getMessage ( )
18
+
19
+
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @name Compiler errors msft
3
+ * @description List all compiler errors for files in the source code directory.
4
+ * @id swift/extractor-error-msft
5
+ * @kind problem
6
+ * @tags security
7
+ * extraction
8
+ */
9
+
10
+ import swift
11
+
12
+ from CompilerError error
13
+ select error .getFile ( ) , error .getText ( )
14
+
You can’t perform that action at this time.
0 commit comments