From 635564531c7167a5fc6e29781b7dc7a735208d5c Mon Sep 17 00:00:00 2001 From: Alex Denisov Date: Fri, 17 Mar 2023 11:17:44 +0100 Subject: [PATCH 1/2] Swift: add a query showing successfully extracted files (cherry picked from commit 7c1552730045a9f6a8dfdbaef2c6ffd116c96b44) --- .../src/diagnostics/SuccessfullyExtractedFiles.ql | 15 +++++++++++++++ .../SuccessfullyExtractedFiles.expected | 1 + .../Diagnostics/SuccessfullyExtractedFiles.qlref | 1 + swift/ql/test/query-tests/Diagnostics/error.swift | 2 ++ swift/ql/test/query-tests/Diagnostics/main.swift | 0 5 files changed, 19 insertions(+) create mode 100644 swift/ql/src/diagnostics/SuccessfullyExtractedFiles.ql create mode 100644 swift/ql/test/query-tests/Diagnostics/SuccessfullyExtractedFiles.expected create mode 100644 swift/ql/test/query-tests/Diagnostics/SuccessfullyExtractedFiles.qlref create mode 100644 swift/ql/test/query-tests/Diagnostics/error.swift create mode 100644 swift/ql/test/query-tests/Diagnostics/main.swift diff --git a/swift/ql/src/diagnostics/SuccessfullyExtractedFiles.ql b/swift/ql/src/diagnostics/SuccessfullyExtractedFiles.ql new file mode 100644 index 00000000000..e65734a1d88 --- /dev/null +++ b/swift/ql/src/diagnostics/SuccessfullyExtractedFiles.ql @@ -0,0 +1,15 @@ +/** + * @name Successfully extracted files + * @description Lists all files in the source code directory that were extracted without encountering a problem in the file. + * @kind diagnostic + * @id swift/diagnostics/successfully-extracted-files + * @tags successfully-extracted-files + */ + +import swift + +from File f +where + not exists(CompilerError e | e.getFile() = f) and + f.getBaseName().regexpMatch(".*\\.swift\\z") +select f, "File successfully extracted." diff --git a/swift/ql/test/query-tests/Diagnostics/SuccessfullyExtractedFiles.expected b/swift/ql/test/query-tests/Diagnostics/SuccessfullyExtractedFiles.expected new file mode 100644 index 00000000000..6f7928d5adb --- /dev/null +++ b/swift/ql/test/query-tests/Diagnostics/SuccessfullyExtractedFiles.expected @@ -0,0 +1 @@ +| main.swift:0:0:0:0 | main.swift | File successfully extracted. | diff --git a/swift/ql/test/query-tests/Diagnostics/SuccessfullyExtractedFiles.qlref b/swift/ql/test/query-tests/Diagnostics/SuccessfullyExtractedFiles.qlref new file mode 100644 index 00000000000..5cdfe870715 --- /dev/null +++ b/swift/ql/test/query-tests/Diagnostics/SuccessfullyExtractedFiles.qlref @@ -0,0 +1 @@ +diagnostics/SuccessfullyExtractedFiles.ql diff --git a/swift/ql/test/query-tests/Diagnostics/error.swift b/swift/ql/test/query-tests/Diagnostics/error.swift new file mode 100644 index 00000000000..3f153f68bc3 --- /dev/null +++ b/swift/ql/test/query-tests/Diagnostics/error.swift @@ -0,0 +1,2 @@ +//codeql-extractor-expected-status: 1 +#error("Uh oh") \ No newline at end of file diff --git a/swift/ql/test/query-tests/Diagnostics/main.swift b/swift/ql/test/query-tests/Diagnostics/main.swift new file mode 100644 index 00000000000..e69de29bb2d From ccb816ed844dcef50765138db161d9de262291a4 Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Thu, 23 Mar 2023 10:22:18 +0100 Subject: [PATCH 2/2] Java: autoformat --- java/ql/src/Security/CWE/CWE-190/ArithmeticTainted.ql | 3 ++- .../Security/CWE/CWE-200/TempDirLocalInformationDisclosure.ql | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/java/ql/src/Security/CWE/CWE-190/ArithmeticTainted.ql b/java/ql/src/Security/CWE/CWE-190/ArithmeticTainted.ql index 99d9879d19e..c4294e92ef0 100644 --- a/java/ql/src/Security/CWE/CWE-190/ArithmeticTainted.ql +++ b/java/ql/src/Security/CWE/CWE-190/ArithmeticTainted.ql @@ -37,7 +37,8 @@ module RemoteUserInputOverflow = TaintTracking::Make; module Flow = - DataFlow::MergePathGraph; + DataFlow::MergePathGraph; import Flow::PathGraph diff --git a/java/ql/src/Security/CWE/CWE-200/TempDirLocalInformationDisclosure.ql b/java/ql/src/Security/CWE/CWE-200/TempDirLocalInformationDisclosure.ql index 76998b40b50..6d99eba59c2 100644 --- a/java/ql/src/Security/CWE/CWE-200/TempDirLocalInformationDisclosure.ql +++ b/java/ql/src/Security/CWE/CWE-200/TempDirLocalInformationDisclosure.ql @@ -261,7 +261,9 @@ module InsecureMethodPathGraph implements DataFlow::PathGraphSig; + DataFlow::MergePathGraph; import Flow::PathGraph