Compare commits

...

349 Commits

Author SHA1 Message Date
tiferet
f9dd7cf9db ATM model for a DCA experiment
New features: Shipping model. 9 new features, remove the old ones that have been replaced by new ones. The codeql PR has been rebased on top of main. #7 (with a fixed package version)

https://ml.azure.com/runs/classification_1663364335_afeafbe1?wsid=/subscriptions/91095667-e119-4555-acea-1826488492f0/resourcegroups/ATM-CodeML/workspaces/ATM-Workspace&tid=398a6654-997b-47e9-b12b-9515b896b4de
2022-09-19 10:48:32 -07:00
tiferet
4ee15fe670 ATM model for a DCA experiment
New features: Shipping model. 9 new features, remove the old ones that have been replaced by new ones. The codeql PR has been rebased on top of main. #6 (with a fixed package version)

https://ml.azure.com/runs/classification_1663349992_863d12bf?wsid=/subscriptions/91095667-e119-4555-acea-1826488492f0/resourcegroups/ATM-CodeML/workspaces/ATM-Workspace&tid=398a6654-997b-47e9-b12b-9515b896b4de
2022-09-19 10:47:22 -07:00
tiferet
4935be5ad7 ATM model for a DCA experiment
New features: Shipping model. 9 new features, remove the old ones that have been replaced by new ones. The codeql PR has been rebased on top of main. #5 (with a fixed package version)

https://ml.azure.com/runs/classification_1663349979_cac47272?wsid=/subscriptions/91095667-e119-4555-acea-1826488492f0/resourcegroups/ATM-CodeML/workspaces/ATM-Workspace&tid=398a6654-997b-47e9-b12b-9515b896b4de
2022-09-19 10:46:02 -07:00
tiferet
a9fb57958a ATM model for a DCA experiment
New features: Shipping model. 9 new features, remove the old ones that have been replaced by new ones. The codeql PR has been rebased on top of main. #4 (with a fixed package version)

https://ml.azure.com/runs/classification_1663349964_06299f9c?wsid=/subscriptions/91095667-e119-4555-acea-1826488492f0/resourcegroups/ATM-CodeML/workspaces/ATM-Workspace&tid=398a6654-997b-47e9-b12b-9515b896b4de
2022-09-19 10:44:53 -07:00
tiferet
08ca55afb1 ATM model for a DCA experiment
New features: Shipping model. 9 new features, remove the old ones that have been replaced by new ones. The codeql PR has been rebased on top of main. #3 (with a fixed package version)

https://ml.azure.com/experiments/id/85e6e910-7301-4441-9079-01a1e42fd45b/runs/classification_1662479795_acd730eb?wsid=/subscriptions/91095667-e119-4555-acea-1826488492f0/resourceGroups/atm-codeml/providers/Microsoft.MachineLearningServices/workspaces/ATM-workspace&tid=398a6654-997b-47e9-b12b-9515b896b4de
2022-09-19 10:42:56 -07:00
tiferet
91b576526d ATM model for a DCA experiment
New features: Shipping model. 9 new features, remove the old ones that have been replaced by new ones. The codeql PR has been rebased on top of main. #2 (with a fixed package version)

https://ml.azure.com/experiments/id/85e6e910-7301-4441-9079-01a1e42fd45b/runs/classification_1662479760_3a49ddf5?wsid=/subscriptions/91095667-e119-4555-acea-1826488492f0/resourceGroups/atm-codeml/providers/Microsoft.MachineLearningServices/workspaces/ATM-workspace&tid=398a6654-997b-47e9-b12b-9515b896b4de
2022-09-19 10:41:53 -07:00
tiferet
9d4822a649 ATM model for a DCA experiment
New features: Shipping model. 9 new features, remove the old ones that have been replaced by new ones. The codeql PR has been rebased on top of main. #1 (with a fixed package version)

https://ml.azure.com/experiments/id/85e6e910-7301-4441-9079-01a1e42fd45b/runs/classification_1662479739_96a8f309?wsid=/subscriptions/91095667-e119-4555-acea-1826488492f0/resourceGroups/atm-codeml/providers/Microsoft.MachineLearningServices/workspaces/ATM-workspace&tid=398a6654-997b-47e9-b12b-9515b896b4de
2022-09-19 10:33:53 -07:00
tiferet
3d09153051 ATM model for a DCA experiment
New features: Shipping model. 9 new features, remove the old ones that have been replaced by new ones. The codeql PR has been rebased on top of main. #3 (with a fixed package version)

https://ml.azure.com/experiments/id/85e6e910-7301-4441-9079-01a1e42fd45b/runs/classification_1662479795_acd730eb?wsid=/subscriptions/91095667-e119-4555-acea-1826488492f0/resourceGroups/atm-codeml/providers/Microsoft.MachineLearningServices/workspaces/ATM-workspace&tid=398a6654-997b-47e9-b12b-9515b896b4de
2022-09-16 11:12:52 -07:00
tiferet
e197f03c5f ATM model for a DCA experiment
New features: Shipping model. 9 new features, remove the old ones that have been replaced by new ones. The codeql PR has been rebased on top of main. #1 (with a fixed package version)

https://ml.azure.com/experiments/id/85e6e910-7301-4441-9079-01a1e42fd45b/runs/classification_1662479739_96a8f309?wsid=/subscriptions/91095667-e119-4555-acea-1826488492f0/resourceGroups/atm-codeml/providers/Microsoft.MachineLearningServices/workspaces/ATM-workspace&tid=398a6654-997b-47e9-b12b-9515b896b4de
2022-09-16 11:11:47 -07:00
tiferet
9116817445 ATM model for a DCA experiment
New features: Shipping model. 9 new features, remove the old ones that have been replaced by new ones. The codeql PR has been rebased on top of main. #3

https://ml.azure.com/experiments/id/85e6e910-7301-4441-9079-01a1e42fd45b/runs/classification_1662479795_acd730eb?wsid=/subscriptions/91095667-e119-4555-acea-1826488492f0/resourceGroups/atm-codeml/providers/Microsoft.MachineLearningServices/workspaces/ATM-workspace&tid=398a6654-997b-47e9-b12b-9515b896b4de
2022-09-07 10:09:32 -07:00
tiferet
bc652f7b7a ATM model for a DCA experiment
New features: Shipping model. 9 new features, remove the old ones that have been replaced by new ones. The codeql PR has been rebased on top of main. #2

https://ml.azure.com/experiments/id/85e6e910-7301-4441-9079-01a1e42fd45b/runs/classification_1662479760_3a49ddf5?wsid=/subscriptions/91095667-e119-4555-acea-1826488492f0/resourceGroups/atm-codeml/providers/Microsoft.MachineLearningServices/workspaces/ATM-workspace&tid=398a6654-997b-47e9-b12b-9515b896b4de
2022-09-07 10:08:37 -07:00
tiferet
657aa600dc ATM model for a DCA experiment
New features: Shipping model. 9 new features, remove the old ones that have been replaced by new ones. The codeql PR has been rebased on top of main. #1

https://ml.azure.com/experiments/id/85e6e910-7301-4441-9079-01a1e42fd45b/runs/classification_1662479739_96a8f309?wsid=/subscriptions/91095667-e119-4555-acea-1826488492f0/resourceGroups/atm-codeml/providers/Microsoft.MachineLearningServices/workspaces/ATM-workspace&tid=398a6654-997b-47e9-b12b-9515b896b4de
2022-09-07 10:07:32 -07:00
tiferet
decde6d32d ATM model for a DCA experiment
Optimization and inter-model variance: Use a fourteenth shipping model with the nine new features. Randomly subsample to keep only 50% of the training DBs (although we still use all validation DBs).

https://ml.azure.com/runs/classification_1661795142_49c13ac0?wsid=/subscriptions/91095667-e119-4555-acea-1826488492f0/resourcegroups/ATM-CodeML/workspaces/ATM-Workspace&tid=398a6654-997b-47e9-b12b-9515b896b4de
2022-08-29 14:56:19 -07:00
tiferet
c64f442d97 ATM model for a DCA experiment
Optimization and inter-model variance: Use a thirteenth shipping model with the nine new features. Randomly subsample to keep only 50% of DBs (for both training and validation).

https://ml.azure.com/runs/classification_1661795129_1bdde409?wsid=/subscriptions/91095667-e119-4555-acea-1826488492f0/resourcegroups/ATM-CodeML/workspaces/ATM-Workspace&tid=398a6654-997b-47e9-b12b-9515b896b4de
2022-08-29 14:40:49 -07:00
tiferet
c9d9f638fb ATM model for a DCA experiment
Optimization and inter-model variance: Use a twelfth shipping model with the nine new features. Randomly subsample to keep only 25% of the training DBs (although we still use all validation DBs).

https://ml.azure.com/runs/classification_1661795071_311d6468?wsid=/subscriptions/91095667-e119-4555-acea-1826488492f0/resourcegroups/ATM-CodeML/workspaces/ATM-Workspace&tid=398a6654-997b-47e9-b12b-9515b896b4de
2022-08-29 14:36:57 -07:00
tiferet
60e770a53d ATM model for a DCA experiment
Optimization and inter-model variance: Use a twelfth shipping model with the nine new features. Randomly subsample to keep only 50% of DBs (for both training and validation).

https://ml.azure.com/runs/classification_1661794494_cd63e7d4?wsid=/subscriptions/91095667-e119-4555-acea-1826488492f0/resourcegroups/ATM-CodeML/workspaces/ATM-Workspace&tid=398a6654-997b-47e9-b12b-9515b896b4de
2022-08-29 14:28:04 -07:00
tiferet
e4d0307b06 ATM model for a DCA experiment
Optimization and inter-model variance: Use a eleventh shipping model with the nine new features. Randomly subsample to keep only 25% of the training DBs (although we still use all validation DBs).

https://ml.azure.com/runs/classification_1661795057_44bc24a7?wsid=/subscriptions/91095667-e119-4555-acea-1826488492f0/resourcegroups/ATM-CodeML/workspaces/ATM-Workspace&tid=398a6654-997b-47e9-b12b-9515b896b4de
2022-08-29 14:17:56 -07:00
tiferet
9d13865f3f ATM model for a DCA experiment
Optimization and inter-model variance: Use a tenth shipping model with the nine new features. Randomly subsample to keep only 10% of the training DBs (although we still use all validation DBs).

https://ml.azure.com/runs/classification_1661794950_a38f87fc?wsid=/subscriptions/91095667-e119-4555-acea-1826488492f0/resourcegroups/ATM-CodeML/workspaces/ATM-Workspace&tid=398a6654-997b-47e9-b12b-9515b896b4de
2022-08-29 13:13:00 -07:00
tiferet
0f028ed7c8 ATM model for a DCA experiment
Optimization and inter-model variance: Use a ninth shipping model with the nine new features. Randomly subsample to keep only 10% of the training DBs (although we still use all validation DBs).

https://ml.azure.com/runs/classification_1661794934_fc5db59f?wsid=/subscriptions/91095667-e119-4555-acea-1826488492f0/resourcegroups/ATM-CodeML/workspaces/ATM-Workspace&tid=398a6654-997b-47e9-b12b-9515b896b4de
2022-08-29 12:38:36 -07:00
tiferet
86b8f75561 ATM model for a DCA experiment
Inter-model variance: Use a eighth shipping model with the nine new features. Double the num_dense_filters and size_embedding and increase the vocab_size.

        https://ml.azure.com/experiments/id/85e6e910-7301-4441-9079-01a1e42fd45b/runs/classification_1655305118_aa676419?wsid=/subscriptions/91095667-e119-4555-acea-1826488492f0/resourceGroups/
atm-codeml/providers/Microsoft.MachineLearningServices/workspaces/ATM-workspace&tid=398a6654-997b-47e9-b12b-9515b896b4de
2022-08-23 08:55:01 -07:00
tiferet
c321b8f030 ATM model for a DCA experiment
Inter-model variance: Use a seventh shipping model with the nine new features. Halve the num_dense_filters and size_embedding and lower the vocab_size.

        https://ml.azure.com/experiments/id/85e6e910-7301-4441-9079-01a1e42fd45b/runs/classification_1655305118_aa676419?wsid=/subscriptions/91095667-e119-4555-acea-1826488492f0/resourceGroups/
atm-codeml/providers/Microsoft.MachineLearningServices/workspaces/ATM-workspace&tid=398a6654-997b-47e9-b12b-9515b896b4de
2022-08-23 08:53:37 -07:00
tiferet
fedd718006 ATM model for a DCA experiment
Inter-model variance: Use a sixth shipping model with the nine new features.

        https://ml.azure.com/experiments/id/85e6e910-7301-4441-9079-01a1e42fd45b/runs/classification_1655305118_aa676419?wsid=/subscriptions/91095667-e119-4555-acea-1826488492f0/resourceGroups/
atm-codeml/providers/Microsoft.MachineLearningServices/workspaces/ATM-workspace&tid=398a6654-997b-47e9-b12b-9515b896b4de
2022-08-23 08:52:01 -07:00
tiferet
f0cbc2837a ATM model for a DCA experiment
Inter-model variance: Use a fifth shipping model with the nine new features.

        https://ml.azure.com/experiments/id/85e6e910-7301-4441-9079-01a1e42fd45b/runs/classification_1655305118_aa676419?wsid=/subscriptions/91095667-e119-4555-acea-1826488492f0/resourceGroups/
atm-codeml/providers/Microsoft.MachineLearningServices/workspaces/ATM-workspace&tid=398a6654-997b-47e9-b12b-9515b896b4de
2022-08-23 08:50:52 -07:00
tiferet
6f13117a8f ATM model for a DCA experiment
Inter-model variance: Use a fourth shipping model with the nine new features.

        https://ml.azure.com/experiments/id/85e6e910-7301-4441-9079-01a1e42fd45b/runs/classification_1655305118_aa676419?wsid=/subscriptions/91095667-e119-4555-acea-1826488492f0/resourceGroups/
atm-codeml/providers/Microsoft.MachineLearningServices/workspaces/ATM-workspace&tid=398a6654-997b-47e9-b12b-9515b896b4de
2022-08-23 08:49:45 -07:00
tiferet
56d79c6ca4 ATM model for a DCA experiment
Feature selection: Use a shipping model with the new features excluding fileImports and calleeImports. Model #3.

https://github.com/github/ml-ql-adaptive-threat-modeling/issues/1968#issuecomment-1192645515
2022-08-03 08:13:20 -07:00
tiferet
63b5aecd87 ATM model for a DCA experiment
Feature selection: Use a shipping model with the new features excluding fileImports and calleeImports. Model #2.

https://github.com/github/ml-ql-adaptive-threat-modeling/issues/1968#issuecomment-1192645515
2022-08-03 08:11:47 -07:00
tiferet
b231e801eb ATM model for a DCA experiment
Feature selection: Use a shipping model with the new features excluding fileImports and calleeImports.

https://github.com/github/ml-ql-adaptive-threat-modeling/issues/1968#issuecomment-1192645515
2022-08-01 14:14:27 -07:00
tiferet
2f331b26a8 ATM model for a DCA experiment
Feature selection: Use a shipping model with the new features excluding fileImports.

https://github.com/github/ml-ql-adaptive-threat-modeling/issues/1968#issuecomment-1192645515
2022-08-01 14:11:32 -07:00
tiferet
5ab8a637fa ATM model for a DCA experiment
Feature selection: Use a shipping model with the new features excluding contextFunctionInterfaces.

https://github.com/github/ml-ql-adaptive-threat-modeling/issues/1968#issuecomment-1192645515
2022-08-01 14:08:41 -07:00
tiferet
def6e0c9bb ATM model for a DCA experiment
Feature selection: Use a shipping model with the new features excluding calleeImports.

https://github.com/github/ml-ql-adaptive-threat-modeling/issues/1968#issuecomment-1192645515
2022-08-01 14:05:39 -07:00
tiferet
37a875151d ATM model for a DCA experiment
Inter-model variance: Use a third shipping model with the nine new features.

    https://ml.azure.com/experiments/id/85e6e910-7301-4441-9079-01a1e42fd45b/runs/classification_1655305118_aa676419?wsid=/subscriptions/91095667-e119-4555-acea-1826488492f0/resourceGroups/atm-codeml/providers/Microsoft.MachineLearningServices/workspaces/ATM-workspace&tid=398a6654-997b-47e9-b12b-9515b896b4de
2022-07-28 11:09:45 -07:00
tiferet
1a7e5b2ef3 ATM model for a DCA experiment
Feature selection: Use a shipping model with the new features excluding contextFunctionInterfaces.

https://github.com/github/ml-ql-adaptive-threat-modeling/issues/1968#issuecomment-1192645515
2022-07-25 20:34:08 -07:00
tiferet
db23293ac8 ATM model for a DCA experiment
Feature selection: Use a shipping model with the new features excluding fileImports and calleeImports.

https://github.com/github/ml-ql-adaptive-threat-modeling/issues/1968#issuecomment-1192645515
2022-07-25 20:32:24 -07:00
tiferet
be9b41512a ATM model for a DCA experiment
Feature selection: Use a shipping model with the new features excluding fileImports.

https://github.com/github/ml-ql-adaptive-threat-modeling/issues/1968#issuecomment-1192645515
2022-07-25 20:30:05 -07:00
tiferet
0e2a6378fe ATM model for a DCA experiment
Feature selection: Use a shipping model with the new features excluding calleeImports.

https://github.com/github/ml-ql-adaptive-threat-modeling/issues/1968#issuecomment-1192645515
2022-07-25 20:23:03 -07:00
tiferet
5bc6d29abe ATM model for a DCA experiment
Use another shipping model with the nine new features:

https://ml.azure.com/experiments/id/85e6e910-7301-4441-9079-01a1e42fd45b/runs/classification_1655305083_0e093911?wsid=/subscriptions/91095667-e119-4555-acea-1826488492f0/resourceGroups/atm-codeml/providers/Microsoft.MachineLearningServices/workspaces/ATM-workspace&tid=398a6654-997b-47e9-b12b-9515b896b4de
2022-07-22 11:56:43 -07:00
Stephan Brandauer
f524794495 use experimental ATM ML model tender basil 2022-07-01 17:09:57 +02:00
Esben Sparre Andreasen
292cf2bf8c use experimental ATM ML model boring nutmeg 2022-07-01 17:05:51 +02:00
Stephan Brandauer
f9773cde65 enable new features for experimentation 2022-06-30 12:39:04 +02:00
Stephan Brandauer
2196be68af add stringConcatenatedWith feature to help the model learn that string concatenation leaves are usually not sinks 2022-06-30 12:39:04 +02:00
Stephan Brandauer
477ed25bcd add assignedToPropName feature to let the model improve number of false positives for XSS query 2022-06-30 12:39:04 +02:00
Stephan Brandauer
b76be24997 fix bug in InputArgumentIndex feature 2022-06-30 12:39:03 +02:00
Stephan Brandauer
7248620b5d performance fixes 2022-06-30 12:39:03 +02:00
Stephan Brandauer
f7a5992685 use ? for unknown parameternames 2022-06-30 12:39:03 +02:00
Stephan Brandauer
71409c6d5e add documentations and rename a feature 2022-06-30 12:39:03 +02:00
Stephan Brandauer
9b9b690fbf add functionInterfacesInFile and surroundingFunctionParameters features 2022-06-30 12:39:02 +02:00
Stephan Brandauer
abbf1b0810 documentation for calleeImports ATM feature 2022-06-30 12:39:02 +02:00
Stephan Brandauer
b128705b75 documentation for new feature 2022-06-30 12:39:02 +02:00
Stephan Brandauer
c47d8fc7ae ATM: new feature to list all imports in an endpoint's file 2022-06-30 12:39:01 +02:00
Esben Sparre Andreasen
36fcd66303 use proper import instead of inlining 2022-06-30 12:39:01 +02:00
Esben Sparre Andreasen
0ffeb6a251 remove Input_ArgumentIndexAndAccessPathFromCallee 2022-06-30 12:39:01 +02:00
Esben Sparre Andreasen
cf0614ecec add docstring examples 2022-06-30 12:39:01 +02:00
Esben Sparre Andreasen
b76a11a88f address review comments 2022-06-30 12:39:00 +02:00
Esben Sparre Andreasen
6b0caf9d9e Apply suggestions from code review
Co-authored-by: Henry Mercer <henrymercer@github.com>
2022-06-30 12:39:00 +02:00
Esben Sparre Andreasen
42ff8698d6 fix semantic merge conflict 2022-06-30 12:39:00 +02:00
Esben Sparre Andreasen
9728bad55f rename new features 2022-06-30 12:39:00 +02:00
Esben Sparre Andreasen
6cc1486165 add more features 2022-06-30 12:38:59 +02:00
Esben Sparre Andreasen
23a7feb92e improve feature documentation 2022-06-30 12:38:59 +02:00
Esben Sparre Andreasen
7c47e717eb improve feature tests with more cases 2022-06-30 12:38:59 +02:00
Esben Sparre Andreasen
aa4ad1e86d improve access path strings 2022-06-30 12:38:59 +02:00
Esben Sparre Andreasen
9993e3396a support import in getSimpleAccessPath 2022-06-30 12:38:58 +02:00
Esben Sparre Andreasen
63cbaeadcb support await in getSimpleAccessPath 2022-06-30 12:38:58 +02:00
Esben Sparre Andreasen
65d526b678 avoid using new feautes by default 2022-06-30 12:38:58 +02:00
Esben Sparre Andreasen
078761b917 add CompareFeatures.ql 2022-06-30 12:38:58 +02:00
Esben Sparre Andreasen
65661add78 add generic tests for features 2022-06-30 12:38:57 +02:00
Esben Sparre Andreasen
d5c6115669 Document EndpointFeatures.qll 2022-06-30 12:38:57 +02:00
Esben Sparre Andreasen
f7dd8242ba add ParameterAccessPathSimpleFromArgumentTraversal 2022-06-30 12:38:57 +02:00
Esben Sparre Andreasen
ec02493d3b improve getSimpleAccessPath 2022-06-30 12:38:57 +02:00
Esben Sparre Andreasen
ed82ffe124 refactor calleeAccessPath feature to class 2022-06-30 12:38:56 +02:00
Stephan Brandauer
0af118c365 refactor getACallBasedTokenFeature to class-use 2022-06-30 12:38:56 +02:00
Esben Sparre Andreasen
2be2715024 Add CalleeAccessPathSimpleFromArgumentTraversal 2022-06-30 12:38:56 +02:00
Esben Sparre Andreasen
66c9c14d53 refactor EndpointFeatures.ql to use classes 2022-06-30 12:38:56 +02:00
AlexDenisov
4367044a8b Merge pull request #9702 from github/alexdenisov/swift-multiple-modules
Swift: emit intermediate build artifacts for own consumption later
2022-06-30 11:24:48 +02:00
AlexDenisov
d42b752c6d Apply suggestions from code review
Co-authored-by: Paolo Tranquilli <redsun82@github.com>
2022-06-30 11:10:43 +02:00
AlexDenisov
b5c1ec8958 Update swift/extractor/SwiftOutputRewrite.cpp
Co-authored-by: Paolo Tranquilli <redsun82@github.com>
2022-06-30 11:08:23 +02:00
AlexDenisov
6b0e734c47 Update swift/extractor/SwiftOutputRewrite.cpp
Co-authored-by: Paolo Tranquilli <redsun82@github.com>
2022-06-30 11:06:03 +02:00
AlexDenisov
b9f4a09f19 Merge branch 'main' into alexdenisov/swift-multiple-modules 2022-06-30 10:13:34 +02:00
AlexDenisov
de9e8855a8 Merge pull request #9759 from github/alexdenisov/fix-test-file
Swift: fix test case
2022-06-30 09:33:19 +02:00
Tony Torralba
48d85407ad Merge pull request #9757 from github/workflow/coverage/update
Update CSV framework coverage reports
2022-06-30 09:21:04 +02:00
Alex Denisov
1dd3141e2d Swift: address more code review comments 2022-06-30 08:57:22 +02:00
Alex Denisov
35da75f685 Swift: rename method 2022-06-30 08:48:36 +02:00
AlexDenisov
522d48aa33 Apply suggestions from code review
Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com>
2022-06-30 08:47:17 +02:00
Alex Denisov
5d5f3f82b1 Swift: fix test case 2022-06-30 07:41:28 +02:00
AlexDenisov
7ee11056d7 Merge pull request #9750 from github/alexdenisov/extract-imported-modules
Swift: also extract imported modules
2022-06-30 07:15:51 +02:00
github-actions[bot]
e9d3f658a3 Add changed framework coverage reports 2022-06-30 00:18:31 +00:00
Andrew Eisenberg
fbeecd6c08 Merge pull request #9744 from github/aeisenberg/move-contextual-queries 2022-06-29 11:44:33 -07:00
Andrew Eisenberg
06c68661ed Merge pull request #9753 from github/aeisenberg/pack-pull-quote
Recommend installing the latest version of the CLI to use packaging
2022-06-29 10:46:24 -07:00
Erik Krogh Kristensen
399fd85fd8 Merge pull request #9748 from erik-krogh/navigation
JS: add navigation.navigate as an XSS / URL sink
2022-06-29 19:34:59 +02:00
Andrew Eisenberg
3c8f415f69 Recommend installing the latest version of the CLI to use packaging 2022-06-29 10:33:27 -07:00
Andrew Eisenberg
7864a7580e Fix import statements 2022-06-29 10:22:45 -07:00
Andrew Eisenberg
ddf06f8617 Add change notes and qldoc for moved files 2022-06-29 10:03:12 -07:00
Alex Denisov
5233a5e17b Swift: also extract imported modules 2022-06-29 17:27:57 +02:00
Andrew Eisenberg
a3f4d1bf66 Move contextual queries from src to lib
With this change, users are now able to run View AST command in
vscode within vscode workspaces that do not include the core libraries.
The relevant core library only needs to be installed in the package
cache.
2022-06-29 07:51:26 -07:00
Alex Ford
578a967160 Merge pull request #9641 from boveus/patch-1
Make ActiveRecordInstanceMethodCall Public
2022-06-29 14:39:36 +01:00
Paolo Tranquilli
d00fec34c3 Merge pull request #9336 from MathiasVP/swift-decls-in-cfg
Swift: CFG for local declarations
2022-06-29 15:10:45 +02:00
Erik Krogh Kristensen
0e4954a68c add navigation.navigate as an XSS / URL sink 2022-06-29 14:56:20 +02:00
Brandon Stewart
5888325549 Merge branch 'main' into patch-1 2022-06-29 08:42:24 -04:00
Mathias Vorreiter Pedersen
e03646aba4 Merge pull request #9737 from geoffw0/arithmetic
Swift: Add ArithmeticOperation.qll library
2022-06-29 13:40:20 +01:00
yoff
8988a02806 Merge pull request #9733 from tausbn/python-fix-bad-mro-flatten-list-join
Python: Fix bad join in MRO `flatten_list`
2022-06-29 13:29:48 +02:00
yoff
f122af81ea Merge pull request #9741 from tausbn/python-fix-bad-join-in-regexpbackref-getgroup
Python: Fix bad join in `RegExpBackRef::getGroup`
2022-06-29 13:23:07 +02:00
Mathias Vorreiter Pedersen
f35ab7c292 Swift: Accept test changes to the cfg. These happen due to the fixes in 9e0cf62cda. 2022-06-29 12:20:07 +01:00
yoff
731f866242 Merge pull request #9717 from tausbn/python-fix-bad-mro-linearization-of-bases-join
Python: Fix bad join in MRO
2022-06-29 13:08:18 +02:00
Mathias Vorreiter Pedersen
15dc08351e Merge pull request #9747 from MathiasVP/fix-joins-in-swift-cwe-135
Swift: Don't join on index in `swift/string-length-conflation`
2022-06-29 11:58:36 +01:00
Geoffrey White
8b7535af81 Swift: Don't use abstract classes. 2022-06-29 11:49:22 +01:00
Geoffrey White
2cf65c7d35 Swift: Autoformat tests. 2022-06-29 11:49:21 +01:00
Geoffrey White
822002d37d Swift: Missing qldoc. 2022-06-29 11:49:20 +01:00
Mathias Vorreiter Pedersen
cc25e2644f Swift: Don't join on index in 'swift/string-length-conflation'. 2022-06-29 11:40:46 +01:00
Ian Lynagh
d285e19e77 Merge pull request #9731 from igfoo/igfoo/private
Kotlin: Make more methods private
2022-06-29 11:24:33 +01:00
Mathias Vorreiter Pedersen
4356155eeb Merge branch 'main' into swift-decls-in-cfg 2022-06-29 10:03:34 +01:00
Alex Denisov
4d81206a87 Swift: teach extractor to emit build artifacts for later consumption 2022-06-29 10:58:24 +02:00
AlexDenisov
1997d6b18c Merge pull request #9745 from github/alexdenisov/put-traps-into-a-temp-folder
Swift: store TRAP files in a temporary folder until the extraction is complete
2022-06-29 10:55:27 +02:00
Jeroen Ketema
55e052af26 Merge pull request #9686 from aschackmull/dataflow/no-node-scan
Dataflow performance: Avoid node scans
2022-06-29 10:38:56 +02:00
AlexDenisov
e1ef637c54 Update swift/extractor/SwiftExtractorConfiguration.h
Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com>
2022-06-29 10:16:14 +02:00
AlexDenisov
968ede3d4a Merge pull request #9746 from github/alexdenisov/add-test-case-showing-modules-loading-issue
Swift: add a test case showing module loading problem
2022-06-29 10:07:56 +02:00
Paolo Tranquilli
296b8cb630 Merge pull request #9719 from github/redsun82/swift-enum-is-case
Swift: add EnumIsCase test
2022-06-29 09:55:20 +02:00
Tony Torralba
12fa6967dc Merge pull request #8669 from joefarebrother/intent-verification
Java: Add query for Improper Verification of Intent by Broadcast Receiver (CWE-925)
2022-06-29 09:43:07 +02:00
Jeroen Ketema
8b13d1fab8 Merge pull request #9726 from github/rdmarsh2/stack-address-join-order
C++: fix join order in UsingExpiredStackAddress
2022-06-29 09:35:47 +02:00
Tony Torralba
741b2a923a Merge pull request #9207 from joefarebrother/android-external-storage
Java: Add sources for Android external storage
2022-06-29 09:34:51 +02:00
Alex Denisov
57811a4efc Swift: add a test case showing module loading problem
Extractor fails to load separate modules that were built by another
version of an actual compiler.
2022-06-29 07:38:18 +02:00
Alex Denisov
488befb577 Swift: store TRAP files in a temporary folder until the extraction is complete
Currently, we have a number of assertions in the codebase and certain
assumptions about the AST. These don't always hold, sometimes leading to
a crash in the extractor.
The crashes leave incomplete TRAP files that cannot be imported into the
database.

With this change, we still get those incomplete TRAP files, but we also
get a database in the end (even thoough it is also incomplete as we
cannot import everything).
2022-06-29 07:17:06 +02:00
AlexDenisov
6c68872163 Merge pull request #9743 from MathiasVP/fix-path-problem
Swift: Fix `kind` in `swift/string-length-conflation`
2022-06-29 06:58:36 +02:00
Mathias Vorreiter Pedersen
c2e57c3c9b Swift: Fix 'kind' in 'swift/string-length-conflation'. 2022-06-28 22:33:28 +01:00
Brandon Stewart
13fae22756 Merge branch 'main' into patch-1 2022-06-28 17:27:07 -04:00
Taus
38b8640582 Python: Fix bad join in RegExpBackRef::getGroup
Although this wasn't (as far as I know) causing any performance issues,
it was making the join-order badness report quite noisy, and so I
figured it was worth fixing.

Before:
```
Tuple counts for RegexTreeView::RegExpBackRef::getGroup#dispred#f0820431#ff/2@d3441d0b after 84ms:
1501195 ~3%     {2} r1 = JOIN RegexTreeView::RegExpTerm::getLiteral#dispred#f0820431#ff_10#join_rhs WITH RegexTreeView::RegExpTerm::getLiteral#dispred#f0820431#ff_10#join_rhs ON FIRST 1 OUTPUT Rhs.1 'result', Lhs.1 'result'
149     ~0%     {5} r2 = JOIN r1 WITH RegexTreeView::RegExpBackRef#class#31aac2a7#ffff ON FIRST 1 OUTPUT Rhs.1, Rhs.2, Rhs.3, Lhs.1 'result', Lhs.0 'this'
149     ~1%     {3} r3 = JOIN r2 WITH regex::RegexString::numbered_backreference#dispred#f0820431#ffff ON FIRST 3 OUTPUT Lhs.3 'result', Rhs.3, Lhs.4 'this'
4       ~0%     {2} r4 = JOIN r3 WITH RegexTreeView::RegExpGroup::getNumber#dispred#f0820431#ff ON FIRST 2 OUTPUT Lhs.2 'this', Lhs.0 'result'

1501195 ~3%     {2} r5 = JOIN RegexTreeView::RegExpTerm::getLiteral#dispred#f0820431#ff_10#join_rhs WITH RegexTreeView::RegExpTerm::getLiteral#dispred#f0820431#ff_10#join_rhs ON FIRST 1 OUTPUT Lhs.1 'result', Rhs.1 'result'
42526   ~0%     {5} r6 = JOIN r5 WITH RegexTreeView::RegExpGroup#31aac2a7#ffff ON FIRST 1 OUTPUT Lhs.1 'this', Lhs.0 'result', Rhs.1, Rhs.2, Rhs.3
22      ~0%     {8} r7 = JOIN r6 WITH RegexTreeView::RegExpBackRef#class#31aac2a7#ffff ON FIRST 1 OUTPUT Lhs.2, Lhs.3, Lhs.4, Lhs.1 'result', Lhs.0 'this', Rhs.1, Rhs.2, Rhs.3
0       ~0%     {6} r8 = JOIN r7 WITH regex::RegexString::getGroupName#dispred#f0820431#ffff ON FIRST 3 OUTPUT Lhs.5, Lhs.6, Lhs.7, Rhs.3, Lhs.3 'result', Lhs.4 'this'
0       ~0%     {2} r9 = JOIN r8 WITH regex::RegexString::named_backreference#dispred#f0820431#ffff ON FIRST 4 OUTPUT Lhs.5 'this', Lhs.4 'result'

4       ~0%     {2} r10 = r4 UNION r9
                return r10
```

In this case I opted for a classical solution: tying together the
literal and number (or name) part of the backreference in order to
encourage a two-column join.

After:
```
Tuple counts for RegexTreeView::RegExpBackRef::getGroup#dispred#f0820431#ff/2@b0cc4d5n after 0ms:
898  ~1%     {3} r1 = JOIN RegexTreeView::RegExpTerm::getLiteral#dispred#f0820431#ff WITH RegexTreeView::RegExpGroup::getNumber#dispred#f0820431#ff ON FIRST 1 OUTPUT Lhs.1, Rhs.1, Lhs.0 'result'
4    ~0%     {2} r2 = JOIN r1 WITH RegexTreeView::RegExpBackRef::hasLiteralAndNumber#f0820431#fff_120#join_rhs ON FIRST 2 OUTPUT Rhs.2 'this', Lhs.2 'result'

1110 ~0%     {5} r3 = JOIN RegexTreeView::RegExpGroup#31aac2a7#ffff WITH RegexTreeView::RegExpTerm::getLiteral#dispred#f0820431#ff ON FIRST 1 OUTPUT Lhs.1, Lhs.2, Lhs.3, Lhs.0 'result', Rhs.1
146  ~0%     {3} r4 = JOIN r3 WITH regex::RegexString::getGroupName#dispred#f0820431#ffff ON FIRST 3 OUTPUT Lhs.4, Rhs.3, Lhs.3 'result'
0    ~0%     {2} r5 = JOIN r4 WITH RegexTreeView::RegExpBackRef::hasLiteralAndName#f0820431#fff_120#join_rhs ON FIRST 2 OUTPUT Rhs.2 'this', Lhs.2 'result'

4    ~0%     {2} r6 = r2 UNION r5
            return r6
```
2022-06-28 16:51:09 +00:00
Mathias Vorreiter Pedersen
f97cc9e37c Merge pull request #9739 from MathiasVP/swift-conflation-query-high-precision
Swift: Set 'swift/string-length-conflation' to precision `high`
2022-06-28 17:26:23 +01:00
Mathias Vorreiter Pedersen
1a7f5db8e2 Swift: Set 'swift/string-length-conflation' to precision high and delete the placeholder query. 2022-06-28 17:01:06 +01:00
Mathias Vorreiter Pedersen
f2ae73b6be Merge pull request #9738 from geoffw0/misc
Swift: Add a Locatable.getFile() shortcut similar to the one in CPP.
2022-06-28 16:44:02 +01:00
Erik Krogh Kristensen
b81251865f Merge pull request #9716 from erik-krogh/htmlTypeSan
JS: sanitize non-strings from html-constructed-from-input
2022-06-28 17:31:00 +02:00
Mathias Vorreiter Pedersen
677f6dafcd Merge pull request #9732 from github/redsun82/swift-dot-syntax-call-expr
Swift: add DotSyntaxCallExpr tests
2022-06-28 16:09:10 +01:00
Geoffrey White
ff06e3cb6b Swift: Add a Locatable.getFile() shortcut similar to the one in CPP. 2022-06-28 15:49:49 +01:00
Geoffrey White
8a8a7ead9b Swift: Add tests for ArithmeticOperation.qll. 2022-06-28 15:34:23 +01:00
Geoffrey White
a5fff9af5d Swift: Create ArithmeticOperation.qll. 2022-06-28 15:34:15 +01:00
Geoffrey White
9e0cf62cda Swift: Fix + simplify LogicalOperation.qll. 2022-06-28 15:33:03 +01:00
Taus
b98c482c47 Python: Fix bad join in MRO flatten_list
This bad join was identified by the join-order-badness report, which
showed that:

py/use-of-input:MRO::flatten_list#f4eaf05f#fff#9c5fe54whnlqffdgu65vhb8uhpg# (order_500000)

calculated a whopping 212,820,108 tuples in order to produce an output of
size 55516, roughly 3833 times more effort than needed.

Here's a snippet of the slowest iteration of that predicate:
```
Tuple counts for MRO::flatten_list#f4eaf05f#fff/3@i1839#0265eb3w after 14ms:
0     ~0%     {3} r1 = JOIN MRO::need_flattening#f4eaf05f#f#prev_delta WITH MRO::ConsList#f4eaf05f#fff#reorder_2_0_1#prev ON FIRST 1 OUTPUT Rhs.1, Lhs.0 'list', Rhs.2
0     ~0%     {3} r2 = JOIN r1 WITH MRO::ClassList::length#f0820431#ff#prev ON FIRST 1 OUTPUT Lhs.2, Lhs.1 'list', Rhs.1 'n'
0     ~0%     {3} r3 = JOIN r2 WITH MRO::ClassListList::flatten#dispred#f0820431#ff#prev ON FIRST 1 OUTPUT Lhs.1 'list', Lhs.2 'n', Rhs.1 'result'

0     ~0%     {3} r4 = SCAN MRO::ConsList#f4eaf05f#fff#prev_delta OUTPUT In.2 'list', In.0, In.1
0     ~0%     {3} r5 = JOIN r4 WITH MRO::need_flattening#f4eaf05f#f#prev ON FIRST 1 OUTPUT Lhs.1, Lhs.2, Lhs.0 'list'
0     ~0%     {3} r6 = JOIN r5 WITH MRO::ClassList::length#f0820431#ff#prev ON FIRST 1 OUTPUT Lhs.1, Lhs.2 'list', Rhs.1 'n'
0     ~0%     {3} r7 = JOIN r6 WITH MRO::ClassListList::flatten#dispred#f0820431#ff#prev ON FIRST 1 OUTPUT Lhs.1 'list', Lhs.2 'n', Rhs.1 'result'

0     ~0%     {3} r8 = r3 UNION r7

26355 ~2%     {3} r9 = SCAN MRO::ConsList#f4eaf05f#fff#prev OUTPUT In.2 'list', In.0, In.1

0     ~0%     {3} r10 = JOIN r9 WITH MRO::need_flattening#f4eaf05f#f#prev ON FIRST 1 OUTPUT Lhs.1, Lhs.2, Lhs.0 'list'
0     ~0%     {3} r11 = JOIN r10 WITH MRO::ClassList::length#f0820431#ff#prev_delta ON FIRST 1 OUTPUT Lhs.1, Lhs.2 'list', Rhs.1 'n'
0     ~0%     {3} r12 = JOIN r11 WITH MRO::ClassListList::flatten#dispred#f0820431#ff#prev ON FIRST 1 OUTPUT Lhs.1 'list', Lhs.2 'n', Rhs.1 'result'
...
```
(... and a bunch more lines. The same construction appears several times,
but the join order is the same each time.)

Clearly it would be better to start with whatever is in `need_flattening`,
and then do the other joins. This is what the present fix does (by
unbinding `list` in all but the `needs_flattening` call).

After the fix, the slowest iteration is as follows:

```
Tuple counts for MRO::flatten_list#f4eaf05f#fff/3@i2617#8155ab3w after 9ms:
0 ~0%     {2} r1 = SCAN MRO::need_flattening#f4eaf05f#f#prev_delta OUTPUT In.0 'list', In.0 'list'

0 ~0%     {3} r2 = JOIN r1 WITH MRO::ConsList#f4eaf05f#fff#reorder_2_0_1#prev ON FIRST 1 OUTPUT Rhs.1, Lhs.1 'list', Rhs.2
0 ~0%     {3} r3 = JOIN r2 WITH MRO::ClassList::length#f0820431#ff#prev ON FIRST 1 OUTPUT Lhs.2, Lhs.1 'list', Rhs.1 'n'
0 ~0%     {3} r4 = JOIN r3 WITH MRO::ClassListList::flatten#dispred#f0820431#ff#prev ON FIRST 1 OUTPUT Lhs.1 'list', Lhs.2 'n', Rhs.1 'result'

1 ~0%     {2} r5 = SCAN MRO::need_flattening#f4eaf05f#f#prev OUTPUT In.0 'list', In.0 'list'

0 ~0%     {3} r6 = JOIN r5 WITH MRO::ConsList#f4eaf05f#fff#reorder_2_0_1#prev_delta ON FIRST 1 OUTPUT Rhs.1, Lhs.1 'list', Rhs.2
0 ~0%     {3} r7 = JOIN r6 WITH MRO::ClassList::length#f0820431#ff#prev ON FIRST 1 OUTPUT Lhs.2, Lhs.1 'list', Rhs.1 'n'
0 ~0%     {3} r8 = JOIN r7 WITH MRO::ClassListList::flatten#dispred#f0820431#ff#prev ON FIRST 1 OUTPUT Lhs.1 'list', Lhs.2 'n', Rhs.1 'result'
...
```
(... and so on. The remainder is 0 tuples all the way.)

In total, we went from
```
40.6s |  7614 |  15ms @ 1839 | MRO::flatten_list#f4eaf05f#fff@0265eb3w
```
to
```
7.8s |  7614 |  11ms @ 2617 | MRO::flatten_list#f4eaf05f#fff@8155ab3w
```
2022-06-28 14:17:47 +00:00
Paolo Tranquilli
5c6ac2a5f2 Swift: accept test results 2022-06-28 16:15:05 +02:00
Geoffrey White
63376da90f Swift: Add tests for LogicalOperaion.qll. 2022-06-28 15:04:47 +01:00
Paolo Tranquilli
6ff45d3dbe Merge main into redsun82/swift-enum-is-case 2022-06-28 16:03:38 +02:00
Brandon Stewart
c7b4133fbe Merge branch 'main' into patch-1 2022-06-28 09:46:46 -04:00
Paolo Tranquilli
364085a596 Swift: add DotSyntaxCallExpr tests 2022-06-28 15:44:42 +02:00
AlexDenisov
c4c3a52804 Merge pull request #9730 from github/redsun82/swift-trap-newlines
Swift: add missing newlines in trap
2022-06-28 15:41:05 +02:00
Ian Lynagh
3026456a39 Kotlin: Make more methods private 2022-06-28 14:38:13 +01:00
Paolo Tranquilli
7175869518 Swift: add missing newlines in trap
This is mostly cosmetic and for debugging, as the trap importer is
perfectly happy with trap entries on the same line without spaces
between them.
2022-06-28 15:17:18 +02:00
Brandon Stewart
33d1aae92a Update ruby/ql/lib/codeql/ruby/frameworks/ActiveRecord.qll
Co-authored-by: Harry Maclean <hmac@github.com>
2022-06-28 08:51:01 -04:00
Brandon Stewart
1dc26a0ca3 Update ruby/ql/lib/codeql/ruby/frameworks/ActiveRecord.qll
Co-authored-by: Harry Maclean <hmac@github.com>
2022-06-28 08:50:54 -04:00
Asger F
a522562f93 Merge pull request #9369 from asgerf/python/api-graph-api
Python: API graph renaming and documentation
2022-06-28 14:48:12 +02:00
Arthur Baars
6e836c7eb8 Merge pull request #9706 from aibaars/update-tree-sitter-ruby-2
Ruby: update tree-sitter-ruby
2022-06-28 14:14:15 +02:00
Erik Krogh Kristensen
112caa3f5d rewrite qldoc based on review 2022-06-28 13:23:44 +02:00
Paolo Tranquilli
7f8bff571d Merge pull request #9729 from github/redsun82/swift-extraction
Swift: extract `ProtocolCompositionType` and all `BuiltinType`s
2022-06-28 12:30:47 +02:00
Paolo Tranquilli
131524d867 Swift: accept test changes
These are due to the changes on `toBeTested` that include canonical
types.
2022-06-28 12:16:08 +02:00
Asger F
b3b53360ae Python: change category to deprecated because library is apparently supported anymore 2022-06-28 12:14:28 +02:00
Asger F
5dfc3c6537 Python: rename change note again 2022-06-28 12:10:26 +02:00
Paolo Tranquilli
68a341d72c Swift: use createEntry in the whole type visitor 2022-06-28 12:06:19 +02:00
Paolo Tranquilli
57981384df Swift: extract ProtocolComposition- and BuiltinType 2022-06-28 12:01:36 +02:00
Paolo Tranquilli
b41cbaec33 Swift: add possibility to add flags in tests 2022-06-28 12:01:36 +02:00
Paolo Tranquilli
f2b589743a Swift: add possibility to collapse class hierarchy in tests 2022-06-28 12:01:36 +02:00
Asger F
d9f57e6d23 Python: rename change note file 2022-06-28 11:41:07 +02:00
Asger F
6d25fb6988 Python: add change note 2022-06-28 11:28:30 +02:00
Ian Lynagh
780f5abc67 Merge pull request #9724 from igfoo/igfoo/private
Kotlin: Make more methods private
2022-06-28 10:21:55 +01:00
Ian Lynagh
b6790ef735 Merge pull request #9725 from igfoo/igfoo/inline
Kotlin: Extract inlineability of functions
2022-06-28 10:21:30 +01:00
Tony Torralba
e0b4c63a53 Add new source kind to CsvValidation 2022-06-28 10:16:40 +02:00
Joe Farebrother
49b419c52e Update models to include manual tag 2022-06-28 10:10:28 +02:00
Joe Farebrother
55e78e3e25 Minor doc fixes + making directFileRead private 2022-06-28 10:10:28 +02:00
Joe Farebrother
a41f28ebe5 Use more file openning methods 2022-06-28 10:10:28 +02:00
Joe Farebrother
58fba20689 Add change note 2022-06-28 10:10:28 +02:00
Joe Farebrother
cb717a22bf Fix failing test cases 2022-06-28 10:10:27 +02:00
Joe Farebrother
810854d6b5 Add tests 2022-06-28 10:10:27 +02:00
Joe Farebrother
0e04f2b2e8 Add external storage souces 2022-06-28 10:10:27 +02:00
Asger F
4c73ab2679 Apply suggestions from code review
Co-authored-by: Taus <tausbn@github.com>
2022-06-28 09:48:53 +02:00
Asger F
a033338d20 Python: Explicitly mention lack of transitive flow in asSource/asSink 2022-06-28 09:46:26 +02:00
Asger F
9b27a7cbcd Python: Dont claim that external libraries are excluded from the database 2022-06-28 09:28:26 +02:00
Asger F
0346b6b67a Merge pull request #9698 from github/post-release-prep/codeql-cli-2.10.0
Post-release preparation for codeql-cli-2.10.0
2022-06-28 09:05:13 +02:00
Brandon Stewart
4fb0264ec8 Merge branch 'main' into patch-1 2022-06-27 16:07:15 -04:00
Taus
dc0f50d49a Python: Clean up variable names
Makes it more consistent with the names used in
`legalMergeCandidateNonEmpty`.
2022-06-27 19:54:09 +00:00
Taus
8fc9ce9699 Python: Fix bad join in MRO
Fixes a bad join in `list_of_linearization_of_bases_plus_bases`.

Previvously, we joined together `ConsList` and `getBase` before filtering
these out using the recursive call. Now we do the recursion first.

Co-authored-by: yoff <yoff@github.com>
2022-06-27 19:54:09 +00:00
Robert Marsh
829fdd1ff6 C++: fix join order in UsingExpiredStackAddress 2022-06-27 15:28:14 -04:00
Ian Lynagh
3543864e0b Merge pull request #9723 from igfoo/igfoo/delegates
Kotlin: Mark DELEGATED_PROPERTY_ACCESSORs as compiler-generated
2022-06-27 19:48:53 +01:00
Asger F
cc57cb8af5 Merge branch 'main' into post-release-prep/codeql-cli-2.10.0 2022-06-27 20:37:25 +02:00
Ian Lynagh
44e69e1c09 Kotlin: Add Modifier.isInline() 2022-06-27 19:33:08 +01:00
Ian Lynagh
af672b4899 Kotlin: Add a changenote for Modifier.isInline() 2022-06-27 19:31:01 +01:00
Ian Lynagh
4a404aee76 Kotlin: Add inline info to methods test 2022-06-27 19:27:26 +01:00
Ian Lynagh
06060954ec Kotlin: Extract inlineability of functions 2022-06-27 19:25:56 +01:00
Ian Lynagh
4e4b34290b Kotlin: Make more methods private 2022-06-27 18:20:33 +01:00
Ian Lynagh
7dc490ff7c Kotlin: Enhance methods test 2022-06-27 17:59:52 +01:00
Ian Lynagh
7430a413ad Kotlin: Mark DELEGATED_PROPERTY_ACCESSORs as compiler-generated 2022-06-27 17:57:40 +01:00
Paolo Tranquilli
9d97fe7f30 Swift: generalize EnumIsCaseExpr test 2022-06-27 17:22:48 +02:00
Paolo Tranquilli
7f694f3b90 Swift: add EnumIsCase test 2022-06-27 16:25:46 +02:00
Brandon Stewart
99ae1b3f0d Merge branch 'main' into patch-1 2022-06-27 10:12:26 -04:00
Brandon Stewart
52290fd4ae run codeql query format 2022-06-27 10:01:40 -04:00
Asger F
dfe276aa18 Merge pull request #9715 from asgerf/js/always-check-file-header
JS: always sniff file header of TypeScript files
2022-06-27 14:58:57 +02:00
Erik Krogh Kristensen
34e7589844 sanitize non-strings from unsafe-html-construction 2022-06-27 13:53:44 +02:00
Asger F
c8b2be616f JS: Bump extractor version string 2022-06-27 13:52:44 +02:00
Asger F
c082578688 JS: Always sniff file type of TypeScript files 2022-06-27 13:48:00 +02:00
Arthur Baars
051b865230 Ruby: update tree-sitter-ruby 2022-06-27 13:03:04 +02:00
Ian Lynagh
c72377cf2c Merge pull request #9711 from igfoo/igfoo/integ
Kotlin: Add integration tests
2022-06-27 11:08:12 +01:00
Mathias Vorreiter Pedersen
41b23572f0 Merge pull request #9673 from geoffw0/stringlengthconflation2
Swift: String length conflation query
2022-06-27 10:29:09 +01:00
Asger F
5991e9b83c Merge pull request #9714 from asgerf/ruby/fix-api-graphdeprecation
Ruby: fix deprecation warning
2022-06-27 11:09:11 +02:00
Asger F
09476d1c13 Ruby: fix deprecation warning 2022-06-27 10:01:37 +02:00
Harry Maclean
101111bd2f Merge pull request #9574 from hmac/hmac/action-cable-logger
Ruby: More Rails modeling
2022-06-27 19:56:54 +12:00
Asger F
d6fd43fe12 Merge pull request #9364 from asgerf/ruby/api-graph-api
Ruby: API graph renaming an documentation
2022-06-27 08:54:24 +02:00
Brandon Stewart
29e73e1a04 Update ActiveRecord.qll 2022-06-24 15:35:36 -04:00
Brandon Stewart
463c096d4c Update ActiveRecord.qll 2022-06-24 15:33:02 -04:00
Brandon Stewart
2047954013 Merge branch 'main' into patch-1 2022-06-24 15:30:11 -04:00
Brandon Stewart
ff9a7244c2 Update ActiveRecord.qll 2022-06-24 15:28:09 -04:00
Ian Lynagh
861a368734 Merge pull request #9703 from igfoo/igfoo/generated
Kotlin: Record more kinds of elements as compiler-generated
2022-06-24 19:46:56 +01:00
Ian Lynagh
0ddd5bb162 Merge pull request #9709 from igfoo/igfoo/isLocalFunction
Kotlin: Let useFunction worry about isLocalFunction for us
2022-06-24 19:22:43 +01:00
Mathias Vorreiter Pedersen
9f58ba1a1a Merge pull request #9707 from github/redsun82/swift-extraction
Swift: extract more types
2022-06-24 18:38:28 +01:00
Ian Lynagh
0b312b61e4 Kotlin: qlformat some test queries 2022-06-24 18:35:58 +01:00
Ian Lynagh
31b3c1fff8 Kotlin: Add integration tests 2022-06-24 17:33:58 +01:00
Paolo Tranquilli
41fb55a7a8 Swift: extract all ReferenceStorageTypes 2022-06-24 18:10:31 +02:00
Geoffrey White
9013d56f37 Swift: Strengthen claim about severity in the qhelp. 2022-06-24 17:09:37 +01:00
Paolo Tranquilli
fd209e57cd Swift: extract InoutType 2022-06-24 17:29:46 +02:00
Ian Lynagh
73a79e064c Kotlin: Accept test output 2022-06-24 16:24:41 +01:00
Geoffrey White
ef283d9b7a Swift: Metadata. 2022-06-24 16:20:16 +01:00
Asger F
3a44584de5 Merge pull request #9695 from asgerf/js/unused-var-template-placeholder
JS: Fix unused variable FP in template placeholders
2022-06-24 17:19:35 +02:00
Paolo Tranquilli
189a47e30d Swift: extract VariadicSequenceType 2022-06-24 17:15:45 +02:00
Paolo Tranquilli
346110e8dd Swift: extract DynamicSelfType 2022-06-24 16:49:58 +02:00
Paolo Tranquilli
4281605ba7 Swift: extract existential types 2022-06-24 16:28:18 +02:00
Paolo Tranquilli
631156dbc6 Swift: extract Nested- and PrimaryArchetypeType 2022-06-24 16:28:17 +02:00
Ian Lynagh
4791aaae52 Kotlin: Use an enum for compiler-generated-kinds
For now this is in KotlinFileExtractor, but we can move it out later if
we have generated things elsewhere.
2022-06-24 15:19:50 +01:00
Ian Lynagh
c0b6d1d093 Kotlin: Let useFunction worry about isLocalFunction for us 2022-06-24 14:24:02 +01:00
Ian Lynagh
46446f9dfa Kotlin: Move the isLocalFunction check deeper into useFunction 2022-06-24 14:22:45 +01:00
Ian Lynagh
27b83a0b33 Java: Add an upgrade script 2022-06-24 14:01:07 +01:00
Ian Lynagh
008a8f0bba Kotlin: Add an enum class to the methods test 2022-06-24 14:00:47 +01:00
Ian Lynagh
20817a54da Kotlin: Mark enum class special members as cmopiler-generated 2022-06-24 14:00:47 +01:00
Ian Lynagh
c5d6ca7afc Kotlin: Accept method test changes 2022-06-24 14:00:47 +01:00
Ian Lynagh
50eeb47244 Kotlin: Mark <clinit> as compiler-generated 2022-06-24 14:00:47 +01:00
Ian Lynagh
c0600820ac Kotlin: Update methods test 2022-06-24 14:00:47 +01:00
Ian Lynagh
c06eb09100 Kotlin: Record that DEFAULT_PROPERTY_ACCESSOR are compiler-generated 2022-06-24 14:00:47 +01:00
Ian Lynagh
aefd89ed49 Kotlin: Add compiler-generated info to methods test 2022-06-24 14:00:47 +01:00
Ian Lynagh
5fc294d49e Kotlin: Record that generated data class members are compiler-generated 2022-06-24 14:00:47 +01:00
Tamás Vajk
381bcf7dad Merge pull request #9153 from tamasvajk/kotlin-simplify-loop-breaks-1
Kotlin: Unify loop `break`/`continue` statement handling between java and kotlin
2022-06-24 14:45:57 +02:00
Geoffrey White
f2ae2dbe1f Swift: Consistency. 2022-06-24 12:28:10 +01:00
Geoffrey White
ef3d4f3242 Swift: Add qhelp and example. 2022-06-24 12:27:10 +01:00
Paolo Tranquilli
6230a3a3c5 Merge pull request #9685 from github/redsun82/swift-code-reorg
Swift: split up generated C++ code
2022-06-24 13:24:42 +02:00
Paolo Tranquilli
299e1af22e Merge main into redsun82/swift-code-reorg 2022-06-24 13:06:14 +02:00
Paolo Tranquilli
80ffd81b2c Merge pull request #9614 from github/alexdenisov/swift-extract-all-inputs-with-outputs
Swift: extract all output-producing source files, not only primary files
2022-06-24 12:23:36 +02:00
Chris Smowton
d0e521ef4a Merge pull request #9681 from smowton/smowton/fix/reintroduce-obinit
Kotlin: reintroduce obinit when we have multiple secondary constructors and no primary
2022-06-24 10:25:24 +01:00
Chris Smowton
fcc8691394 Merge pull request #9625 from smowton/smowton/test/kotlin-1-7-support
Switch to using Kotlin 1.7 by default
2022-06-24 10:24:54 +01:00
Ian Lynagh
ae16a874c8 Merge pull request #9694 from igfoo/igfoo/useFunction
Kotlin: Some useFunction simplification
2022-06-24 09:31:14 +01:00
Paolo Tranquilli
b708e627ad Merge pull request #9701 from github/redsun82/swift-final-resolve
Swift: make `Element::resolve` final
2022-06-24 10:30:33 +02:00
Paolo Tranquilli
8ca529e8d9 Swift: make Element::resolve final
One should only override `getResolveStep` (or `convertsFrom` for `Expr`
classes), as otherwise the resolution/conversion becomes inconsitent.
2022-06-24 10:05:58 +02:00
Paolo Tranquilli
d14eab84fa Merge pull request #9699 from github/redsun82/swift-stop-stub-reverts
Swift: yet another fix to stub revert prevention
2022-06-24 10:04:55 +02:00
Paolo Tranquilli
bc44007e18 Swift: yet another fix to stub revert prevention 2022-06-24 09:40:03 +02:00
github-actions[bot]
d506f448ef Post-release preparation for codeql-cli-2.10.0 2022-06-24 07:36:33 +00:00
Paolo Tranquilli
f539be33d5 Merge pull request #9697 from github/redsun82/swift-stop-stub-reverts
Swift: fix stub revert prevention
2022-06-24 09:32:29 +02:00
Paolo Tranquilli
a9bd784ba2 Swift: fix stub revert prevention
It turns out the threshold of 5 lines for stub modification detection
was too strict: in case of a long class name the QL formatter will put
the closing brace of the empty class definition on a new line, leading
to codegen fail with an error thinking the stub was modified.

On the other side of things, also adding a base to a stub class was not
being detected as a modification.

Now the modification test is slightly smarter. If the stub still marked
as generated and

* has more than 6 lines, or
* the contents does not match a regexp aproximation of a plain stub

then codegen will abort. The test will still avoid reading the whole
contents of all the stubs.
2022-06-24 09:02:40 +02:00
Ian Lynagh
eb1b3f801d Merge pull request #9689 from igfoo/igfoo/makeprivate
Kotlin: Make some more methods private
2022-06-23 21:28:07 +01:00
Ian Lynagh
bee703a870 Kotlin: Inline away useFunctionCommon 2022-06-23 21:23:21 +01:00
Chris Smowton
a124d83265 Autoformat 2022-06-23 20:13:27 +01:00
Ian Lynagh
3934491dcc Kotlin: Refactor useFunction*
They now work in a way more similar to other families of functions we
have.
2022-06-23 19:19:47 +01:00
Asger F
f5a19a1013 JS: Fix unused variable FP in template placeholders 2022-06-23 19:26:32 +02:00
Geoffrey White
1a980c94a0 Swift: Query description. 2022-06-23 18:13:48 +01:00
Ian Lynagh
ab19d8c3c3 Kotlin: Move useFunctionCommon 2022-06-23 17:59:28 +01:00
Brandon Stewart
caeef68bde Update ActiveRecord.qll 2022-06-23 12:31:05 -04:00
Brandon Stewart
173bea2579 Update ActiveRecord.qll 2022-06-23 12:18:26 -04:00
Brandon Stewart
fa622f551a Update ruby/ql/lib/codeql/ruby/frameworks/ActiveRecord.qll
Co-authored-by: Alex Ford <alexrford@users.noreply.github.com>
2022-06-23 12:16:50 -04:00
Mathias Vorreiter Pedersen
71efffd79b Merge pull request #9691 from rdmarsh2/rdmarsh2/swift/ssa-perf-1
Swift: remove check for inout params in SSA gen
2022-06-23 17:16:38 +01:00
Mathias Vorreiter Pedersen
998a75e768 Merge pull request #9690 from github/redsun82/swift-stop-stub-reverts
Swift: prevent accidental revert of modified stub
2022-06-23 17:13:52 +01:00
Geoffrey White
911d30bd9a Swift: Proper query message. 2022-06-23 17:12:02 +01:00
Robert Marsh
946d0358c9 Swift: remove check for inout params in SSA gen
This check is unnecessary since it's enforced by the compiler, and is
causing a bad join order.
2022-06-23 15:59:34 +00:00
Paolo Tranquilli
ad38cf2026 Swift: prevent accidental revert of modified stub
If one modifies a QL stub but forgets to remove the `// generated`
header comment, codegen will now abort with an error rather than
silently reverting the change.

This is based on the rough heuristic of just counting the lines. If any
change is done to the stub class, the number of lines is bound to be
5 or more.
2022-06-23 17:49:21 +02:00
Paolo Tranquilli
a6ae6cfad0 Merge pull request #9688 from github/redsun82/swift-autopep8
Swift: autopep8 codegen
2022-06-23 17:49:09 +02:00
Ian Lynagh
bd8a8d00aa Kotlin: Make some more methods private 2022-06-23 16:44:06 +01:00
Chris Smowton
b5010337a4 Avoid extracting needless obinit methods where we're only extracting a class' outline. 2022-06-23 16:26:54 +01:00
Chris Smowton
3cf7f96298 Ensure <obinit>'s return type is void not Unit 2022-06-23 16:26:54 +01:00
Chris Smowton
af5230349b Kotlin: reintroduce obinit when we have multiple secondary constructors and no primary
This avoids DB inconsistencies because complex initialisers are extracted to more than one function.
2022-06-23 16:26:54 +01:00
Paolo Tranquilli
7334b4e03a Swift: autopep8 all python files
Additionally set up a pre-commit hook and a CI check for that.
2022-06-23 17:13:56 +02:00
Geoffrey White
64d7296847 Swift: Remove redundant cast. 2022-06-23 16:04:26 +01:00
Geoffrey White
3291029e6d Swift: Address further review comments. 2022-06-23 16:00:56 +01:00
Geoffrey White
ebcb1e9448 Swift: Clean up other uses of toString. 2022-06-23 15:53:55 +01:00
Chris Smowton
1aae3c5f5e Fix whenexpr test
Prior to Kotlin 1.7 the gratuitous `?` was ignored for typing purposes; now it yields a `String?`. We should make the test work everywhere by using a real nullable type.
2022-06-23 15:34:40 +01:00
Chris Smowton
e64a8bc79a Use binary names not fqnames for uniquing IrDeclarations
Otherwise we fall into the trap of confusing the two overloads of `MapsKt.iterator` which have differing jvmnames.
2022-06-23 15:34:40 +01:00
Chris Smowton
57ea34d3ff Unique external classes/functions by fqname
Previously we used the IrDeclaration itself, but in Kotlin 1.7 this can be ambiguous because we can get more than one copy of a class in different modules.
2022-06-23 15:34:40 +01:00
Chris Smowton
8c57308661 Prevent extracting hidden functions
I'm not sure how these looked in 1.6 and below yet, but in 1.7 they appear with visibility = public, but a descriptor field set to indicate they have a name clash with a 'real' function.
2022-06-23 15:34:40 +01:00
Chris Smowton
2b2c384933 Kotlin: Move from 1.7.0-RC to 1.7.0 2022-06-23 15:34:40 +01:00
Chris Smowton
4899aabb05 Switch to using Kotlin 1.7 by default 2022-06-23 15:34:40 +01:00
Chris Smowton
45c85228bd Implement Kotlin 1.7 support
- Implement getIrStubFromDescriptor for Kotlin 1.7
- Stop using ClassSymbol.signature, which is now only populated for classes built from Kotlin, and noteworthily is null for primitive and other internally-synthesised types.
2022-06-23 15:34:40 +01:00
Mathias Vorreiter Pedersen
43d449f1f7 Merge pull request #9687 from github/redsun82/swift-codegen-tag-to-pragma
Swift: tag -> pragma in codegen
2022-06-23 15:21:58 +01:00
Ian Lynagh
3b2b884f09 Merge pull request #9683 from igfoo/igfoo/getDiagnosticLocation
Kotlin: Remove unused function getDiagnosticLocation
2022-06-23 14:09:00 +01:00
Paolo Tranquilli
8d4637ddfd Swift: tag -> pragma in codegen
For the use the former tags are meant for, pragma is a more
meaningful name. It now also accepts both strings and lists of strings.
2022-06-23 14:52:21 +02:00
Anders Schack-Mulligen
dc517a758e Autoformat 2022-06-23 14:44:40 +02:00
Anders Schack-Mulligen
4a317a25d3 Dataflow: Sync. 2022-06-23 14:34:52 +02:00
Anders Schack-Mulligen
c27290563a Dataflow: Perf fix, avoid node scans. 2022-06-23 14:34:05 +02:00
Paolo Tranquilli
0957f63cc7 Swift: update codegen workflow to include all files 2022-06-23 14:31:48 +02:00
Paolo Tranquilli
a9877ed2fd Swift: split generated C++ files by directory 2022-06-23 14:24:03 +02:00
Paolo Tranquilli
b2ebf63d2e Swift: split generated C++ code into .h and .cpp 2022-06-23 14:22:58 +02:00
Ian Lynagh
1713c416c0 Kotlin: Remove unused function getDiagnosticLocation 2022-06-23 13:07:09 +01:00
Geoffrey White
3b48cb02bc Swift: Add Type.getName(). 2022-06-23 12:54:56 +01:00
Geoffrey White
01f697abe9 Swift: Rename argName -> paramName. 2022-06-23 12:16:04 +01:00
Geoffrey White
5222ba9073 Swift: Suggestions from review. 2022-06-23 12:02:32 +01:00
Rasmus Wriedt Larsen
3248f7b423 Merge pull request #9649 from RasmusWL/certificate-modeling
Python/JS/Ruby: Ignore common words (like certain) as sensitive data source
2022-06-23 12:04:58 +02:00
Mathias Vorreiter Pedersen
9b587843ff Merge pull request #9669 from rdmarsh2/rdmarsh2/swift/dataflow-lambda-flow
Swift: implement LambdaCall in dataflow library
2022-06-23 10:38:45 +01:00
Tamas Vajk
cf18a9a04b Fix bad join order in Shadowing::shadows
Fixes the bad join order in `Shadowing::shadows`:
Tuple counts for Shadowing::shadows#f4fb89a3#ffff@c4b8a90j:
           182915  ~0%    {2} r1 = Variable::LocalVariableDecl::getCallable#dispred#f0820431#ff AND NOT Shadowing::shadows#f4fb89a3#ffff#antijoin_rhs(Lhs.0, Lhs.1)
           182915  ~0%    {3} r2 = JOIN r1 WITH localvars ON FIRST 1 OUTPUT Lhs.1, Lhs.0, Rhs.2
           182915  ~3%    {4} r3 = JOIN r2 WITH Member::Member::getDeclaringType#dispred#f0820431#bf ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.0, Lhs.2
           182833  ~0%    {4} r4 = JOIN r3 WITH classes ON FIRST 1 OUTPUT Lhs.1, Lhs.2, Lhs.3, Lhs.0
           182833  ~3%    {5} r5 = JOIN r4 WITH Element::Element::getName#dispred#f0820431#ff ON FIRST 1 OUTPUT Lhs.2, Lhs.0, Lhs.1, Lhs.3, Rhs.1
        183352620  ~5%    {5} r6 = JOIN r5 WITH Member::Field::getType#dispred#f0820431#bf_10#join_rhs ON FIRST 1 OUTPUT Rhs.1, Lhs.3, Lhs.1, Lhs.2, Lhs.4
            40529  ~0%    {5} r7 = JOIN r6 WITH Member::Field::getDeclaringType#dispred#f0820431#fb ON FIRST 2 OUTPUT Lhs.0, Lhs.4, Lhs.2, Lhs.3, Lhs.1
              678  ~4%    {4} r8 = JOIN r7 WITH Element::Element::getName#dispred#f0820431#ff ON FIRST 2 OUTPUT Lhs.2, Lhs.3, Lhs.4, Lhs.0
              670  ~4%    {4} r9 = r8 AND NOT Member::Field::isStatic#dispred#f0820431#b(Lhs.3)
              670  ~3%    {4} r10 = SCAN r9 OUTPUT In.0, In.2, In.3, In.1
                          return r10

After the fix:
Tuple counts for Shadowing::shadows#f4fb89a3#ffff@95ca976v:
        182915  ~0%    {2} r1 = Variable::LocalVariableDecl::getCallable#dispred#f0820431#ff AND NOT Shadowing::shadows#f4fb89a3#ffff#antijoin_rhs(Lhs.0, Lhs.1)
        182915  ~0%    {3} r2 = JOIN r1 WITH localvars ON FIRST 1 OUTPUT Lhs.1, Lhs.0, Rhs.2
        182915  ~0%    {4} r3 = JOIN r2 WITH Member::Member::getDeclaringType#dispred#f0820431#bf ON FIRST 1 OUTPUT Lhs.1, Lhs.0, Lhs.2, Rhs.1
        182915  ~7%    {5} r4 = JOIN r3 WITH Element::Element::getName#dispred#f0820431#ff ON FIRST 1 OUTPUT Lhs.3, Rhs.1, Lhs.2, Lhs.0, Lhs.1
           678  ~4%    {4} r5 = JOIN r4 WITH Shadowing::getField#f4fb89a3#ffff ON FIRST 3 OUTPUT Lhs.3, Lhs.4, Lhs.0, Rhs.3
           670  ~4%    {4} r6 = r5 AND NOT Member::Field::isStatic#dispred#f0820431#b(Lhs.3)
           670  ~3%    {4} r7 = SCAN r6 OUTPUT In.0, In.2, In.3, In.1
                       return r7
2022-06-23 10:30:39 +02:00
Tamas Vajk
e65a046235 Fix test file after rebase 2022-06-23 09:51:48 +02:00
Tamas Vajk
579bfc22f3 Fix performance change in SecurityFlag 2022-06-23 08:46:33 +02:00
Tamas Vajk
79ec998636 Fix DB change compatibility to backwards 2022-06-23 08:45:11 +02:00
Tamas Vajk
7dad2f7fcb Fix DB upgrade properties 2022-06-23 08:45:11 +02:00
Tamas Vajk
074b90ea1a Add change note 2022-06-23 08:45:11 +02:00
Tamas Vajk
053ca2e940 Update DB stats file 2022-06-23 08:45:11 +02:00
Tamas Vajk
e03b48f293 Add DB upgrade folder 2022-06-23 08:45:11 +02:00
Tamas Vajk
dabc956dbf Unify loop break/continue statement handling between java and kotlin 2022-06-23 08:45:11 +02:00
AlexDenisov
decb136471 Update swift/extractor/SwiftExtractor.cpp
Co-authored-by: Paolo Tranquilli <redsun82@github.com>
2022-06-23 07:23:17 +02:00
Geoffrey White
07b89b89d7 Swift: Clean up a bit. 2022-06-22 19:35:37 +01:00
Geoffrey White
19026e9ed5 Swift: Work around toString change. 2022-06-22 19:16:09 +01:00
Geoffrey White
da7f49155d Swift: Use dataflow. 2022-06-22 19:16:09 +01:00
Geoffrey White
28d801fde3 Swift: CWE-135 query sources and sinks. 2022-06-22 19:16:08 +01:00
Robert Marsh
42929a70e8 Swift: implement LambdaCall in dataflow library 2022-06-22 17:30:54 +00:00
Rasmus Wriedt Larsen
876ba71d9b Python/JS/Ruby: Add change-note 2022-06-22 11:14:05 +02:00
Rasmus Wriedt Larsen
2ce4b7b9fc SensitiveDataHeuristics: sync 2022-06-22 11:05:14 +02:00
Rasmus Wriedt Larsen
4be375521f Python: Handle _ in sensitive-data-sources 2022-06-22 11:05:14 +02:00
Rasmus Wriedt Larsen
4a844312f4 Python: _ in var name not handled by sensitive-data-sources 2022-06-22 11:05:14 +02:00
Rasmus Wriedt Larsen
5dc2bb717a Python: ignore common words (certain/concert) as sensitive source 2022-06-22 11:05:05 +02:00
Rasmus Wriedt Larsen
abdcfd55c3 Python: uncertainty is treated as a certificate :O 2022-06-22 10:16:28 +02:00
Brandon Stewart
a2e2dcdfd5 Make ActiveRecordInstanceMethodCall Public 2022-06-21 14:44:52 -04:00
Asger F
a1af9c3d7d Ruby: update predicate docs 2022-06-21 12:44:16 +02:00
Asger F
d15b90e21a Ruby: Add deprecation 2022-06-21 12:44:16 +02:00
Asger F
9838e2e101 Ruby: Rename getAValueReachingRhs -> getAValueReachingSink 2022-06-21 12:44:16 +02:00
Asger F
7c877c7861 Ruby: Rename getARhs -> asSink 2022-06-21 12:44:16 +02:00
Asger F
2f8086bb57 Ruby: Rename getAUse -> getAValueReachableFromSource 2022-06-21 12:44:16 +02:00
Asger F
573c5c5efe Ruby: Rename getAnImmediateUse -> asSource 2022-06-21 12:44:16 +02:00
Asger F
f2403e2610 Ruby: port API graph doc comment 2022-06-21 12:44:16 +02:00
Asger F
092a6a01ac Python: Update member documentation 2022-06-21 12:44:06 +02:00
Asger F
fecbfa6ca3 Python: add deprecation 2022-06-21 12:44:06 +02:00
Asger F
3a669a8d21 Python: getAValueReachingRhs -> getAValueReachingSink 2022-06-21 12:44:06 +02:00
Asger F
b096f9ec72 Python: Rename getAUse -> getAValueReachableFromSource 2022-06-21 12:44:06 +02:00
Asger F
181a53bd03 Python: Rename getAnImmediateUse -> asSource 2022-06-21 12:44:06 +02:00
Asger F
60fde3c031 Python: Rename getARhs -> asSink 2022-06-21 12:44:06 +02:00
Asger F
8f259d4bb6 Python: port API graph doc comment 2022-06-21 12:44:06 +02:00
Alex Denisov
42dc6814f0 Swift: extract all output-producing source files, not only primary files 2022-06-20 14:06:54 +02:00
Harry Maclean
e1dcc207b4 Ruby: Model methods in Rails::Generators::Actions
These methods are sinks for command injection.
2022-06-20 13:36:09 +12:00
Harry Maclean
20ff4c4299 Ruby: Model ActiveRecord::Relation#touch_all 2022-06-20 13:36:02 +12:00
Harry Maclean
7dfab371f6 Ruby: Model redirect_back and redirect_back_or_to
These are ActionController methods that redirect to the HTTP Referer,
falling back to the given location if there is no Referer.
2022-06-20 13:36:02 +12:00
Harry Maclean
a298f5eb5e Ruby: Recognise File.atomic_write as a file writer
This method is an ActiveSupport extension, but there's no harm in
recognising it universally as any identically-named method is likely to
also be a file writer.
2022-06-20 13:36:02 +12:00
Harry Maclean
0ce14fc4e5 Ruby: Recognise ActionCable logger class 2022-06-20 13:36:02 +12:00
Harry Maclean
4ecd595b73 Remove duplicate import 2022-06-20 13:36:02 +12:00
Joe Farebrother
f46dd8cc85 Fix misspellings 2022-06-14 15:34:08 +01:00
Joe Farebrother
a6736a99e4 Apply doc review suggestions -
fix typos and capitilisation; reword description.
2022-06-14 14:56:24 +01:00
Joe Farebrother
c71586e1f8 Remove checks for dynamically registered recievers 2022-06-14 14:56:24 +01:00
Joe Farebrother
320c671b73 Adress reveiw comments - make use of existing ql libraries 2022-06-14 14:56:24 +01:00
Joe Farebrother
9d048e78af Apply suggestions from code review - fix typos/style, make things private
Co-authored-by: Tony Torralba <atorralba@users.noreply.github.com>
2022-06-14 14:56:23 +01:00
Joe Farebrother
d88d216388 Add change note 2022-06-14 14:56:23 +01:00
Joe Farebrother
2fc142f41f Add security severity 2022-06-14 14:56:23 +01:00
Joe Farebrother
8e2e8cc77f Add qhelp 2022-06-14 14:56:22 +01:00
Joe Farebrother
4aed1a1e23 Add test cases; fix handling of recievers declared through xml 2022-06-14 14:56:22 +01:00
Joe Farebrother
87f26bf033 Fix typos 2022-06-14 14:56:22 +01:00
Joe Farebrother
1959f49165 Add Improper Intent Verification query 2022-06-14 14:56:21 +01:00
Mathias Vorreiter Pedersen
7c25063f7f Merge branch 'main' into swift-decls-in-cfg 2022-05-27 17:56:58 +01:00
Mathias Vorreiter Pedersen
df2c1972e9 Swift: Add CFG trees for local declarations and accept test changes. 2022-05-26 09:09:17 +01:00
Mathias Vorreiter Pedersen
b715a6b63b Swift: Add test containing local declarations. 2022-05-26 09:06:13 +01:00
605 changed files with 17965 additions and 5435 deletions

View File

@@ -15,18 +15,22 @@ jobs:
- uses: actions/checkout@v3
- uses: ./.github/actions/fetch-codeql
- uses: bazelbuild/setup-bazelisk@v2
- uses: actions/setup-python@v3
- uses: pre-commit/action@v3.0.0
name: Check that python code is properly formatted
with:
extra_args: autopep8 --all-files
- name: Run unit tests
run: |
bazel test //swift/codegen/test --test_output=errors
- name: Check that QL generated code was checked in
run: |
bazel run //swift/codegen
git add swift
git diff --exit-code HEAD
- uses: pre-commit/action@v3.0.0
name: Check that QL generated code was checked in
with:
extra_args: swift-codegen --all-files
- name: Generate C++ files
run: |
bazel run //swift/codegen:codegen -- --generate=trap,cpp --cpp-output=$PWD/swift-generated-headers
bazel run //swift/codegen:codegen -- --generate=trap,cpp --cpp-output=$PWD/swift-generated-cpp-files
- uses: actions/upload-artifact@v3
with:
name: swift-generated-headers
path: swift-generated-headers/*.h
name: swift-generated-cpp-files
path: swift-generated-cpp-files/**

View File

@@ -15,6 +15,12 @@ repos:
- id: clang-format
files: ^swift/.*\.(h|c|cpp)$
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v1.6.0
hooks:
- id: autopep8
files: ^swift/codegen/.*\.py
- repo: local
hooks:
- id: codeql-format

View File

@@ -453,11 +453,11 @@
"python/ql/src/Lexical/CommentedOutCodeReferences.inc.qhelp"
],
"IDE Contextual Queries": [
"cpp/ql/src/IDEContextual.qll",
"csharp/ql/src/IDEContextual.qll",
"java/ql/src/IDEContextual.qll",
"javascript/ql/src/IDEContextual.qll",
"python/ql/src/analysis/IDEContextual.qll"
"cpp/ql/lib/IDEContextual.qll",
"csharp/ql/lib/IDEContextual.qll",
"java/ql/lib/IDEContextual.qll",
"javascript/ql/lib/IDEContextual.qll",
"python/ql/lib/analysis/IDEContextual.qll"
],
"SSA C#": [
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/SsaImplCommon.qll",

View File

@@ -1,5 +1,5 @@
name: codeql/cpp-all
version: 0.3.0
version: 0.3.1-dev
groups: cpp
dbscheme: semmlecode.cpp.dbscheme
extractor: cpp

View File

@@ -428,7 +428,7 @@ private predicate localFlowStep(NodeEx node1, NodeEx node2, Configuration config
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
simpleLocalFlowStepExt(n1, n2) and
simpleLocalFlowStepExt(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
stepFilter(node1, node2, config)
)
or
@@ -447,7 +447,7 @@ private predicate additionalLocalFlowStep(NodeEx node1, NodeEx node2, Configurat
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, n2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
getNodeEnclosingCallable(n1) = getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config)
)
@@ -466,7 +466,7 @@ private predicate additionalLocalStateStep(
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, s1, n2, s2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), s1, pragma[only_bind_into](n2), s2) and
getNodeEnclosingCallable(n1) = getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not stateBarrier(node1, s1, config) and
@@ -481,7 +481,7 @@ private predicate jumpStep(NodeEx node1, NodeEx node2, Configuration config) {
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
jumpStepCached(n1, n2) and
jumpStepCached(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
stepFilter(node1, node2, config) and
not config.getAFeature() instanceof FeatureEqualSourceSinkCallContext
)
@@ -494,7 +494,7 @@ private predicate additionalJumpStep(NodeEx node1, NodeEx node2, Configuration c
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, n2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
getNodeEnclosingCallable(n1) != getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not config.getAFeature() instanceof FeatureEqualSourceSinkCallContext
@@ -507,7 +507,7 @@ private predicate additionalJumpStateStep(
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, s1, n2, s2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), s1, pragma[only_bind_into](n2), s2) and
getNodeEnclosingCallable(n1) != getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not stateBarrier(node1, s1, config) and
@@ -518,7 +518,7 @@ private predicate additionalJumpStateStep(
pragma[nomagic]
private predicate readSet(NodeEx node1, ContentSet c, NodeEx node2, Configuration config) {
readSet(node1.asNode(), c, node2.asNode()) and
readSet(pragma[only_bind_into](node1.asNode()), c, pragma[only_bind_into](node2.asNode())) and
stepFilter(node1, node2, config)
or
exists(Node n |
@@ -562,7 +562,8 @@ pragma[nomagic]
private predicate store(
NodeEx node1, TypedContent tc, NodeEx node2, DataFlowType contentType, Configuration config
) {
store(node1.asNode(), tc, node2.asNode(), contentType) and
store(pragma[only_bind_into](node1.asNode()), tc, pragma[only_bind_into](node2.asNode()),
contentType) and
read(_, tc.getContent(), _, config) and
stepFilter(node1, node2, config)
}

View File

@@ -428,7 +428,7 @@ private predicate localFlowStep(NodeEx node1, NodeEx node2, Configuration config
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
simpleLocalFlowStepExt(n1, n2) and
simpleLocalFlowStepExt(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
stepFilter(node1, node2, config)
)
or
@@ -447,7 +447,7 @@ private predicate additionalLocalFlowStep(NodeEx node1, NodeEx node2, Configurat
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, n2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
getNodeEnclosingCallable(n1) = getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config)
)
@@ -466,7 +466,7 @@ private predicate additionalLocalStateStep(
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, s1, n2, s2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), s1, pragma[only_bind_into](n2), s2) and
getNodeEnclosingCallable(n1) = getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not stateBarrier(node1, s1, config) and
@@ -481,7 +481,7 @@ private predicate jumpStep(NodeEx node1, NodeEx node2, Configuration config) {
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
jumpStepCached(n1, n2) and
jumpStepCached(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
stepFilter(node1, node2, config) and
not config.getAFeature() instanceof FeatureEqualSourceSinkCallContext
)
@@ -494,7 +494,7 @@ private predicate additionalJumpStep(NodeEx node1, NodeEx node2, Configuration c
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, n2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
getNodeEnclosingCallable(n1) != getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not config.getAFeature() instanceof FeatureEqualSourceSinkCallContext
@@ -507,7 +507,7 @@ private predicate additionalJumpStateStep(
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, s1, n2, s2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), s1, pragma[only_bind_into](n2), s2) and
getNodeEnclosingCallable(n1) != getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not stateBarrier(node1, s1, config) and
@@ -518,7 +518,7 @@ private predicate additionalJumpStateStep(
pragma[nomagic]
private predicate readSet(NodeEx node1, ContentSet c, NodeEx node2, Configuration config) {
readSet(node1.asNode(), c, node2.asNode()) and
readSet(pragma[only_bind_into](node1.asNode()), c, pragma[only_bind_into](node2.asNode())) and
stepFilter(node1, node2, config)
or
exists(Node n |
@@ -562,7 +562,8 @@ pragma[nomagic]
private predicate store(
NodeEx node1, TypedContent tc, NodeEx node2, DataFlowType contentType, Configuration config
) {
store(node1.asNode(), tc, node2.asNode(), contentType) and
store(pragma[only_bind_into](node1.asNode()), tc, pragma[only_bind_into](node2.asNode()),
contentType) and
read(_, tc.getContent(), _, config) and
stepFilter(node1, node2, config)
}

View File

@@ -428,7 +428,7 @@ private predicate localFlowStep(NodeEx node1, NodeEx node2, Configuration config
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
simpleLocalFlowStepExt(n1, n2) and
simpleLocalFlowStepExt(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
stepFilter(node1, node2, config)
)
or
@@ -447,7 +447,7 @@ private predicate additionalLocalFlowStep(NodeEx node1, NodeEx node2, Configurat
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, n2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
getNodeEnclosingCallable(n1) = getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config)
)
@@ -466,7 +466,7 @@ private predicate additionalLocalStateStep(
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, s1, n2, s2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), s1, pragma[only_bind_into](n2), s2) and
getNodeEnclosingCallable(n1) = getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not stateBarrier(node1, s1, config) and
@@ -481,7 +481,7 @@ private predicate jumpStep(NodeEx node1, NodeEx node2, Configuration config) {
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
jumpStepCached(n1, n2) and
jumpStepCached(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
stepFilter(node1, node2, config) and
not config.getAFeature() instanceof FeatureEqualSourceSinkCallContext
)
@@ -494,7 +494,7 @@ private predicate additionalJumpStep(NodeEx node1, NodeEx node2, Configuration c
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, n2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
getNodeEnclosingCallable(n1) != getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not config.getAFeature() instanceof FeatureEqualSourceSinkCallContext
@@ -507,7 +507,7 @@ private predicate additionalJumpStateStep(
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, s1, n2, s2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), s1, pragma[only_bind_into](n2), s2) and
getNodeEnclosingCallable(n1) != getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not stateBarrier(node1, s1, config) and
@@ -518,7 +518,7 @@ private predicate additionalJumpStateStep(
pragma[nomagic]
private predicate readSet(NodeEx node1, ContentSet c, NodeEx node2, Configuration config) {
readSet(node1.asNode(), c, node2.asNode()) and
readSet(pragma[only_bind_into](node1.asNode()), c, pragma[only_bind_into](node2.asNode())) and
stepFilter(node1, node2, config)
or
exists(Node n |
@@ -562,7 +562,8 @@ pragma[nomagic]
private predicate store(
NodeEx node1, TypedContent tc, NodeEx node2, DataFlowType contentType, Configuration config
) {
store(node1.asNode(), tc, node2.asNode(), contentType) and
store(pragma[only_bind_into](node1.asNode()), tc, pragma[only_bind_into](node2.asNode()),
contentType) and
read(_, tc.getContent(), _, config) and
stepFilter(node1, node2, config)
}

View File

@@ -428,7 +428,7 @@ private predicate localFlowStep(NodeEx node1, NodeEx node2, Configuration config
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
simpleLocalFlowStepExt(n1, n2) and
simpleLocalFlowStepExt(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
stepFilter(node1, node2, config)
)
or
@@ -447,7 +447,7 @@ private predicate additionalLocalFlowStep(NodeEx node1, NodeEx node2, Configurat
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, n2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
getNodeEnclosingCallable(n1) = getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config)
)
@@ -466,7 +466,7 @@ private predicate additionalLocalStateStep(
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, s1, n2, s2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), s1, pragma[only_bind_into](n2), s2) and
getNodeEnclosingCallable(n1) = getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not stateBarrier(node1, s1, config) and
@@ -481,7 +481,7 @@ private predicate jumpStep(NodeEx node1, NodeEx node2, Configuration config) {
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
jumpStepCached(n1, n2) and
jumpStepCached(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
stepFilter(node1, node2, config) and
not config.getAFeature() instanceof FeatureEqualSourceSinkCallContext
)
@@ -494,7 +494,7 @@ private predicate additionalJumpStep(NodeEx node1, NodeEx node2, Configuration c
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, n2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
getNodeEnclosingCallable(n1) != getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not config.getAFeature() instanceof FeatureEqualSourceSinkCallContext
@@ -507,7 +507,7 @@ private predicate additionalJumpStateStep(
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, s1, n2, s2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), s1, pragma[only_bind_into](n2), s2) and
getNodeEnclosingCallable(n1) != getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not stateBarrier(node1, s1, config) and
@@ -518,7 +518,7 @@ private predicate additionalJumpStateStep(
pragma[nomagic]
private predicate readSet(NodeEx node1, ContentSet c, NodeEx node2, Configuration config) {
readSet(node1.asNode(), c, node2.asNode()) and
readSet(pragma[only_bind_into](node1.asNode()), c, pragma[only_bind_into](node2.asNode())) and
stepFilter(node1, node2, config)
or
exists(Node n |
@@ -562,7 +562,8 @@ pragma[nomagic]
private predicate store(
NodeEx node1, TypedContent tc, NodeEx node2, DataFlowType contentType, Configuration config
) {
store(node1.asNode(), tc, node2.asNode(), contentType) and
store(pragma[only_bind_into](node1.asNode()), tc, pragma[only_bind_into](node2.asNode()),
contentType) and
read(_, tc.getContent(), _, config) and
stepFilter(node1, node2, config)
}

View File

@@ -428,7 +428,7 @@ private predicate localFlowStep(NodeEx node1, NodeEx node2, Configuration config
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
simpleLocalFlowStepExt(n1, n2) and
simpleLocalFlowStepExt(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
stepFilter(node1, node2, config)
)
or
@@ -447,7 +447,7 @@ private predicate additionalLocalFlowStep(NodeEx node1, NodeEx node2, Configurat
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, n2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
getNodeEnclosingCallable(n1) = getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config)
)
@@ -466,7 +466,7 @@ private predicate additionalLocalStateStep(
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, s1, n2, s2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), s1, pragma[only_bind_into](n2), s2) and
getNodeEnclosingCallable(n1) = getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not stateBarrier(node1, s1, config) and
@@ -481,7 +481,7 @@ private predicate jumpStep(NodeEx node1, NodeEx node2, Configuration config) {
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
jumpStepCached(n1, n2) and
jumpStepCached(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
stepFilter(node1, node2, config) and
not config.getAFeature() instanceof FeatureEqualSourceSinkCallContext
)
@@ -494,7 +494,7 @@ private predicate additionalJumpStep(NodeEx node1, NodeEx node2, Configuration c
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, n2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
getNodeEnclosingCallable(n1) != getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not config.getAFeature() instanceof FeatureEqualSourceSinkCallContext
@@ -507,7 +507,7 @@ private predicate additionalJumpStateStep(
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, s1, n2, s2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), s1, pragma[only_bind_into](n2), s2) and
getNodeEnclosingCallable(n1) != getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not stateBarrier(node1, s1, config) and
@@ -518,7 +518,7 @@ private predicate additionalJumpStateStep(
pragma[nomagic]
private predicate readSet(NodeEx node1, ContentSet c, NodeEx node2, Configuration config) {
readSet(node1.asNode(), c, node2.asNode()) and
readSet(pragma[only_bind_into](node1.asNode()), c, pragma[only_bind_into](node2.asNode())) and
stepFilter(node1, node2, config)
or
exists(Node n |
@@ -562,7 +562,8 @@ pragma[nomagic]
private predicate store(
NodeEx node1, TypedContent tc, NodeEx node2, DataFlowType contentType, Configuration config
) {
store(node1.asNode(), tc, node2.asNode(), contentType) and
store(pragma[only_bind_into](node1.asNode()), tc, pragma[only_bind_into](node2.asNode()),
contentType) and
read(_, tc.getContent(), _, config) and
stepFilter(node1, node2, config)
}

View File

@@ -428,7 +428,7 @@ private predicate localFlowStep(NodeEx node1, NodeEx node2, Configuration config
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
simpleLocalFlowStepExt(n1, n2) and
simpleLocalFlowStepExt(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
stepFilter(node1, node2, config)
)
or
@@ -447,7 +447,7 @@ private predicate additionalLocalFlowStep(NodeEx node1, NodeEx node2, Configurat
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, n2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
getNodeEnclosingCallable(n1) = getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config)
)
@@ -466,7 +466,7 @@ private predicate additionalLocalStateStep(
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, s1, n2, s2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), s1, pragma[only_bind_into](n2), s2) and
getNodeEnclosingCallable(n1) = getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not stateBarrier(node1, s1, config) and
@@ -481,7 +481,7 @@ private predicate jumpStep(NodeEx node1, NodeEx node2, Configuration config) {
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
jumpStepCached(n1, n2) and
jumpStepCached(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
stepFilter(node1, node2, config) and
not config.getAFeature() instanceof FeatureEqualSourceSinkCallContext
)
@@ -494,7 +494,7 @@ private predicate additionalJumpStep(NodeEx node1, NodeEx node2, Configuration c
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, n2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
getNodeEnclosingCallable(n1) != getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not config.getAFeature() instanceof FeatureEqualSourceSinkCallContext
@@ -507,7 +507,7 @@ private predicate additionalJumpStateStep(
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, s1, n2, s2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), s1, pragma[only_bind_into](n2), s2) and
getNodeEnclosingCallable(n1) != getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not stateBarrier(node1, s1, config) and
@@ -518,7 +518,7 @@ private predicate additionalJumpStateStep(
pragma[nomagic]
private predicate readSet(NodeEx node1, ContentSet c, NodeEx node2, Configuration config) {
readSet(node1.asNode(), c, node2.asNode()) and
readSet(pragma[only_bind_into](node1.asNode()), c, pragma[only_bind_into](node2.asNode())) and
stepFilter(node1, node2, config)
or
exists(Node n |
@@ -562,7 +562,8 @@ pragma[nomagic]
private predicate store(
NodeEx node1, TypedContent tc, NodeEx node2, DataFlowType contentType, Configuration config
) {
store(node1.asNode(), tc, node2.asNode(), contentType) and
store(pragma[only_bind_into](node1.asNode()), tc, pragma[only_bind_into](node2.asNode()),
contentType) and
read(_, tc.getContent(), _, config) and
stepFilter(node1, node2, config)
}

View File

@@ -428,7 +428,7 @@ private predicate localFlowStep(NodeEx node1, NodeEx node2, Configuration config
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
simpleLocalFlowStepExt(n1, n2) and
simpleLocalFlowStepExt(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
stepFilter(node1, node2, config)
)
or
@@ -447,7 +447,7 @@ private predicate additionalLocalFlowStep(NodeEx node1, NodeEx node2, Configurat
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, n2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
getNodeEnclosingCallable(n1) = getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config)
)
@@ -466,7 +466,7 @@ private predicate additionalLocalStateStep(
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, s1, n2, s2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), s1, pragma[only_bind_into](n2), s2) and
getNodeEnclosingCallable(n1) = getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not stateBarrier(node1, s1, config) and
@@ -481,7 +481,7 @@ private predicate jumpStep(NodeEx node1, NodeEx node2, Configuration config) {
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
jumpStepCached(n1, n2) and
jumpStepCached(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
stepFilter(node1, node2, config) and
not config.getAFeature() instanceof FeatureEqualSourceSinkCallContext
)
@@ -494,7 +494,7 @@ private predicate additionalJumpStep(NodeEx node1, NodeEx node2, Configuration c
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, n2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
getNodeEnclosingCallable(n1) != getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not config.getAFeature() instanceof FeatureEqualSourceSinkCallContext
@@ -507,7 +507,7 @@ private predicate additionalJumpStateStep(
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, s1, n2, s2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), s1, pragma[only_bind_into](n2), s2) and
getNodeEnclosingCallable(n1) != getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not stateBarrier(node1, s1, config) and
@@ -518,7 +518,7 @@ private predicate additionalJumpStateStep(
pragma[nomagic]
private predicate readSet(NodeEx node1, ContentSet c, NodeEx node2, Configuration config) {
readSet(node1.asNode(), c, node2.asNode()) and
readSet(pragma[only_bind_into](node1.asNode()), c, pragma[only_bind_into](node2.asNode())) and
stepFilter(node1, node2, config)
or
exists(Node n |
@@ -562,7 +562,8 @@ pragma[nomagic]
private predicate store(
NodeEx node1, TypedContent tc, NodeEx node2, DataFlowType contentType, Configuration config
) {
store(node1.asNode(), tc, node2.asNode(), contentType) and
store(pragma[only_bind_into](node1.asNode()), tc, pragma[only_bind_into](node2.asNode()),
contentType) and
read(_, tc.getContent(), _, config) and
stepFilter(node1, node2, config)
}

View File

@@ -428,7 +428,7 @@ private predicate localFlowStep(NodeEx node1, NodeEx node2, Configuration config
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
simpleLocalFlowStepExt(n1, n2) and
simpleLocalFlowStepExt(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
stepFilter(node1, node2, config)
)
or
@@ -447,7 +447,7 @@ private predicate additionalLocalFlowStep(NodeEx node1, NodeEx node2, Configurat
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, n2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
getNodeEnclosingCallable(n1) = getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config)
)
@@ -466,7 +466,7 @@ private predicate additionalLocalStateStep(
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, s1, n2, s2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), s1, pragma[only_bind_into](n2), s2) and
getNodeEnclosingCallable(n1) = getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not stateBarrier(node1, s1, config) and
@@ -481,7 +481,7 @@ private predicate jumpStep(NodeEx node1, NodeEx node2, Configuration config) {
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
jumpStepCached(n1, n2) and
jumpStepCached(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
stepFilter(node1, node2, config) and
not config.getAFeature() instanceof FeatureEqualSourceSinkCallContext
)
@@ -494,7 +494,7 @@ private predicate additionalJumpStep(NodeEx node1, NodeEx node2, Configuration c
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, n2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
getNodeEnclosingCallable(n1) != getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not config.getAFeature() instanceof FeatureEqualSourceSinkCallContext
@@ -507,7 +507,7 @@ private predicate additionalJumpStateStep(
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, s1, n2, s2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), s1, pragma[only_bind_into](n2), s2) and
getNodeEnclosingCallable(n1) != getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not stateBarrier(node1, s1, config) and
@@ -518,7 +518,7 @@ private predicate additionalJumpStateStep(
pragma[nomagic]
private predicate readSet(NodeEx node1, ContentSet c, NodeEx node2, Configuration config) {
readSet(node1.asNode(), c, node2.asNode()) and
readSet(pragma[only_bind_into](node1.asNode()), c, pragma[only_bind_into](node2.asNode())) and
stepFilter(node1, node2, config)
or
exists(Node n |
@@ -562,7 +562,8 @@ pragma[nomagic]
private predicate store(
NodeEx node1, TypedContent tc, NodeEx node2, DataFlowType contentType, Configuration config
) {
store(node1.asNode(), tc, node2.asNode(), contentType) and
store(pragma[only_bind_into](node1.asNode()), tc, pragma[only_bind_into](node2.asNode()),
contentType) and
read(_, tc.getContent(), _, config) and
stepFilter(node1, node2, config)
}

View File

@@ -428,7 +428,7 @@ private predicate localFlowStep(NodeEx node1, NodeEx node2, Configuration config
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
simpleLocalFlowStepExt(n1, n2) and
simpleLocalFlowStepExt(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
stepFilter(node1, node2, config)
)
or
@@ -447,7 +447,7 @@ private predicate additionalLocalFlowStep(NodeEx node1, NodeEx node2, Configurat
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, n2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
getNodeEnclosingCallable(n1) = getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config)
)
@@ -466,7 +466,7 @@ private predicate additionalLocalStateStep(
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, s1, n2, s2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), s1, pragma[only_bind_into](n2), s2) and
getNodeEnclosingCallable(n1) = getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not stateBarrier(node1, s1, config) and
@@ -481,7 +481,7 @@ private predicate jumpStep(NodeEx node1, NodeEx node2, Configuration config) {
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
jumpStepCached(n1, n2) and
jumpStepCached(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
stepFilter(node1, node2, config) and
not config.getAFeature() instanceof FeatureEqualSourceSinkCallContext
)
@@ -494,7 +494,7 @@ private predicate additionalJumpStep(NodeEx node1, NodeEx node2, Configuration c
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, n2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
getNodeEnclosingCallable(n1) != getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not config.getAFeature() instanceof FeatureEqualSourceSinkCallContext
@@ -507,7 +507,7 @@ private predicate additionalJumpStateStep(
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, s1, n2, s2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), s1, pragma[only_bind_into](n2), s2) and
getNodeEnclosingCallable(n1) != getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not stateBarrier(node1, s1, config) and
@@ -518,7 +518,7 @@ private predicate additionalJumpStateStep(
pragma[nomagic]
private predicate readSet(NodeEx node1, ContentSet c, NodeEx node2, Configuration config) {
readSet(node1.asNode(), c, node2.asNode()) and
readSet(pragma[only_bind_into](node1.asNode()), c, pragma[only_bind_into](node2.asNode())) and
stepFilter(node1, node2, config)
or
exists(Node n |
@@ -562,7 +562,8 @@ pragma[nomagic]
private predicate store(
NodeEx node1, TypedContent tc, NodeEx node2, DataFlowType contentType, Configuration config
) {
store(node1.asNode(), tc, node2.asNode(), contentType) and
store(pragma[only_bind_into](node1.asNode()), tc, pragma[only_bind_into](node2.asNode()),
contentType) and
read(_, tc.getContent(), _, config) and
stepFilter(node1, node2, config)
}

View File

@@ -133,7 +133,9 @@ TGlobalAddress globalAddress(Instruction instr) {
)
or
exists(FieldAddressInstruction fai | instr = fai |
result = TFieldAddress(globalAddress(fai.getObjectAddress()), fai.getField())
result =
TFieldAddress(globalAddress(pragma[only_bind_into](fai.getObjectAddress())),
pragma[only_bind_out](fai.getField()))
)
or
result = globalAddress(instr.(PointerOffsetInstruction).getLeft())

View File

@@ -0,0 +1,4 @@
---
category: breaking
---
* Contextual queries and the query libraries they depend on have been moved to the `codeql/cpp-all` package.

View File

@@ -1,5 +1,5 @@
name: codeql/cpp-queries
version: 0.2.0
version: 0.2.1-dev
groups:
- cpp
- queries

View File

@@ -1,5 +1,5 @@
name: codeql/csharp-solorigate-all
version: 1.2.0
version: 1.2.1-dev
groups:
- csharp
- solorigate

View File

@@ -1,5 +1,5 @@
name: codeql/csharp-solorigate-queries
version: 1.2.0
version: 1.2.1-dev
groups:
- csharp
- solorigate

View File

@@ -1,5 +1,5 @@
name: codeql/csharp-all
version: 0.3.0
version: 0.3.1-dev
groups: csharp
dbscheme: semmlecode.csharp.dbscheme
extractor: csharp

View File

@@ -428,7 +428,7 @@ private predicate localFlowStep(NodeEx node1, NodeEx node2, Configuration config
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
simpleLocalFlowStepExt(n1, n2) and
simpleLocalFlowStepExt(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
stepFilter(node1, node2, config)
)
or
@@ -447,7 +447,7 @@ private predicate additionalLocalFlowStep(NodeEx node1, NodeEx node2, Configurat
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, n2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
getNodeEnclosingCallable(n1) = getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config)
)
@@ -466,7 +466,7 @@ private predicate additionalLocalStateStep(
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, s1, n2, s2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), s1, pragma[only_bind_into](n2), s2) and
getNodeEnclosingCallable(n1) = getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not stateBarrier(node1, s1, config) and
@@ -481,7 +481,7 @@ private predicate jumpStep(NodeEx node1, NodeEx node2, Configuration config) {
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
jumpStepCached(n1, n2) and
jumpStepCached(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
stepFilter(node1, node2, config) and
not config.getAFeature() instanceof FeatureEqualSourceSinkCallContext
)
@@ -494,7 +494,7 @@ private predicate additionalJumpStep(NodeEx node1, NodeEx node2, Configuration c
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, n2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
getNodeEnclosingCallable(n1) != getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not config.getAFeature() instanceof FeatureEqualSourceSinkCallContext
@@ -507,7 +507,7 @@ private predicate additionalJumpStateStep(
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, s1, n2, s2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), s1, pragma[only_bind_into](n2), s2) and
getNodeEnclosingCallable(n1) != getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not stateBarrier(node1, s1, config) and
@@ -518,7 +518,7 @@ private predicate additionalJumpStateStep(
pragma[nomagic]
private predicate readSet(NodeEx node1, ContentSet c, NodeEx node2, Configuration config) {
readSet(node1.asNode(), c, node2.asNode()) and
readSet(pragma[only_bind_into](node1.asNode()), c, pragma[only_bind_into](node2.asNode())) and
stepFilter(node1, node2, config)
or
exists(Node n |
@@ -562,7 +562,8 @@ pragma[nomagic]
private predicate store(
NodeEx node1, TypedContent tc, NodeEx node2, DataFlowType contentType, Configuration config
) {
store(node1.asNode(), tc, node2.asNode(), contentType) and
store(pragma[only_bind_into](node1.asNode()), tc, pragma[only_bind_into](node2.asNode()),
contentType) and
read(_, tc.getContent(), _, config) and
stepFilter(node1, node2, config)
}

View File

@@ -428,7 +428,7 @@ private predicate localFlowStep(NodeEx node1, NodeEx node2, Configuration config
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
simpleLocalFlowStepExt(n1, n2) and
simpleLocalFlowStepExt(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
stepFilter(node1, node2, config)
)
or
@@ -447,7 +447,7 @@ private predicate additionalLocalFlowStep(NodeEx node1, NodeEx node2, Configurat
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, n2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
getNodeEnclosingCallable(n1) = getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config)
)
@@ -466,7 +466,7 @@ private predicate additionalLocalStateStep(
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, s1, n2, s2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), s1, pragma[only_bind_into](n2), s2) and
getNodeEnclosingCallable(n1) = getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not stateBarrier(node1, s1, config) and
@@ -481,7 +481,7 @@ private predicate jumpStep(NodeEx node1, NodeEx node2, Configuration config) {
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
jumpStepCached(n1, n2) and
jumpStepCached(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
stepFilter(node1, node2, config) and
not config.getAFeature() instanceof FeatureEqualSourceSinkCallContext
)
@@ -494,7 +494,7 @@ private predicate additionalJumpStep(NodeEx node1, NodeEx node2, Configuration c
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, n2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
getNodeEnclosingCallable(n1) != getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not config.getAFeature() instanceof FeatureEqualSourceSinkCallContext
@@ -507,7 +507,7 @@ private predicate additionalJumpStateStep(
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, s1, n2, s2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), s1, pragma[only_bind_into](n2), s2) and
getNodeEnclosingCallable(n1) != getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not stateBarrier(node1, s1, config) and
@@ -518,7 +518,7 @@ private predicate additionalJumpStateStep(
pragma[nomagic]
private predicate readSet(NodeEx node1, ContentSet c, NodeEx node2, Configuration config) {
readSet(node1.asNode(), c, node2.asNode()) and
readSet(pragma[only_bind_into](node1.asNode()), c, pragma[only_bind_into](node2.asNode())) and
stepFilter(node1, node2, config)
or
exists(Node n |
@@ -562,7 +562,8 @@ pragma[nomagic]
private predicate store(
NodeEx node1, TypedContent tc, NodeEx node2, DataFlowType contentType, Configuration config
) {
store(node1.asNode(), tc, node2.asNode(), contentType) and
store(pragma[only_bind_into](node1.asNode()), tc, pragma[only_bind_into](node2.asNode()),
contentType) and
read(_, tc.getContent(), _, config) and
stepFilter(node1, node2, config)
}

View File

@@ -428,7 +428,7 @@ private predicate localFlowStep(NodeEx node1, NodeEx node2, Configuration config
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
simpleLocalFlowStepExt(n1, n2) and
simpleLocalFlowStepExt(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
stepFilter(node1, node2, config)
)
or
@@ -447,7 +447,7 @@ private predicate additionalLocalFlowStep(NodeEx node1, NodeEx node2, Configurat
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, n2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
getNodeEnclosingCallable(n1) = getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config)
)
@@ -466,7 +466,7 @@ private predicate additionalLocalStateStep(
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, s1, n2, s2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), s1, pragma[only_bind_into](n2), s2) and
getNodeEnclosingCallable(n1) = getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not stateBarrier(node1, s1, config) and
@@ -481,7 +481,7 @@ private predicate jumpStep(NodeEx node1, NodeEx node2, Configuration config) {
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
jumpStepCached(n1, n2) and
jumpStepCached(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
stepFilter(node1, node2, config) and
not config.getAFeature() instanceof FeatureEqualSourceSinkCallContext
)
@@ -494,7 +494,7 @@ private predicate additionalJumpStep(NodeEx node1, NodeEx node2, Configuration c
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, n2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
getNodeEnclosingCallable(n1) != getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not config.getAFeature() instanceof FeatureEqualSourceSinkCallContext
@@ -507,7 +507,7 @@ private predicate additionalJumpStateStep(
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, s1, n2, s2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), s1, pragma[only_bind_into](n2), s2) and
getNodeEnclosingCallable(n1) != getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not stateBarrier(node1, s1, config) and
@@ -518,7 +518,7 @@ private predicate additionalJumpStateStep(
pragma[nomagic]
private predicate readSet(NodeEx node1, ContentSet c, NodeEx node2, Configuration config) {
readSet(node1.asNode(), c, node2.asNode()) and
readSet(pragma[only_bind_into](node1.asNode()), c, pragma[only_bind_into](node2.asNode())) and
stepFilter(node1, node2, config)
or
exists(Node n |
@@ -562,7 +562,8 @@ pragma[nomagic]
private predicate store(
NodeEx node1, TypedContent tc, NodeEx node2, DataFlowType contentType, Configuration config
) {
store(node1.asNode(), tc, node2.asNode(), contentType) and
store(pragma[only_bind_into](node1.asNode()), tc, pragma[only_bind_into](node2.asNode()),
contentType) and
read(_, tc.getContent(), _, config) and
stepFilter(node1, node2, config)
}

View File

@@ -428,7 +428,7 @@ private predicate localFlowStep(NodeEx node1, NodeEx node2, Configuration config
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
simpleLocalFlowStepExt(n1, n2) and
simpleLocalFlowStepExt(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
stepFilter(node1, node2, config)
)
or
@@ -447,7 +447,7 @@ private predicate additionalLocalFlowStep(NodeEx node1, NodeEx node2, Configurat
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, n2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
getNodeEnclosingCallable(n1) = getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config)
)
@@ -466,7 +466,7 @@ private predicate additionalLocalStateStep(
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, s1, n2, s2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), s1, pragma[only_bind_into](n2), s2) and
getNodeEnclosingCallable(n1) = getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not stateBarrier(node1, s1, config) and
@@ -481,7 +481,7 @@ private predicate jumpStep(NodeEx node1, NodeEx node2, Configuration config) {
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
jumpStepCached(n1, n2) and
jumpStepCached(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
stepFilter(node1, node2, config) and
not config.getAFeature() instanceof FeatureEqualSourceSinkCallContext
)
@@ -494,7 +494,7 @@ private predicate additionalJumpStep(NodeEx node1, NodeEx node2, Configuration c
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, n2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
getNodeEnclosingCallable(n1) != getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not config.getAFeature() instanceof FeatureEqualSourceSinkCallContext
@@ -507,7 +507,7 @@ private predicate additionalJumpStateStep(
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, s1, n2, s2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), s1, pragma[only_bind_into](n2), s2) and
getNodeEnclosingCallable(n1) != getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not stateBarrier(node1, s1, config) and
@@ -518,7 +518,7 @@ private predicate additionalJumpStateStep(
pragma[nomagic]
private predicate readSet(NodeEx node1, ContentSet c, NodeEx node2, Configuration config) {
readSet(node1.asNode(), c, node2.asNode()) and
readSet(pragma[only_bind_into](node1.asNode()), c, pragma[only_bind_into](node2.asNode())) and
stepFilter(node1, node2, config)
or
exists(Node n |
@@ -562,7 +562,8 @@ pragma[nomagic]
private predicate store(
NodeEx node1, TypedContent tc, NodeEx node2, DataFlowType contentType, Configuration config
) {
store(node1.asNode(), tc, node2.asNode(), contentType) and
store(pragma[only_bind_into](node1.asNode()), tc, pragma[only_bind_into](node2.asNode()),
contentType) and
read(_, tc.getContent(), _, config) and
stepFilter(node1, node2, config)
}

View File

@@ -428,7 +428,7 @@ private predicate localFlowStep(NodeEx node1, NodeEx node2, Configuration config
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
simpleLocalFlowStepExt(n1, n2) and
simpleLocalFlowStepExt(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
stepFilter(node1, node2, config)
)
or
@@ -447,7 +447,7 @@ private predicate additionalLocalFlowStep(NodeEx node1, NodeEx node2, Configurat
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, n2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
getNodeEnclosingCallable(n1) = getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config)
)
@@ -466,7 +466,7 @@ private predicate additionalLocalStateStep(
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, s1, n2, s2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), s1, pragma[only_bind_into](n2), s2) and
getNodeEnclosingCallable(n1) = getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not stateBarrier(node1, s1, config) and
@@ -481,7 +481,7 @@ private predicate jumpStep(NodeEx node1, NodeEx node2, Configuration config) {
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
jumpStepCached(n1, n2) and
jumpStepCached(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
stepFilter(node1, node2, config) and
not config.getAFeature() instanceof FeatureEqualSourceSinkCallContext
)
@@ -494,7 +494,7 @@ private predicate additionalJumpStep(NodeEx node1, NodeEx node2, Configuration c
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, n2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
getNodeEnclosingCallable(n1) != getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not config.getAFeature() instanceof FeatureEqualSourceSinkCallContext
@@ -507,7 +507,7 @@ private predicate additionalJumpStateStep(
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, s1, n2, s2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), s1, pragma[only_bind_into](n2), s2) and
getNodeEnclosingCallable(n1) != getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not stateBarrier(node1, s1, config) and
@@ -518,7 +518,7 @@ private predicate additionalJumpStateStep(
pragma[nomagic]
private predicate readSet(NodeEx node1, ContentSet c, NodeEx node2, Configuration config) {
readSet(node1.asNode(), c, node2.asNode()) and
readSet(pragma[only_bind_into](node1.asNode()), c, pragma[only_bind_into](node2.asNode())) and
stepFilter(node1, node2, config)
or
exists(Node n |
@@ -562,7 +562,8 @@ pragma[nomagic]
private predicate store(
NodeEx node1, TypedContent tc, NodeEx node2, DataFlowType contentType, Configuration config
) {
store(node1.asNode(), tc, node2.asNode(), contentType) and
store(pragma[only_bind_into](node1.asNode()), tc, pragma[only_bind_into](node2.asNode()),
contentType) and
read(_, tc.getContent(), _, config) and
stepFilter(node1, node2, config)
}

View File

@@ -428,7 +428,7 @@ private predicate localFlowStep(NodeEx node1, NodeEx node2, Configuration config
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
simpleLocalFlowStepExt(n1, n2) and
simpleLocalFlowStepExt(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
stepFilter(node1, node2, config)
)
or
@@ -447,7 +447,7 @@ private predicate additionalLocalFlowStep(NodeEx node1, NodeEx node2, Configurat
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, n2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
getNodeEnclosingCallable(n1) = getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config)
)
@@ -466,7 +466,7 @@ private predicate additionalLocalStateStep(
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, s1, n2, s2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), s1, pragma[only_bind_into](n2), s2) and
getNodeEnclosingCallable(n1) = getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not stateBarrier(node1, s1, config) and
@@ -481,7 +481,7 @@ private predicate jumpStep(NodeEx node1, NodeEx node2, Configuration config) {
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
jumpStepCached(n1, n2) and
jumpStepCached(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
stepFilter(node1, node2, config) and
not config.getAFeature() instanceof FeatureEqualSourceSinkCallContext
)
@@ -494,7 +494,7 @@ private predicate additionalJumpStep(NodeEx node1, NodeEx node2, Configuration c
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, n2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), pragma[only_bind_into](n2)) and
getNodeEnclosingCallable(n1) != getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not config.getAFeature() instanceof FeatureEqualSourceSinkCallContext
@@ -507,7 +507,7 @@ private predicate additionalJumpStateStep(
exists(Node n1, Node n2 |
node1.asNode() = n1 and
node2.asNode() = n2 and
config.isAdditionalFlowStep(n1, s1, n2, s2) and
config.isAdditionalFlowStep(pragma[only_bind_into](n1), s1, pragma[only_bind_into](n2), s2) and
getNodeEnclosingCallable(n1) != getNodeEnclosingCallable(n2) and
stepFilter(node1, node2, config) and
not stateBarrier(node1, s1, config) and
@@ -518,7 +518,7 @@ private predicate additionalJumpStateStep(
pragma[nomagic]
private predicate readSet(NodeEx node1, ContentSet c, NodeEx node2, Configuration config) {
readSet(node1.asNode(), c, node2.asNode()) and
readSet(pragma[only_bind_into](node1.asNode()), c, pragma[only_bind_into](node2.asNode())) and
stepFilter(node1, node2, config)
or
exists(Node n |
@@ -562,7 +562,8 @@ pragma[nomagic]
private predicate store(
NodeEx node1, TypedContent tc, NodeEx node2, DataFlowType contentType, Configuration config
) {
store(node1.asNode(), tc, node2.asNode(), contentType) and
store(pragma[only_bind_into](node1.asNode()), tc, pragma[only_bind_into](node2.asNode()),
contentType) and
read(_, tc.getContent(), _, config) and
stepFilter(node1, node2, config)
}

View File

@@ -0,0 +1,4 @@
---
category: breaking
---
* Contextual queries and the query libraries they depend on have been moved to the `codeql/csharp-all` package.

View File

@@ -1,5 +1,5 @@
name: codeql/csharp-queries
version: 0.2.0
version: 0.2.1-dev
groups:
- csharp
- queries

View File

@@ -2,4 +2,4 @@
Note
The CodeQL package management functionality, including CodeQL packs, is currently available as a beta release and is subject to change. During the beta release, CodeQL packs are available only using GitHub Packages - the GitHub Container registry. To use this beta functionality, install version 2.6.0 or higher of the CodeQL CLI bundle from: https://github.com/github/codeql-action/releases.
The CodeQL package management functionality, including CodeQL packs, is currently available as a beta release and is subject to change. During the beta release, CodeQL packs are available only using GitHub Packages - the GitHub Container registry. To use this beta functionality, install the latest version of the CodeQL CLI bundle from: https://github.com/github/codeql-action/releases.

View File

@@ -1,5 +1,5 @@
name: codeql/go-all
version: 0.2.0
version: 0.2.1-dev
groups: go
dbscheme: go.dbscheme
extractor: go

View File

@@ -1,5 +1,5 @@
name: codeql/go-queries
version: 0.2.0
version: 0.2.1-dev
groups:
- go
- queries

View File

@@ -1,121 +1,121 @@
package,sink,source,summary,sink:bean-validation,sink:create-file,sink:groovy,sink:header-splitting,sink:information-leak,sink:intent-start,sink:jdbc-url,sink:jexl,sink:jndi-injection,sink:ldap,sink:logging,sink:mvel,sink:ognl-injection,sink:open-url,sink:pending-intent-sent,sink:regex-use[-1],sink:regex-use[0],sink:regex-use[],sink:regex-use[f-1],sink:regex-use[f1],sink:regex-use[f],sink:set-hostname-verifier,sink:sql,sink:url-open-stream,sink:url-redirect,sink:write-file,sink:xpath,sink:xslt,sink:xss,source:android-widget,source:contentprovider,source:remote,summary:taint,summary:value
android.app,16,,103,,,,,,7,,,,,,,,,9,,,,,,,,,,,,,,,,,,18,85
android.content,24,27,108,,,,,,16,,,,,,,,,,,,,,,,,8,,,,,,,,27,,31,77
android.database,59,,30,,,,,,,,,,,,,,,,,,,,,,,59,,,,,,,,,,30,
android.net,,,60,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,45,15
android.os,,,122,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,41,81
android.util,6,16,,,,,,,,,,,,6,,,,,,,,,,,,,,,,,,,,,16,,
android.webkit,3,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,,,2,,
android.widget,,1,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,,,1,
androidx.slice,2,5,88,,,,,,,,,,,,,,,2,,,,,,,,,,,,,,,,5,,27,61
cn.hutool.core.codec,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,
com.esotericsoftware.kryo.io,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,
com.esotericsoftware.kryo5.io,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,
com.fasterxml.jackson.core,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,
com.fasterxml.jackson.databind,,,6,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,6,
com.google.common.base,4,,85,,,,,,,,,,,,,,,,,3,1,,,,,,,,,,,,,,,62,23
com.google.common.cache,,,17,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,17
com.google.common.collect,,,553,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,551
com.google.common.flogger,29,,,,,,,,,,,,,29,,,,,,,,,,,,,,,,,,,,,,,
com.google.common.io,6,,73,,,,,,,,,,,,,,,,,,,,,,,,6,,,,,,,,,72,1
com.opensymphony.xwork2.ognl,3,,,,,,,,,,,,,,,3,,,,,,,,,,,,,,,,,,,,,
com.rabbitmq.client,,21,7,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,21,7,
com.unboundid.ldap.sdk,17,,,,,,,,,,,,17,,,,,,,,,,,,,,,,,,,,,,,,
com.zaxxer.hikari,2,,,,,,,,,2,,,,,,,,,,,,,,,,,,,,,,,,,,,
flexjson,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1
groovy.lang,26,,,,,26,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
groovy.util,5,,,,,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
jakarta.faces.context,2,7,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,,,7,,
jakarta.json,,,123,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,100,23
jakarta.ws.rs.client,1,,,,,,,,,,,,,,,,1,,,,,,,,,,,,,,,,,,,,
jakarta.ws.rs.container,,9,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9,,
jakarta.ws.rs.core,2,,149,,,,,,,,,,,,,,,,,,,,,,,,,2,,,,,,,,94,55
java.beans,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,
java.io,37,,39,,15,,,,,,,,,,,,,,,,,,,,,,,,22,,,,,,,39,
java.lang,13,,58,,,,,,,,,,,8,,,,,4,,,1,,,,,,,,,,,,,,46,12
java.net,10,3,7,,,,,,,,,,,,,,10,,,,,,,,,,,,,,,,,,3,7,
java.nio,15,,6,,13,,,,,,,,,,,,,,,,,,,,,,,,2,,,,,,,6,
java.sql,11,,,,,,,,,4,,,,,,,,,,,,,,,,7,,,,,,,,,,,
java.util,44,,438,,,,,,,,,,,34,,,,,,5,2,,1,2,,,,,,,,,,,,24,414
javax.faces.context,2,7,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,,,7,,
javax.jms,,9,57,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9,57,
javax.json,,,123,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,100,23
javax.management.remote,2,,,,,,,,,,,2,,,,,,,,,,,,,,,,,,,,,,,,,
javax.naming,7,,,,,,,,,,,6,1,,,,,,,,,,,,,,,,,,,,,,,,
javax.net.ssl,2,,,,,,,,,,,,,,,,,,,,,,,,2,,,,,,,,,,,,
javax.script,1,,,,,,,,,,,,,,1,,,,,,,,,,,,,,,,,,,,,,
javax.servlet,4,21,2,,,,3,1,,,,,,,,,,,,,,,,,,,,,,,,,,,21,2,
javax.validation,1,1,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,,
javax.ws.rs.client,1,,,,,,,,,,,,,,,,1,,,,,,,,,,,,,,,,,,,,
javax.ws.rs.container,,9,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9,,
javax.ws.rs.core,3,,149,,,,1,,,,,,,,,,,,,,,,,,,,,2,,,,,,,,94,55
javax.xml.transform,1,,6,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,,,,,6,
javax.xml.xpath,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,,,,,,,
jodd.json,,,10,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,10
kotlin.jvm.internal,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1
net.sf.saxon.s9api,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,,,,,,
ognl,6,,,,,,,,,,,,,,,6,,,,,,,,,,,,,,,,,,,,,
okhttp3,2,,47,,,,,,,,,,,,,,2,,,,,,,,,,,,,,,,,,,22,25
org.apache.commons.codec,,,6,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,6,
org.apache.commons.collections,,,800,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,17,783
org.apache.commons.collections4,,,800,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,17,783
org.apache.commons.io,104,,561,,89,,,,,,,,,,,,15,,,,,,,,,,,,,,,,,,,547,14
org.apache.commons.jexl2,15,,,,,,,,,,15,,,,,,,,,,,,,,,,,,,,,,,,,,
org.apache.commons.jexl3,15,,,,,,,,,,15,,,,,,,,,,,,,,,,,,,,,,,,,,
org.apache.commons.lang3,,,424,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,293,131
org.apache.commons.logging,6,,,,,,,,,,,,,6,,,,,,,,,,,,,,,,,,,,,,,
org.apache.commons.ognl,6,,,,,,,,,,,,,,,6,,,,,,,,,,,,,,,,,,,,,
org.apache.commons.text,,,272,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,220,52
org.apache.directory.ldap.client.api,1,,,,,,,,,,,,1,,,,,,,,,,,,,,,,,,,,,,,,
org.apache.hc.core5.function,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,
org.apache.hc.core5.http,1,2,39,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,,,2,39,
org.apache.hc.core5.net,,,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,
org.apache.hc.core5.util,,,24,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,18,6
org.apache.http,27,3,70,,,,,,,,,,,,,,25,,,,,,,,,,,,,,,2,,,3,62,8
org.apache.ibatis.jdbc,6,,57,,,,,,,,,,,,,,,,,,,,,,,6,,,,,,,,,,57,
org.apache.log4j,11,,,,,,,,,,,,,11,,,,,,,,,,,,,,,,,,,,,,,
org.apache.logging.log4j,359,,8,,,,,,,,,,,359,,,,,,,,,,,,,,,,,,,,,,4,4
org.apache.shiro.codec,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,
org.apache.shiro.jndi,1,,,,,,,,,,,1,,,,,,,,,,,,,,,,,,,,,,,,,
org.codehaus.groovy.control,1,,,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
org.dom4j,20,,,,,,,,,,,,,,,,,,,,,,,,,,,,,20,,,,,,,
org.hibernate,7,,,,,,,,,,,,,,,,,,,,,,,,,7,,,,,,,,,,,
org.jboss.logging,324,,,,,,,,,,,,,324,,,,,,,,,,,,,,,,,,,,,,,
org.jdbi.v3.core,6,,,,,,,,,6,,,,,,,,,,,,,,,,,,,,,,,,,,,
org.jooq,1,,,,,,,,,,,,,,,,,,,,,,,,,1,,,,,,,,,,,
org.json,,,236,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,198,38
org.mvel2,16,,,,,,,,,,,,,,16,,,,,,,,,,,,,,,,,,,,,,
org.scijava.log,13,,,,,,,,,,,,,13,,,,,,,,,,,,,,,,,,,,,,,
org.slf4j,55,,6,,,,,,,,,,,55,,,,,,,,,,,,,,,,,,,,,,2,4
org.springframework.beans,,,30,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,30
org.springframework.boot.jdbc,1,,,,,,,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,
org.springframework.cache,,,13,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,13
org.springframework.context,,,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,
org.springframework.http,14,,70,,,,,,,,,,,,,,14,,,,,,,,,,,,,,,,,,,60,10
org.springframework.jdbc.core,10,,,,,,,,,,,,,,,,,,,,,,,,,10,,,,,,,,,,,
org.springframework.jdbc.datasource,4,,,,,,,,,4,,,,,,,,,,,,,,,,,,,,,,,,,,,
org.springframework.jdbc.object,9,,,,,,,,,,,,,,,,,,,,,,,,,9,,,,,,,,,,,
org.springframework.jndi,1,,,,,,,,,,,1,,,,,,,,,,,,,,,,,,,,,,,,,
org.springframework.ldap,47,,,,,,,,,,,33,14,,,,,,,,,,,,,,,,,,,,,,,,
org.springframework.security.web.savedrequest,,6,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,6,,
org.springframework.ui,,,32,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,32
org.springframework.util,,,139,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,87,52
org.springframework.validation,,,13,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,13,
org.springframework.web.client,13,3,,,,,,,,,,,,,,,13,,,,,,,,,,,,,,,,,,3,,
org.springframework.web.context.request,,8,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,8,,
org.springframework.web.multipart,,12,13,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,12,13,
org.springframework.web.reactive.function.client,2,,,,,,,,,,,,,,,,2,,,,,,,,,,,,,,,,,,,,
org.springframework.web.util,,,163,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,138,25
org.xml.sax,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,
org.xmlpull.v1,,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,,
play.mvc,,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,4,,
ratpack.core.form,,,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,
ratpack.core.handling,,6,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,6,4,
ratpack.core.http,,10,10,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,10,10,
ratpack.exec,,,48,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,48
ratpack.form,,,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,
ratpack.func,,,35,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,35
ratpack.handling,,6,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,6,4,
ratpack.http,,10,10,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,10,10,
ratpack.util,,,35,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,35
retrofit2,1,,,,,,,,,,,,,,,,1,,,,,,,,,,,,,,,,,,,,
package,sink,source,summary,sink:bean-validation,sink:create-file,sink:groovy,sink:header-splitting,sink:information-leak,sink:intent-start,sink:jdbc-url,sink:jexl,sink:jndi-injection,sink:ldap,sink:logging,sink:mvel,sink:ognl-injection,sink:open-url,sink:pending-intent-sent,sink:regex-use[-1],sink:regex-use[0],sink:regex-use[],sink:regex-use[f-1],sink:regex-use[f1],sink:regex-use[f],sink:set-hostname-verifier,sink:sql,sink:url-open-stream,sink:url-redirect,sink:write-file,sink:xpath,sink:xslt,sink:xss,source:android-external-storage-dir,source:android-widget,source:contentprovider,source:remote,summary:taint,summary:value
android.app,16,,103,,,,,,7,,,,,,,,,9,,,,,,,,,,,,,,,,,,,18,85
android.content,24,31,108,,,,,,16,,,,,,,,,,,,,,,,,8,,,,,,,4,,27,,31,77
android.database,59,,30,,,,,,,,,,,,,,,,,,,,,,,59,,,,,,,,,,,30,
android.net,,,60,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,45,15
android.os,,2,122,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,,,,41,81
android.util,6,16,,,,,,,,,,,,6,,,,,,,,,,,,,,,,,,,,,,16,,
android.webkit,3,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,,,,2,,
android.widget,,1,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,,,1,
androidx.slice,2,5,88,,,,,,,,,,,,,,,2,,,,,,,,,,,,,,,,,5,,27,61
cn.hutool.core.codec,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,
com.esotericsoftware.kryo.io,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,
com.esotericsoftware.kryo5.io,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,
com.fasterxml.jackson.core,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,
com.fasterxml.jackson.databind,,,6,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,6,
com.google.common.base,4,,85,,,,,,,,,,,,,,,,,3,1,,,,,,,,,,,,,,,,62,23
com.google.common.cache,,,17,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,17
com.google.common.collect,,,553,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,551
com.google.common.flogger,29,,,,,,,,,,,,,29,,,,,,,,,,,,,,,,,,,,,,,,
com.google.common.io,6,,73,,,,,,,,,,,,,,,,,,,,,,,,6,,,,,,,,,,72,1
com.opensymphony.xwork2.ognl,3,,,,,,,,,,,,,,,3,,,,,,,,,,,,,,,,,,,,,,
com.rabbitmq.client,,21,7,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,21,7,
com.unboundid.ldap.sdk,17,,,,,,,,,,,,17,,,,,,,,,,,,,,,,,,,,,,,,,
com.zaxxer.hikari,2,,,,,,,,,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,
flexjson,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1
groovy.lang,26,,,,,26,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
groovy.util,5,,,,,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
jakarta.faces.context,2,7,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,,,,7,,
jakarta.json,,,123,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,100,23
jakarta.ws.rs.client,1,,,,,,,,,,,,,,,,1,,,,,,,,,,,,,,,,,,,,,
jakarta.ws.rs.container,,9,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9,,
jakarta.ws.rs.core,2,,149,,,,,,,,,,,,,,,,,,,,,,,,,2,,,,,,,,,94,55
java.beans,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,
java.io,37,,39,,15,,,,,,,,,,,,,,,,,,,,,,,,22,,,,,,,,39,
java.lang,13,,58,,,,,,,,,,,8,,,,,4,,,1,,,,,,,,,,,,,,,46,12
java.net,10,3,7,,,,,,,,,,,,,,10,,,,,,,,,,,,,,,,,,,3,7,
java.nio,15,,6,,13,,,,,,,,,,,,,,,,,,,,,,,,2,,,,,,,,6,
java.sql,11,,,,,,,,,4,,,,,,,,,,,,,,,,7,,,,,,,,,,,,
java.util,44,,438,,,,,,,,,,,34,,,,,,5,2,,1,2,,,,,,,,,,,,,24,414
javax.faces.context,2,7,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,,,,7,,
javax.jms,,9,57,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9,57,
javax.json,,,123,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,100,23
javax.management.remote,2,,,,,,,,,,,2,,,,,,,,,,,,,,,,,,,,,,,,,,
javax.naming,7,,,,,,,,,,,6,1,,,,,,,,,,,,,,,,,,,,,,,,,
javax.net.ssl,2,,,,,,,,,,,,,,,,,,,,,,,,2,,,,,,,,,,,,,
javax.script,1,,,,,,,,,,,,,,1,,,,,,,,,,,,,,,,,,,,,,,
javax.servlet,4,21,2,,,,3,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,21,2,
javax.validation,1,1,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,,
javax.ws.rs.client,1,,,,,,,,,,,,,,,,1,,,,,,,,,,,,,,,,,,,,,
javax.ws.rs.container,,9,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9,,
javax.ws.rs.core,3,,149,,,,1,,,,,,,,,,,,,,,,,,,,,2,,,,,,,,,94,55
javax.xml.transform,1,,6,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,,,,,,6,
javax.xml.xpath,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,,,,,,,,
jodd.json,,,10,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,10
kotlin.jvm.internal,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1
net.sf.saxon.s9api,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,,,,,,,
ognl,6,,,,,,,,,,,,,,,6,,,,,,,,,,,,,,,,,,,,,,
okhttp3,2,,47,,,,,,,,,,,,,,2,,,,,,,,,,,,,,,,,,,,22,25
org.apache.commons.codec,,,6,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,6,
org.apache.commons.collections,,,800,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,17,783
org.apache.commons.collections4,,,800,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,17,783
org.apache.commons.io,104,,561,,89,,,,,,,,,,,,15,,,,,,,,,,,,,,,,,,,,547,14
org.apache.commons.jexl2,15,,,,,,,,,,15,,,,,,,,,,,,,,,,,,,,,,,,,,,
org.apache.commons.jexl3,15,,,,,,,,,,15,,,,,,,,,,,,,,,,,,,,,,,,,,,
org.apache.commons.lang3,,,424,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,293,131
org.apache.commons.logging,6,,,,,,,,,,,,,6,,,,,,,,,,,,,,,,,,,,,,,,
org.apache.commons.ognl,6,,,,,,,,,,,,,,,6,,,,,,,,,,,,,,,,,,,,,,
org.apache.commons.text,,,272,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,220,52
org.apache.directory.ldap.client.api,1,,,,,,,,,,,,1,,,,,,,,,,,,,,,,,,,,,,,,,
org.apache.hc.core5.function,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,
org.apache.hc.core5.http,1,2,39,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,,,,2,39,
org.apache.hc.core5.net,,,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,
org.apache.hc.core5.util,,,24,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,18,6
org.apache.http,27,3,70,,,,,,,,,,,,,,25,,,,,,,,,,,,,,,2,,,,3,62,8
org.apache.ibatis.jdbc,6,,57,,,,,,,,,,,,,,,,,,,,,,,6,,,,,,,,,,,57,
org.apache.log4j,11,,,,,,,,,,,,,11,,,,,,,,,,,,,,,,,,,,,,,,
org.apache.logging.log4j,359,,8,,,,,,,,,,,359,,,,,,,,,,,,,,,,,,,,,,,4,4
org.apache.shiro.codec,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,
org.apache.shiro.jndi,1,,,,,,,,,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,
org.codehaus.groovy.control,1,,,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
org.dom4j,20,,,,,,,,,,,,,,,,,,,,,,,,,,,,,20,,,,,,,,
org.hibernate,7,,,,,,,,,,,,,,,,,,,,,,,,,7,,,,,,,,,,,,
org.jboss.logging,324,,,,,,,,,,,,,324,,,,,,,,,,,,,,,,,,,,,,,,
org.jdbi.v3.core,6,,,,,,,,,6,,,,,,,,,,,,,,,,,,,,,,,,,,,,
org.jooq,1,,,,,,,,,,,,,,,,,,,,,,,,,1,,,,,,,,,,,,
org.json,,,236,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,198,38
org.mvel2,16,,,,,,,,,,,,,,16,,,,,,,,,,,,,,,,,,,,,,,
org.scijava.log,13,,,,,,,,,,,,,13,,,,,,,,,,,,,,,,,,,,,,,,
org.slf4j,55,,6,,,,,,,,,,,55,,,,,,,,,,,,,,,,,,,,,,,2,4
org.springframework.beans,,,30,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,30
org.springframework.boot.jdbc,1,,,,,,,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,
org.springframework.cache,,,13,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,13
org.springframework.context,,,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,
org.springframework.http,14,,70,,,,,,,,,,,,,,14,,,,,,,,,,,,,,,,,,,,60,10
org.springframework.jdbc.core,10,,,,,,,,,,,,,,,,,,,,,,,,,10,,,,,,,,,,,,
org.springframework.jdbc.datasource,4,,,,,,,,,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,
org.springframework.jdbc.object,9,,,,,,,,,,,,,,,,,,,,,,,,,9,,,,,,,,,,,,
org.springframework.jndi,1,,,,,,,,,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,
org.springframework.ldap,47,,,,,,,,,,,33,14,,,,,,,,,,,,,,,,,,,,,,,,,
org.springframework.security.web.savedrequest,,6,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,6,,
org.springframework.ui,,,32,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,32
org.springframework.util,,,139,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,87,52
org.springframework.validation,,,13,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,13,
org.springframework.web.client,13,3,,,,,,,,,,,,,,,13,,,,,,,,,,,,,,,,,,,3,,
org.springframework.web.context.request,,8,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,8,,
org.springframework.web.multipart,,12,13,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,12,13,
org.springframework.web.reactive.function.client,2,,,,,,,,,,,,,,,,2,,,,,,,,,,,,,,,,,,,,,
org.springframework.web.util,,,163,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,138,25
org.xml.sax,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,
org.xmlpull.v1,,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,,
play.mvc,,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,4,,
ratpack.core.form,,,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,
ratpack.core.handling,,6,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,6,4,
ratpack.core.http,,10,10,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,10,10,
ratpack.exec,,,48,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,48
ratpack.form,,,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,
ratpack.func,,,35,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,35
ratpack.handling,,6,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,6,4,
ratpack.http,,10,10,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,10,10,
ratpack.util,,,35,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,35
retrofit2,1,,,,,,,,,,,,,,,,1,,,,,,,,,,,,,,,,,,,,,
1 package sink source summary sink:bean-validation sink:create-file sink:groovy sink:header-splitting sink:information-leak sink:intent-start sink:jdbc-url sink:jexl sink:jndi-injection sink:ldap sink:logging sink:mvel sink:ognl-injection sink:open-url sink:pending-intent-sent sink:regex-use[-1] sink:regex-use[0] sink:regex-use[] sink:regex-use[f-1] sink:regex-use[f1] sink:regex-use[f] sink:set-hostname-verifier sink:sql sink:url-open-stream sink:url-redirect sink:write-file sink:xpath sink:xslt sink:xss source:android-external-storage-dir source:android-widget source:contentprovider source:remote summary:taint summary:value
2 android.app 16 103 7 9 18 85
3 android.content 24 27 31 108 16 8 4 27 31 77
4 android.database 59 30 59 30
5 android.net 60 45 15
6 android.os 2 122 2 41 81
7 android.util 6 16 6 16
8 android.webkit 3 2 3 2
9 android.widget 1 1 1 1
10 androidx.slice 2 5 88 2 5 27 61
11 cn.hutool.core.codec 1 1
12 com.esotericsoftware.kryo.io 1 1
13 com.esotericsoftware.kryo5.io 1 1
14 com.fasterxml.jackson.core 1 1
15 com.fasterxml.jackson.databind 6 6
16 com.google.common.base 4 85 3 1 62 23
17 com.google.common.cache 17 17
18 com.google.common.collect 553 2 551
19 com.google.common.flogger 29 29
20 com.google.common.io 6 73 6 72 1
21 com.opensymphony.xwork2.ognl 3 3
22 com.rabbitmq.client 21 7 21 7
23 com.unboundid.ldap.sdk 17 17
24 com.zaxxer.hikari 2 2
25 flexjson 1 1
26 groovy.lang 26 26
27 groovy.util 5 5
28 jakarta.faces.context 2 7 2 7
29 jakarta.json 123 100 23
30 jakarta.ws.rs.client 1 1
31 jakarta.ws.rs.container 9 9
32 jakarta.ws.rs.core 2 149 2 94 55
33 java.beans 1 1
34 java.io 37 39 15 22 39
35 java.lang 13 58 8 4 1 46 12
36 java.net 10 3 7 10 3 7
37 java.nio 15 6 13 2 6
38 java.sql 11 4 7
39 java.util 44 438 34 5 2 1 2 24 414
40 javax.faces.context 2 7 2 7
41 javax.jms 9 57 9 57
42 javax.json 123 100 23
43 javax.management.remote 2 2
44 javax.naming 7 6 1
45 javax.net.ssl 2 2
46 javax.script 1 1
47 javax.servlet 4 21 2 3 1 21 2
48 javax.validation 1 1 1 1
49 javax.ws.rs.client 1 1
50 javax.ws.rs.container 9 9
51 javax.ws.rs.core 3 149 1 2 94 55
52 javax.xml.transform 1 6 1 6
53 javax.xml.xpath 3 3
54 jodd.json 10 10
55 kotlin.jvm.internal 1 1
56 net.sf.saxon.s9api 5 5
57 ognl 6 6
58 okhttp3 2 47 2 22 25
59 org.apache.commons.codec 6 6
60 org.apache.commons.collections 800 17 783
61 org.apache.commons.collections4 800 17 783
62 org.apache.commons.io 104 561 89 15 547 14
63 org.apache.commons.jexl2 15 15
64 org.apache.commons.jexl3 15 15
65 org.apache.commons.lang3 424 293 131
66 org.apache.commons.logging 6 6
67 org.apache.commons.ognl 6 6
68 org.apache.commons.text 272 220 52
69 org.apache.directory.ldap.client.api 1 1
70 org.apache.hc.core5.function 1 1
71 org.apache.hc.core5.http 1 2 39 1 2 39
72 org.apache.hc.core5.net 2 2
73 org.apache.hc.core5.util 24 18 6
74 org.apache.http 27 3 70 25 2 3 62 8
75 org.apache.ibatis.jdbc 6 57 6 57
76 org.apache.log4j 11 11
77 org.apache.logging.log4j 359 8 359 4 4
78 org.apache.shiro.codec 1 1
79 org.apache.shiro.jndi 1 1
80 org.codehaus.groovy.control 1 1
81 org.dom4j 20 20
82 org.hibernate 7 7
83 org.jboss.logging 324 324
84 org.jdbi.v3.core 6 6
85 org.jooq 1 1
86 org.json 236 198 38
87 org.mvel2 16 16
88 org.scijava.log 13 13
89 org.slf4j 55 6 55 2 4
90 org.springframework.beans 30 30
91 org.springframework.boot.jdbc 1 1
92 org.springframework.cache 13 13
93 org.springframework.context 3 3
94 org.springframework.http 14 70 14 60 10
95 org.springframework.jdbc.core 10 10
96 org.springframework.jdbc.datasource 4 4
97 org.springframework.jdbc.object 9 9
98 org.springframework.jndi 1 1
99 org.springframework.ldap 47 33 14
100 org.springframework.security.web.savedrequest 6 6
101 org.springframework.ui 32 32
102 org.springframework.util 139 87 52
103 org.springframework.validation 13 13
104 org.springframework.web.client 13 3 13 3
105 org.springframework.web.context.request 8 8
106 org.springframework.web.multipart 12 13 12 13
107 org.springframework.web.reactive.function.client 2 2
108 org.springframework.web.util 163 138 25
109 org.xml.sax 1 1
110 org.xmlpull.v1 3 3
111 play.mvc 4 4
112 ratpack.core.form 3 3
113 ratpack.core.handling 6 4 6 4
114 ratpack.core.http 10 10 10 10
115 ratpack.exec 48 48
116 ratpack.form 3 3
117 ratpack.func 35 35
118 ratpack.handling 6 4 6 4
119 ratpack.http 10 10 10 10
120 ratpack.util 35 35
121 retrofit2 1 1

View File

@@ -7,7 +7,7 @@ Java framework & library support
:widths: auto
Framework / library,Package,Flow sources,Taint & value steps,Sinks (total),`CWE022` :sub:`Path injection`,`CWE036` :sub:`Path traversal`,`CWE079` :sub:`Cross-site scripting`,`CWE089` :sub:`SQL injection`,`CWE090` :sub:`LDAP injection`,`CWE094` :sub:`Code injection`,`CWE319` :sub:`Cleartext transmission`
Android,``android.*``,46,424,108,,,3,67,,,
Android,``android.*``,52,424,108,,,3,67,,,
`Apache Commons Collections <https://commons.apache.org/proper/commons-collections/>`_,"``org.apache.commons.collections``, ``org.apache.commons.collections4``",,1600,,,,,,,,
`Apache Commons IO <https://commons.apache.org/proper/commons-io/>`_,``org.apache.commons.io``,,561,104,89,,,,,,15
`Apache Commons Lang <https://commons.apache.org/proper/commons-lang/>`_,``org.apache.commons.lang3``,,424,,,,,,,,
@@ -19,5 +19,5 @@ Java framework & library support
Java extensions,"``javax.*``, ``jakarta.*``",63,609,32,,,4,,1,1,2
`Spring <https://spring.io/>`_,``org.springframework.*``,29,476,101,,,,19,14,,29
Others,"``androidx.slice``, ``cn.hutool.core.codec``, ``com.esotericsoftware.kryo.io``, ``com.esotericsoftware.kryo5.io``, ``com.fasterxml.jackson.core``, ``com.fasterxml.jackson.databind``, ``com.opensymphony.xwork2.ognl``, ``com.rabbitmq.client``, ``com.unboundid.ldap.sdk``, ``com.zaxxer.hikari``, ``flexjson``, ``groovy.lang``, ``groovy.util``, ``jodd.json``, ``kotlin.jvm.internal``, ``net.sf.saxon.s9api``, ``ognl``, ``okhttp3``, ``org.apache.commons.codec``, ``org.apache.commons.jexl2``, ``org.apache.commons.jexl3``, ``org.apache.commons.logging``, ``org.apache.commons.ognl``, ``org.apache.directory.ldap.client.api``, ``org.apache.ibatis.jdbc``, ``org.apache.log4j``, ``org.apache.logging.log4j``, ``org.apache.shiro.codec``, ``org.apache.shiro.jndi``, ``org.codehaus.groovy.control``, ``org.dom4j``, ``org.hibernate``, ``org.jboss.logging``, ``org.jdbi.v3.core``, ``org.jooq``, ``org.mvel2``, ``org.scijava.log``, ``org.slf4j``, ``org.xml.sax``, ``org.xmlpull.v1``, ``play.mvc``, ``ratpack.core.form``, ``ratpack.core.handling``, ``ratpack.core.http``, ``ratpack.exec``, ``ratpack.form``, ``ratpack.func``, ``ratpack.handling``, ``ratpack.http``, ``ratpack.util``, ``retrofit2``",65,395,932,,,,14,18,,3
Totals,,211,6410,1474,117,6,10,107,33,1,84
Totals,,217,6410,1474,117,6,10,107,33,1,84

View File

@@ -35,8 +35,8 @@ sourceSets {
"utils/versions/v_1_5_21/*.kt",
"utils/versions/v_1_5_31/*.kt",
"utils/versions/v_1_6_10/*.kt",
"utils/versions/v_1_7_0-RC/*.kt",
// "utils/versions/v_1_6_20/*.kt",
"utils/versions/v_1_6_20/*.kt",
// "utils/versions/v_1_7_0/*.kt",
]
}
}

View File

@@ -1,5 +1,5 @@
kotlin.code.style=official
kotlinVersion=1.6.20
kotlinVersion=1.7.0
GROUP=com.github.codeql
VERSION_NAME=0.0.1

View File

@@ -21,7 +21,7 @@ def version_string_to_tuple(version):
m = re.match(r'([0-9]+)\.([0-9]+)\.([0-9]+)(.*)', version)
return tuple([int(m.group(i)) for i in range(1, 4)] + [m.group(4)])
many_versions = [ '1.4.32', '1.5.0', '1.5.10', '1.5.21', '1.5.31', '1.6.10', '1.7.0-RC', '1.6.20' ]
many_versions = [ '1.4.32', '1.5.0', '1.5.10', '1.5.21', '1.5.31', '1.6.10', '1.6.20', '1.7.0' ]
many_versions_tuples = [version_string_to_tuple(v) for v in many_versions]

View File

@@ -6,9 +6,11 @@ import com.semmle.extractor.java.OdasaOutput
import com.semmle.util.data.StringDigestor
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.util.fqNameWhenAvailable
import org.jetbrains.kotlin.ir.util.isFileClass
import org.jetbrains.kotlin.ir.util.packageFqName
import org.jetbrains.kotlin.ir.util.parentClassOrNull
import org.jetbrains.kotlin.name.FqName
import java.io.File
import java.util.ArrayList
import java.util.HashSet
@@ -16,18 +18,20 @@ import java.util.zip.GZIPOutputStream
class ExternalDeclExtractor(val logger: FileLogger, val invocationTrapFile: String, val sourceFilePath: String, val primitiveTypeMapping: PrimitiveTypeMapping, val pluginContext: IrPluginContext, val globalExtensionState: KotlinExtractorGlobalState, val diagnosticTrapWriter: TrapWriter) {
val externalDeclsDone = HashSet<IrDeclaration>()
val declBinaryNames = HashMap<IrDeclaration, String>()
val externalDeclsDone = HashSet<Pair<String, String>>()
val externalDeclWorkList = ArrayList<Pair<IrDeclaration, String>>()
val propertySignature = ";property"
val fieldSignature = ";field"
fun extractLater(d: IrDeclaration, signature: String): Boolean {
fun extractLater(d: IrDeclarationWithName, signature: String): Boolean {
if (d !is IrClass && !isExternalFileClassMember(d)) {
logger.errorElement("External declaration is neither a class, nor a top-level declaration", d)
return false
}
val ret = externalDeclsDone.add(d)
val declBinaryName = declBinaryNames.getOrPut(d) { getIrDeclBinaryName(d) }
val ret = externalDeclsDone.add(Pair(declBinaryName, signature))
if (ret) externalDeclWorkList.add(Pair(d, signature))
return ret
}

View File

@@ -41,7 +41,7 @@ open class KotlinFileExtractor(
globalExtensionState: KotlinExtractorGlobalState
): KotlinUsesExtractor(logger, tw, dependencyCollector, externalClassExtractor, primitiveTypeMapping, pluginContext, globalExtensionState) {
inline fun <T> with(kind: String, element: IrElement, f: () -> T): T {
private inline fun <T> with(kind: String, element: IrElement, f: () -> T): T {
val name = when (element) {
is IrFile -> element.name
is IrDeclarationWithName -> element.name.asString()
@@ -86,6 +86,7 @@ open class KotlinFileExtractor(
}
}
@OptIn(ObsoleteDescriptorBasedAPI::class)
private fun isFake(d: IrDeclarationWithVisibility): Boolean {
val visibility = d.visibility
if (visibility is DelegatedDescriptorVisibility && visibility.delegate == Visibilities.InvisibleFake) {
@@ -94,6 +95,9 @@ open class KotlinFileExtractor(
if (d.isFakeOverride) {
return true
}
if ((d as? IrFunction)?.descriptor?.isHiddenToOvercomeSignatureClash == true) {
return true
}
return false
}
@@ -177,7 +181,7 @@ open class KotlinFileExtractor(
}
}
fun extractTypeParameter(tp: IrTypeParameter, apparentIndex: Int, javaTypeParameter: JavaTypeParameter?): Label<out DbTypevariable>? {
private fun extractTypeParameter(tp: IrTypeParameter, apparentIndex: Int, javaTypeParameter: JavaTypeParameter?): Label<out DbTypevariable>? {
with("type parameter", tp) {
val parentId = getTypeParameterParentLabel(tp) ?: return null
val id = tw.getLabelFor<DbTypevariable>(getTypeParameterLabel(tp))
@@ -212,7 +216,7 @@ open class KotlinFileExtractor(
}
}
fun extractVisibility(elementForLocation: IrElement, id: Label<out DbModifiable>, v: DescriptorVisibility) {
private fun extractVisibility(elementForLocation: IrElement, id: Label<out DbModifiable>, v: DescriptorVisibility) {
with("visibility", elementForLocation) {
when (v) {
DescriptorVisibilities.PRIVATE -> addModifiers(id, "private")
@@ -246,7 +250,7 @@ open class KotlinFileExtractor(
}
}
fun extractClassModifiers(c: IrClass, id: Label<out DbClassorinterface>) {
private fun extractClassModifiers(c: IrClass, id: Label<out DbClassorinterface>) {
with("class modifiers", c) {
when (c.modality) {
Modality.FINAL -> addModifiers(id, "final")
@@ -367,6 +371,27 @@ open class KotlinFileExtractor(
tw.writeHasLocation(stmtId, locId)
}
private fun extractObinitFunction(c: IrClass, parentId: Label<out DbClassorinterface>) {
// add method:
val obinitLabel = getObinitLabel(c)
val obinitId = tw.getLabelFor<DbMethod>(obinitLabel)
val returnType = useType(pluginContext.irBuiltIns.unitType, TypeContext.RETURN)
tw.writeMethods(obinitId, "<obinit>", "<obinit>()", returnType.javaResult.id, parentId, obinitId)
tw.writeMethodsKotlinType(obinitId, returnType.kotlinResult.id)
val locId = tw.getLocation(c)
tw.writeHasLocation(obinitId, locId)
addModifiers(obinitId, "private")
// add body:
val blockId = tw.getFreshIdLabel<DbBlock>()
tw.writeStmts_block(blockId, obinitId, 0, obinitId)
tw.writeHasLocation(blockId, locId)
extractDeclInitializers(c.declarations, false) { Pair(blockId, obinitId) }
}
fun extractClassSource(c: IrClass, extractDeclarations: Boolean, extractStaticInitializer: Boolean, extractPrivateMembers: Boolean, extractFunctionBodies: Boolean): Label<out DbClassorinterface> {
with("class source", c) {
DeclarationStackAdjuster(c).use {
@@ -421,6 +446,9 @@ open class KotlinFileExtractor(
addModifiers(instance.id, "public", "static", "final")
tw.writeClass_object(id.cast<DbClass>(), instance.id)
}
if (extractFunctionBodies && needsObinitFunction(c)) {
extractObinitFunction(c, id)
}
extractClassModifiers(c, id)
extractClassSupertypes(c, id, inReceiverContext = true) // inReceiverContext = true is specified to force extraction of member prototypes of base types
@@ -478,7 +506,7 @@ open class KotlinFileExtractor(
data class FieldResult(val id: Label<DbField>, val name: String)
fun useCompanionObjectClassInstance(c: IrClass): FieldResult? {
private fun useCompanionObjectClassInstance(c: IrClass): FieldResult? {
val parent = c.parent
if(!c.isCompanion) {
logger.error("Using companion instance for non-companion class")
@@ -496,7 +524,7 @@ open class KotlinFileExtractor(
}
}
fun useObjectClassInstance(c: IrClass): FieldResult {
private fun useObjectClassInstance(c: IrClass): FieldResult {
if(!c.isNonCompanionObject) {
logger.error("Using instance for non-object class")
}
@@ -567,6 +595,8 @@ open class KotlinFileExtractor(
tw.writeMethods(clinitId, "<clinit>", "<clinit>()", returnType.javaResult.id, parentId, clinitId)
tw.writeMethodsKotlinType(clinitId, returnType.kotlinResult.id)
tw.writeCompiler_generated(clinitId, CompilerGeneratedKinds.CLASS_INITIALISATION_METHOD.kind)
val locId = tw.getWholeFileLocation()
tw.writeHasLocation(clinitId, locId)
@@ -689,13 +719,13 @@ open class KotlinFileExtractor(
}
}
fun extractFunction(f: IrFunction, parentId: Label<out DbReftype>, extractBody: Boolean, extractMethodAndParameterTypeAccesses: Boolean, typeSubstitution: TypeSubstitution?, classTypeArgsIncludingOuterClasses: List<IrTypeArgument>?) =
private fun extractFunction(f: IrFunction, parentId: Label<out DbReftype>, extractBody: Boolean, extractMethodAndParameterTypeAccesses: Boolean, typeSubstitution: TypeSubstitution?, classTypeArgsIncludingOuterClasses: List<IrTypeArgument>?) =
if (isFake(f))
null
else
forceExtractFunction(f, parentId, extractBody, extractMethodAndParameterTypeAccesses, typeSubstitution, classTypeArgsIncludingOuterClasses, null, null)
fun forceExtractFunction(f: IrFunction, parentId: Label<out DbReftype>, extractBody: Boolean, extractMethodAndParameterTypeAccesses: Boolean, typeSubstitution: TypeSubstitution?, classTypeArgsIncludingOuterClasses: List<IrTypeArgument>?, idOverride: Label<DbMethod>?, locOverride: Label<DbLocation>?): Label<out DbCallable> {
private fun forceExtractFunction(f: IrFunction, parentId: Label<out DbReftype>, extractBody: Boolean, extractMethodAndParameterTypeAccesses: Boolean, typeSubstitution: TypeSubstitution?, classTypeArgsIncludingOuterClasses: List<IrTypeArgument>?, idOverride: Label<DbMethod>?, locOverride: Label<DbLocation>?): Label<out DbCallable> {
with("function", f) {
DeclarationStackAdjuster(f).use {
@@ -704,12 +734,9 @@ open class KotlinFileExtractor(
val id =
idOverride
?: if (f.isLocalFunction())
getLocallyVisibleFunctionLabels(f).function
else
// If this is a class that would ordinarily be replaced by a Java equivalent (e.g. kotlin.Map -> java.util.Map),
// don't replace here, really extract the Kotlin version:
useFunction<DbCallable>(f, parentId, classTypeArgsIncludingOuterClasses, noReplace = true)
?: // If this is a class that would ordinarily be replaced by a Java equivalent (e.g. kotlin.Map -> java.util.Map),
// don't replace here, really extract the Kotlin version:
useFunction<DbCallable>(f, parentId, classTypeArgsIncludingOuterClasses, noReplace = true)
val sourceDeclaration =
if (typeSubstitution != null && idOverride == null)
@@ -755,6 +782,14 @@ open class KotlinFileExtractor(
val methodId = id.cast<DbMethod>()
tw.writeMethods(methodId, shortName.nameInDB, "${shortName.nameInDB}$paramsSignature", returnType.javaResult.id, parentId, sourceDeclaration.cast<DbMethod>())
tw.writeMethodsKotlinType(methodId, returnType.kotlinResult.id)
when (f.origin) {
IrDeclarationOrigin.GENERATED_DATA_CLASS_MEMBER ->
tw.writeCompiler_generated(methodId, CompilerGeneratedKinds.GENERATED_DATA_CLASS_MEMBER.kind)
IrDeclarationOrigin.DEFAULT_PROPERTY_ACCESSOR ->
tw.writeCompiler_generated(methodId, CompilerGeneratedKinds.DEFAULT_PROPERTY_ACCESSOR.kind)
IrDeclarationOrigin.ENUM_CLASS_SPECIAL_MEMBER ->
tw.writeCompiler_generated(methodId, CompilerGeneratedKinds.ENUM_CLASS_SPECIAL_MEMBER.kind)
}
if (extractMethodAndParameterTypeAccesses) {
extractTypeAccessRecursive(substReturnType, locId, id, -1)
@@ -774,6 +809,9 @@ open class KotlinFileExtractor(
}
extractVisibility(f, id, f.visibility)
if (f.isInline) {
addModifiers(id, "inline")
}
if (isStaticFunction(f)) {
addModifiers(id, "static")
}
@@ -793,7 +831,7 @@ open class KotlinFileExtractor(
&& f.symbol !is IrConstructorSymbol // not a constructor
}
fun extractField(f: IrField, parentId: Label<out DbReftype>): Label<out DbField> {
private fun extractField(f: IrField, parentId: Label<out DbReftype>): Label<out DbField> {
with("field", f) {
DeclarationStackAdjuster(f).use {
declarationStack.push(f)
@@ -827,7 +865,7 @@ open class KotlinFileExtractor(
return id
}
fun extractProperty(p: IrProperty, parentId: Label<out DbReftype>, extractBackingField: Boolean, extractFunctionBodies: Boolean, typeSubstitution: TypeSubstitution?, classTypeArgsIncludingOuterClasses: List<IrTypeArgument>?) {
private fun extractProperty(p: IrProperty, parentId: Label<out DbReftype>, extractBackingField: Boolean, extractFunctionBodies: Boolean, typeSubstitution: TypeSubstitution?, classTypeArgsIncludingOuterClasses: List<IrTypeArgument>?) {
with("property", p) {
if (isFake(p)) return
@@ -846,6 +884,9 @@ open class KotlinFileExtractor(
val getterId = extractFunction(getter, parentId, extractBody = extractFunctionBodies, extractMethodAndParameterTypeAccesses = extractFunctionBodies, typeSubstitution, classTypeArgsIncludingOuterClasses)?.cast<DbMethod>()
if (getterId != null) {
tw.writeKtPropertyGetters(id, getterId)
if (getter.origin == IrDeclarationOrigin.DELEGATED_PROPERTY_ACCESSOR) {
tw.writeCompiler_generated(getterId, CompilerGeneratedKinds.DELEGATED_PROPERTY_GETTER.kind)
}
}
} else {
if (p.modality != Modality.FINAL || !isExternalDeclaration(p)) {
@@ -860,6 +901,9 @@ open class KotlinFileExtractor(
val setterId = extractFunction(setter, parentId, extractBody = extractFunctionBodies, extractMethodAndParameterTypeAccesses = extractFunctionBodies, typeSubstitution, classTypeArgsIncludingOuterClasses)?.cast<DbMethod>()
if (setterId != null) {
tw.writeKtPropertySetters(id, setterId)
if (setter.origin == IrDeclarationOrigin.DELEGATED_PROPERTY_ACCESSOR) {
tw.writeCompiler_generated(setterId, CompilerGeneratedKinds.DELEGATED_PROPERTY_SETTER.kind)
}
}
} else {
if (p.isVar && !isExternalDeclaration(p)) {
@@ -896,7 +940,7 @@ open class KotlinFileExtractor(
}
}
fun extractEnumEntry(ee: IrEnumEntry, parentId: Label<out DbReftype>, extractTypeAccess: Boolean) {
private fun extractEnumEntry(ee: IrEnumEntry, parentId: Label<out DbReftype>, extractTypeAccess: Boolean) {
with("enum entry", ee) {
DeclarationStackAdjuster(ee).use {
val id = useEnumEntry(ee)
@@ -918,7 +962,7 @@ open class KotlinFileExtractor(
}
}
fun extractTypeAlias(ta: IrTypeAlias) {
private fun extractTypeAlias(ta: IrTypeAlias) {
with("type alias", ta) {
if (ta.typeParameters.isNotEmpty()) {
// TODO: Extract this information
@@ -933,7 +977,7 @@ open class KotlinFileExtractor(
}
}
fun extractBody(b: IrBody, callable: Label<out DbCallable>) {
private fun extractBody(b: IrBody, callable: Label<out DbCallable>) {
with("body", b) {
when (b) {
is IrBlockBody -> extractBlockBody(b, callable)
@@ -946,7 +990,7 @@ open class KotlinFileExtractor(
}
}
fun extractBlockBody(b: IrBlockBody, callable: Label<out DbCallable>) {
private fun extractBlockBody(b: IrBlockBody, callable: Label<out DbCallable>) {
with("block body", b) {
val id = tw.getFreshIdLabel<DbBlock>()
val locId = tw.getLocation(b)
@@ -958,7 +1002,7 @@ open class KotlinFileExtractor(
}
}
fun extractSyntheticBody(b: IrSyntheticBody, callable: Label<out DbCallable>) {
private fun extractSyntheticBody(b: IrSyntheticBody, callable: Label<out DbCallable>) {
with("synthetic body", b) {
when (b.kind) {
IrSyntheticBodyKind.ENUM_VALUES -> tw.writeKtSyntheticBody(callable, 1)
@@ -967,7 +1011,7 @@ open class KotlinFileExtractor(
}
}
fun extractExpressionBody(b: IrExpressionBody, callable: Label<out DbCallable>) {
private fun extractExpressionBody(b: IrExpressionBody, callable: Label<out DbCallable>) {
with("expression body", b) {
val blockId = tw.getFreshIdLabel<DbBlock>()
val locId = tw.getLocation(b)
@@ -991,7 +1035,7 @@ open class KotlinFileExtractor(
return v
}
fun extractVariable(v: IrVariable, callable: Label<out DbCallable>, parent: Label<out DbStmtparent>, idx: Int) {
private fun extractVariable(v: IrVariable, callable: Label<out DbCallable>, parent: Label<out DbStmtparent>, idx: Int) {
with("variable", v) {
val stmtId = tw.getFreshIdLabel<DbLocalvariabledeclstmt>()
val locId = tw.getLocation(getVariableLocationProvider(v))
@@ -1001,7 +1045,7 @@ open class KotlinFileExtractor(
}
}
fun extractVariableExpr(v: IrVariable, callable: Label<out DbCallable>, parent: Label<out DbExprparent>, idx: Int, enclosingStmt: Label<out DbStmt>) {
private fun extractVariableExpr(v: IrVariable, callable: Label<out DbCallable>, parent: Label<out DbExprparent>, idx: Int, enclosingStmt: Label<out DbStmt>) {
with("variable expr", v) {
val varId = useVariable(v)
val exprId = tw.getFreshIdLabel<DbLocalvariabledeclexpr>()
@@ -1025,7 +1069,7 @@ open class KotlinFileExtractor(
}
}
fun extractStatement(s: IrStatement, callable: Label<out DbCallable>, parent: Label<out DbStmtparent>, idx: Int) {
private fun extractStatement(s: IrStatement, callable: Label<out DbCallable>, parent: Label<out DbStmtparent>, idx: Int) {
with("statement", s) {
when(s) {
is IrExpression -> {
@@ -1045,7 +1089,7 @@ open class KotlinFileExtractor(
tw.writeKtLocalFunction(ids.function)
if (s.origin == IrDeclarationOrigin.ADAPTER_FOR_CALLABLE_REFERENCE) {
tw.writeCompiler_generated(classId, 1)
tw.writeCompiler_generated(classId, CompilerGeneratedKinds.DECLARING_CLASSES_OF_ADAPTER_FUNCTIONS.kind)
}
} else {
logger.errorElement("Expected to find local function", s)
@@ -1364,7 +1408,7 @@ open class KotlinFileExtractor(
}
}
fun findFunction(cls: IrClass, name: String): IrFunction? = cls.declarations.find { it is IrFunction && it.name.asString() == name } as IrFunction?
private fun findFunction(cls: IrClass, name: String): IrFunction? = cls.declarations.find { it is IrFunction && it.name.asString() == name } as IrFunction?
val jvmIntrinsicsClass by lazy {
val result = pluginContext.referenceClass(FqName("kotlin.jvm.internal.Intrinsics"))?.owner
@@ -1372,7 +1416,7 @@ open class KotlinFileExtractor(
result
}
fun findJdkIntrinsicOrWarn(name: String, warnAgainstElement: IrElement): IrFunction? {
private fun findJdkIntrinsicOrWarn(name: String, warnAgainstElement: IrElement): IrFunction? {
val result = jvmIntrinsicsClass?.let { findFunction(it, name) }
if(result == null) {
logger.errorElement("Couldn't find JVM intrinsic function $name", warnAgainstElement)
@@ -1466,7 +1510,7 @@ open class KotlinFileExtractor(
result
}
fun isFunction(target: IrFunction, pkgName: String, classNameLogged: String, classNamePredicate: (String) -> Boolean, fName: String, hasQuestionMark: Boolean? = false): Boolean {
private fun isFunction(target: IrFunction, pkgName: String, classNameLogged: String, classNamePredicate: (String) -> Boolean, fName: String, hasQuestionMark: Boolean? = false): Boolean {
val verbose = false
fun verboseln(s: String) { if(verbose) println(s) }
verboseln("Attempting match for $pkgName $classNameLogged $fName")
@@ -1510,10 +1554,10 @@ open class KotlinFileExtractor(
return true
}
fun isFunction(target: IrFunction, pkgName: String, className: String, fName: String, hasQuestionMark: Boolean? = false) =
private fun isFunction(target: IrFunction, pkgName: String, className: String, fName: String, hasQuestionMark: Boolean? = false) =
isFunction(target, pkgName, className, { it == className }, fName, hasQuestionMark)
fun isNumericFunction(target: IrFunction, fName: String): Boolean {
private fun isNumericFunction(target: IrFunction, fName: String): Boolean {
return isFunction(target, "kotlin", "Int", fName) ||
isFunction(target, "kotlin", "Byte", fName) ||
isFunction(target, "kotlin", "Short", fName) ||
@@ -1522,7 +1566,7 @@ open class KotlinFileExtractor(
isFunction(target, "kotlin", "Double", fName)
}
fun isArrayType(typeName: String) =
private fun isArrayType(typeName: String) =
when(typeName) {
"Array" -> true
"IntArray" -> true
@@ -1536,7 +1580,7 @@ open class KotlinFileExtractor(
else -> false
}
fun extractCall(c: IrCall, callable: Label<out DbCallable>, stmtExprParent: StmtExprParent) {
private fun extractCall(c: IrCall, callable: Label<out DbCallable>, stmtExprParent: StmtExprParent) {
with("call", c) {
val target = tryReplaceSyntheticFunction(c.symbol.owner)
@@ -2101,6 +2145,22 @@ open class KotlinFileExtractor(
enclosingStmt: Label<out DbStmt>
): Label<DbNewexpr> = extractNewExpr(useFunction<DbConstructor>(calledConstructor, constructorTypeArgs), constructedType, locId, parent, idx, callable, enclosingStmt)
private fun needsObinitFunction(c: IrClass) = c.primaryConstructor == null && c.constructors.count() > 1
private fun getObinitLabel(c: IrClass) = getFunctionLabel(
c,
null,
"<obinit>",
listOf(),
pluginContext.irBuiltIns.unitType,
null,
functionTypeParameters = listOf(),
classTypeArgsIncludingOuterClasses = listOf(),
overridesCollectionsMethod = false,
javaSignature = null,
addParameterWildcardsByDefault = false
)
private fun extractConstructorCall(
e: IrFunctionAccessExpression,
parent: Label<out DbExprparent>,
@@ -2153,8 +2213,6 @@ open class KotlinFileExtractor(
}
}
private val loopIdMap: MutableMap<IrLoop, Label<out DbKtloopstmt>> = mutableMapOf()
// todo: calculating the enclosing ref type could be done through this, instead of walking up the declaration parent chain
private val declarationStack: Stack<IrDeclaration> = Stack()
@@ -2192,7 +2250,7 @@ open class KotlinFileExtractor(
}
}
fun getStatementOriginOperator(origin: IrStatementOrigin?) = when (origin) {
private fun getStatementOriginOperator(origin: IrStatementOrigin?) = when (origin) {
IrStatementOrigin.PLUSEQ -> "plus"
IrStatementOrigin.MINUSEQ -> "minus"
IrStatementOrigin.MULTEQ -> "times"
@@ -2201,7 +2259,7 @@ open class KotlinFileExtractor(
else -> null
}
fun getUpdateInPlaceRHS(origin: IrStatementOrigin?, isExpectedLhs: (IrExpression?) -> Boolean, updateRhs: IrExpression): IrExpression? {
private fun getUpdateInPlaceRHS(origin: IrStatementOrigin?, isExpectedLhs: (IrExpression?) -> Boolean, updateRhs: IrExpression): IrExpression? {
// Check for a desugared in-place update operator, such as "v += e":
return getStatementOriginOperator(origin)?.let {
if (updateRhs is IrCall &&
@@ -2216,7 +2274,7 @@ open class KotlinFileExtractor(
}
}
fun writeUpdateInPlaceExpr(origin: IrStatementOrigin, tw: TrapWriter, id: Label<DbAssignexpr>, type: TypeResults, exprParent: ExprParent): Boolean {
private fun writeUpdateInPlaceExpr(origin: IrStatementOrigin, tw: TrapWriter, id: Label<DbAssignexpr>, type: TypeResults, exprParent: ExprParent): Boolean {
when(origin) {
IrStatementOrigin.PLUSEQ -> tw.writeExprs_assignaddexpr(id.cast<DbAssignaddexpr>(), type.javaResult.id, exprParent.parent, exprParent.idx)
IrStatementOrigin.MINUSEQ -> tw.writeExprs_assignsubexpr(id.cast<DbAssignsubexpr>(), type.javaResult.id, exprParent.parent, exprParent.idx)
@@ -2228,7 +2286,7 @@ open class KotlinFileExtractor(
return true
}
fun tryExtractArrayUpdate(e: IrContainerExpression, callable: Label<out DbCallable>, parent: StmtExprParent): Boolean {
private fun tryExtractArrayUpdate(e: IrContainerExpression, callable: Label<out DbCallable>, parent: StmtExprParent): Boolean {
/*
* We're expecting the pattern
* {
@@ -2299,7 +2357,7 @@ open class KotlinFileExtractor(
return false
}
fun extractExpressionStmt(e: IrExpression, callable: Label<out DbCallable>, parent: Label<out DbStmtparent>, idx: Int) {
private fun extractExpressionStmt(e: IrExpression, callable: Label<out DbCallable>, parent: Label<out DbStmtparent>, idx: Int) {
extractExpression(e, callable, StmtParent(parent, idx))
}
@@ -2307,7 +2365,7 @@ open class KotlinFileExtractor(
extractExpression(e, callable, ExprParent(parent, idx, enclosingStmt))
}
fun extractExpression(e: IrExpression, callable: Label<out DbCallable>, parent: StmtExprParent) {
private fun extractExpression(e: IrExpression, callable: Label<out DbCallable>, parent: StmtExprParent) {
with("expression", e) {
when(e) {
is IrDelegatingConstructorCall -> {
@@ -2402,41 +2460,35 @@ open class KotlinFileExtractor(
}
}
is IrWhileLoop -> {
val stmtParent = parent.stmt(e, callable)
val id = tw.getFreshIdLabel<DbWhilestmt>()
loopIdMap[e] = id
val locId = tw.getLocation(e)
tw.writeStmts_whilestmt(id, stmtParent.parent, stmtParent.idx, callable)
tw.writeHasLocation(id, locId)
extractExpressionExpr(e.condition, callable, id, 0, id)
val body = e.body
if(body != null) {
extractExpressionStmt(body, callable, id, 1)
}
loopIdMap.remove(e)
extractLoop(e, parent, callable)
}
is IrDoWhileLoop -> {
val stmtParent = parent.stmt(e, callable)
val id = tw.getFreshIdLabel<DbDostmt>()
loopIdMap[e] = id
val locId = tw.getLocation(e)
tw.writeStmts_dostmt(id, stmtParent.parent, stmtParent.idx, callable)
tw.writeHasLocation(id, locId)
extractExpressionExpr(e.condition, callable, id, 0, id)
val body = e.body
if(body != null) {
extractExpressionStmt(body, callable, id, 1)
}
loopIdMap.remove(e)
extractLoop(e, parent, callable)
}
is IrInstanceInitializerCall -> {
val stmtParent = parent.stmt(e, callable)
val irConstructor = declarationStack.peek() as? IrConstructor
if (irConstructor == null) {
logger.errorElement("IrInstanceInitializerCall outside constructor", e)
return
}
extractInstanceInitializerBlock(stmtParent, irConstructor)
if (needsObinitFunction(irConstructor.parentAsClass)) {
val exprParent = parent.expr(e, callable)
val id = tw.getFreshIdLabel<DbMethodaccess>()
val type = useType(pluginContext.irBuiltIns.unitType)
val locId = tw.getLocation(e)
val methodLabel = getObinitLabel(irConstructor.parentAsClass)
val methodId = tw.getLabelFor<DbMethod>(methodLabel)
tw.writeExprs_methodaccess(id, type.javaResult.id, exprParent.parent, exprParent.idx)
tw.writeExprsKotlinType(id, type.kotlinResult.id)
tw.writeHasLocation(id, locId)
tw.writeCallableEnclosingExpr(id, callable)
tw.writeStatementEnclosingExpr(id, exprParent.enclosingStmt)
tw.writeCallableBinding(id, methodId)
}
else {
val stmtParent = parent.stmt(e, callable)
extractInstanceInitializerBlock(stmtParent, irConstructor)
}
}
is IrConstructorCall -> {
val exprParent = parent.expr(e, callable)
@@ -2928,6 +2980,49 @@ open class KotlinFileExtractor(
}
}
private fun extractLoop(
loop: IrLoop,
stmtExprParent: StmtExprParent,
callable: Label<out DbCallable>
) {
val stmtParent = stmtExprParent.stmt(loop, callable)
val locId = tw.getLocation(loop)
val idx: Int
val parent: Label<out DbStmtparent>
val label = loop.label
if (label != null) {
val labeledStmt = tw.getFreshIdLabel<DbLabeledstmt>()
tw.writeStmts_labeledstmt(labeledStmt, stmtParent.parent, stmtParent.idx, callable)
tw.writeHasLocation(labeledStmt, locId)
tw.writeNamestrings(label, "", labeledStmt)
idx = 0
parent = labeledStmt
} else {
idx = stmtParent.idx
parent = stmtParent.parent
}
val id = if (loop is IrWhileLoop) {
val id = tw.getFreshIdLabel<DbWhilestmt>()
tw.writeStmts_whilestmt(id, parent, idx, callable)
id
} else {
val id = tw.getFreshIdLabel<DbDostmt>()
tw.writeStmts_dostmt(id, parent, idx, callable)
id
}
tw.writeHasLocation(id, locId)
extractExpressionExpr(loop.condition, callable, id, 0, id)
val body = loop.body
if (body != null) {
extractExpressionStmt(body, callable, id, 1)
}
}
private fun IrValueParameter.isExtensionReceiver(): Boolean {
val parentFun = parent as? IrFunction ?: return false
return parentFun.extensionReceiverParameter == this
@@ -3733,7 +3828,7 @@ open class KotlinFileExtractor(
}
}
fun extractVarargElement(e: IrVarargElement, callable: Label<out DbCallable>, parent: Label<out DbExprparent>, idx: Int, enclosingStmt: Label<out DbStmt>) {
private fun extractVarargElement(e: IrVarargElement, callable: Label<out DbCallable>, parent: Label<out DbExprparent>, idx: Int, enclosingStmt: Label<out DbStmt>) {
with("vararg element", e) {
val argExpr = when(e) {
is IrExpression -> e
@@ -3925,7 +4020,7 @@ open class KotlinFileExtractor(
return initId
}
fun extractTypeOperatorCall(e: IrTypeOperatorCall, callable: Label<out DbCallable>, parent: Label<out DbExprparent>, idx: Int, enclosingStmt: Label<out DbStmt>) {
private fun extractTypeOperatorCall(e: IrTypeOperatorCall, callable: Label<out DbCallable>, parent: Label<out DbExprparent>, idx: Int, enclosingStmt: Label<out DbStmt>) {
with("type operator call", e) {
when(e.operator) {
IrTypeOperator.CAST -> {
@@ -4201,7 +4296,7 @@ open class KotlinFileExtractor(
private fun extractBreakContinue(
e: IrBreakContinue,
id: Label<out DbBreakcontinuestmt>
id: Label<out DbNamedexprorstmt>
) {
with("break/continue", e) {
val locId = tw.getLocation(e)
@@ -4210,14 +4305,6 @@ open class KotlinFileExtractor(
if (label != null) {
tw.writeNamestrings(label, "", id)
}
val loopId = loopIdMap[e.loop]
if (loopId == null) {
logger.errorElement("Missing break/continue target", e)
return
}
tw.writeKtBreakContinueTargets(id, loopId)
}
}
@@ -4299,4 +4386,14 @@ open class KotlinFileExtractor(
declarationStack.pop()
}
}
private enum class CompilerGeneratedKinds(val kind: Int) {
DECLARING_CLASSES_OF_ADAPTER_FUNCTIONS(1),
GENERATED_DATA_CLASS_MEMBER(2),
DEFAULT_PROPERTY_ACCESSOR(3),
CLASS_INITIALISATION_METHOD(4),
ENUM_CLASS_SPECIAL_MEMBER(5),
DELEGATED_PROPERTY_GETTER(6),
DELEGATED_PROPERTY_SETTER(7),
}
}

View File

@@ -49,7 +49,7 @@ open class KotlinUsesExtractor(
javaLangObject?.typeWith()
}
fun usePackage(pkg: String): Label<out DbPackage> {
private fun usePackage(pkg: String): Label<out DbPackage> {
return extractPackage(pkg)
}
@@ -154,12 +154,12 @@ open class KotlinUsesExtractor(
} ?: argsIncludingOuterClasses
}
fun isStaticClass(c: IrClass) = c.visibility != DescriptorVisibilities.LOCAL && !c.isInner
private fun isStaticClass(c: IrClass) = c.visibility != DescriptorVisibilities.LOCAL && !c.isInner
// Gets nested inner classes starting at `c` and proceeding outwards to the innermost enclosing static class.
// For example, for (java syntax) `class A { static class B { class C { class D { } } } }`,
// `nonStaticParentsWithSelf(D)` = `[D, C, B]`.
fun parentsWithTypeParametersInScope(c: IrClass): List<IrDeclarationParent> {
private fun parentsWithTypeParametersInScope(c: IrClass): List<IrDeclarationParent> {
val parentsList = c.parentsWithSelf.toList()
val firstOuterClassIdx = parentsList.indexOfFirst { it is IrClass && isStaticClass(it) }
return if (firstOuterClassIdx == -1) parentsList else parentsList.subList(0, firstOuterClassIdx + 1)
@@ -168,14 +168,14 @@ open class KotlinUsesExtractor(
// Gets the type parameter symbols that are in scope for class `c` in Kotlin order (i.e. for
// `class NotInScope<T> { static class OutermostInScope<A, B> { class QueryClass<C, D> { } } }`,
// `getTypeParametersInScope(QueryClass)` = `[C, D, A, B]`.
fun getTypeParametersInScope(c: IrClass) =
private fun getTypeParametersInScope(c: IrClass) =
parentsWithTypeParametersInScope(c).mapNotNull({ getTypeParameters(it) }).flatten()
// Returns a map from `c`'s type variables in scope to type arguments `argsIncludingOuterClasses`.
// Hack for the time being: the substituted types are always nullable, to prevent downstream code
// from replacing a generic parameter by a primitive. As and when we extract Kotlin types we will
// need to track this information in more detail.
fun makeTypeGenericSubstitutionMap(c: IrClass, argsIncludingOuterClasses: List<IrTypeArgument>) =
private fun makeTypeGenericSubstitutionMap(c: IrClass, argsIncludingOuterClasses: List<IrTypeArgument>) =
getTypeParametersInScope(c).map({ it.symbol }).zip(argsIncludingOuterClasses.map { it.withQuestionMark(true) }).toMap()
fun makeGenericSubstitutionFunction(c: IrClass, argsIncludingOuterClasses: List<IrTypeArgument>) =
@@ -190,7 +190,7 @@ open class KotlinUsesExtractor(
}
// The Kotlin compiler internal representation of Outer<A, B>.Inner<C, D>.InnerInner<E, F>.someFunction<G, H>.LocalClass<I, J> is LocalClass<I, J, G, H, E, F, C, D, A, B>. This function returns [A, B, C, D, E, F, G, H, I, J].
fun orderTypeArgsLeftToRight(c: IrClass, argsIncludingOuterClasses: List<IrTypeArgument>?): List<IrTypeArgument>? {
private fun orderTypeArgsLeftToRight(c: IrClass, argsIncludingOuterClasses: List<IrTypeArgument>?): List<IrTypeArgument>? {
if(argsIncludingOuterClasses.isNullOrEmpty())
return argsIncludingOuterClasses
val ret = ArrayList<IrTypeArgument>()
@@ -237,15 +237,15 @@ open class KotlinUsesExtractor(
return UseClassInstanceResult(classTypeResult, extractClass)
}
fun isArray(t: IrSimpleType) = t.isBoxedArray || t.isPrimitiveArray()
private fun isArray(t: IrSimpleType) = t.isBoxedArray || t.isPrimitiveArray()
fun extractClassLaterIfExternal(c: IrClass) {
private fun extractClassLaterIfExternal(c: IrClass) {
if (isExternalDeclaration(c)) {
extractExternalClassLater(c)
}
}
fun extractExternalEnclosingClassLater(d: IrDeclaration) {
private fun extractExternalEnclosingClassLater(d: IrDeclaration) {
when (val parent = d.parent) {
is IrClass -> extractExternalClassLater(parent)
is IrFunction -> extractExternalEnclosingClassLater(parent)
@@ -254,7 +254,7 @@ open class KotlinUsesExtractor(
}
}
fun extractPropertyLaterIfExternalFileMember(p: IrProperty) {
private fun extractPropertyLaterIfExternalFileMember(p: IrProperty) {
if (isExternalFileClassMember(p)) {
extractExternalClassLater(p.parentAsClass)
dependencyCollector?.addDependency(p, externalClassExtractor.propertySignature)
@@ -262,7 +262,7 @@ open class KotlinUsesExtractor(
}
}
fun extractFieldLaterIfExternalFileMember(f: IrField) {
private fun extractFieldLaterIfExternalFileMember(f: IrField) {
if (isExternalFileClassMember(f)) {
extractExternalClassLater(f.parentAsClass)
dependencyCollector?.addDependency(f, externalClassExtractor.fieldSignature)
@@ -270,7 +270,7 @@ open class KotlinUsesExtractor(
}
}
fun extractFunctionLaterIfExternalFileMember(f: IrFunction) {
private fun extractFunctionLaterIfExternalFileMember(f: IrFunction) {
if (isExternalFileClassMember(f)) {
extractExternalClassLater(f.parentAsClass)
(f as? IrSimpleFunction)?.correspondingPropertySymbol?.let {
@@ -301,7 +301,7 @@ open class KotlinUsesExtractor(
externalClassExtractor.extractLater(c)
}
fun tryReplaceAndroidSyntheticClass(c: IrClass): IrClass {
private fun tryReplaceAndroidSyntheticClass(c: IrClass): IrClass {
// The Android Kotlin Extensions Gradle plugin introduces synthetic functions, fields and classes. The most
// obvious signature is that they lack any supertype information even though they are not root classes.
// If possible, replace them by a real version of the same class.
@@ -503,7 +503,7 @@ open class KotlinUsesExtractor(
// but returns boxed arrays with a nullable, invariant component type, with any nested arrays
// similarly transformed. For example, Array<out Array<in E>> would become Array<Array<E?>?>
// Array<*> will become Array<Any?>.
fun getInvariantNullableArrayType(arrayType: IrSimpleType): IrSimpleType =
private fun getInvariantNullableArrayType(arrayType: IrSimpleType): IrSimpleType =
if (arrayType.isPrimitiveArray())
arrayType
else {
@@ -528,7 +528,7 @@ open class KotlinUsesExtractor(
)
}
fun useArrayType(arrayType: IrSimpleType, componentType: IrType, elementType: IrType, dimensions: Int, isPrimitiveArray: Boolean): TypeResults {
private fun useArrayType(arrayType: IrSimpleType, componentType: IrType, elementType: IrType, dimensions: Int, isPrimitiveArray: Boolean): TypeResults {
// Ensure we extract Array<Int> as Integer[], not int[], for example:
fun nullableIfNotPrimitive(type: IrType) = if (type.isPrimitiveType() && !isPrimitiveArray) type.makeNullable() else type
@@ -579,7 +579,7 @@ open class KotlinUsesExtractor(
RETURN, GENERIC_ARGUMENT, OTHER
}
fun useSimpleType(s: IrSimpleType, context: TypeContext): TypeResults {
private fun useSimpleType(s: IrSimpleType, context: TypeContext): TypeResults {
if (s.abbreviation != null) {
// TODO: Extract this information
}
@@ -810,14 +810,14 @@ open class KotlinUsesExtractor(
return if (f is IrConstructor) f.typeParameters else f.typeParameters.filter { it.parent == f }
}
fun getTypeParameters(dp: IrDeclarationParent): List<IrTypeParameter> =
private fun getTypeParameters(dp: IrDeclarationParent): List<IrTypeParameter> =
when(dp) {
is IrClass -> dp.typeParameters
is IrFunction -> getFunctionTypeParameters(dp)
else -> listOf()
}
fun getEnclosingClass(it: IrDeclarationParent): IrClass? =
private fun getEnclosingClass(it: IrDeclarationParent): IrClass? =
when(it) {
is IrClass -> it
is IrFunction -> getEnclosingClass(it.parent)
@@ -924,7 +924,7 @@ open class KotlinUsesExtractor(
null
} ?: t
fun getJavaTypeArgument(jt: JavaType, idx: Int) =
private fun getJavaTypeArgument(jt: JavaType, idx: Int) =
when(jt) {
is JavaClassifierType -> jt.typeArguments.getOrNull(idx)
is JavaArrayType -> if (idx == 0) jt.componentType else null
@@ -970,7 +970,7 @@ open class KotlinUsesExtractor(
* allow it to be passed in.
*/
@OptIn(ObsoleteDescriptorBasedAPI::class)
fun getFunctionLabel(f: IrFunction, maybeParentId: Label<out DbElement>?, classTypeArgsIncludingOuterClasses: List<IrTypeArgument>?) =
private fun getFunctionLabel(f: IrFunction, maybeParentId: Label<out DbElement>?, classTypeArgsIncludingOuterClasses: List<IrTypeArgument>?) =
getFunctionLabel(
f.parent,
maybeParentId,
@@ -1146,15 +1146,6 @@ open class KotlinUsesExtractor(
return res
}
fun <T: DbCallable> useFunctionCommon(f: IrFunction, label: String): Label<out T> {
val id: Label<T> = tw.getLabelFor(label)
if (isExternalDeclaration(f)) {
extractFunctionLaterIfExternalFileMember(f)
extractExternalEnclosingClassLater(f)
}
return id
}
// These are classes with Java equivalents, but whose methods don't all exist on those Java equivalents--
// for example, the numeric classes define arithmetic functions (Int.plus, Long.or and so on) that lower to
// primitive arithmetic on the JVM, but which we extract as calls to reflect the source syntax more closely.
@@ -1162,7 +1153,7 @@ open class KotlinUsesExtractor(
"kotlin.Boolean", "kotlin.Byte", "kotlin.Char", "kotlin.Double", "kotlin.Float", "kotlin.Int", "kotlin.Long", "kotlin.Number", "kotlin.Short"
)
fun kotlinFunctionToJavaEquivalent(f: IrFunction, noReplace: Boolean) =
private fun kotlinFunctionToJavaEquivalent(f: IrFunction, noReplace: Boolean) =
if (noReplace)
f
else
@@ -1210,20 +1201,24 @@ open class KotlinUsesExtractor(
} as IrFunction? ?: f
fun <T: DbCallable> useFunction(f: IrFunction, classTypeArgsIncludingOuterClasses: List<IrTypeArgument>? = null, noReplace: Boolean = false): Label<out T> {
return useFunction(f, null, classTypeArgsIncludingOuterClasses, noReplace)
}
fun <T: DbCallable> useFunction(f: IrFunction, parentId: Label<out DbElement>?, classTypeArgsIncludingOuterClasses: List<IrTypeArgument>?, noReplace: Boolean = false): Label<out T> {
if (f.isLocalFunction()) {
val ids = getLocallyVisibleFunctionLabels(f)
return ids.function.cast<T>()
} else {
val realFunction = kotlinFunctionToJavaEquivalent(f, noReplace)
return useFunctionCommon<T>(realFunction, getFunctionLabel(realFunction, classTypeArgsIncludingOuterClasses))
}
val javaFun = kotlinFunctionToJavaEquivalent(f, noReplace)
val label = getFunctionLabel(javaFun, parentId, classTypeArgsIncludingOuterClasses)
val id: Label<T> = tw.getLabelFor(label)
if (isExternalDeclaration(javaFun)) {
extractFunctionLaterIfExternalFileMember(javaFun)
extractExternalEnclosingClassLater(javaFun)
}
return id
}
fun <T: DbCallable> useFunction(f: IrFunction, parentId: Label<out DbElement>, classTypeArgsIncludingOuterClasses: List<IrTypeArgument>?, noReplace: Boolean = false) =
kotlinFunctionToJavaEquivalent(f, noReplace).let {
useFunctionCommon<T>(it, getFunctionLabel(it, parentId, classTypeArgsIncludingOuterClasses))
}
fun getTypeArgumentLabel(
arg: IrTypeArgument
): TypeResult<DbReftype> {
@@ -1351,14 +1346,14 @@ open class KotlinUsesExtractor(
return "@\"typevar;{$parentLabel};${param.name}\""
}
fun useTypeParameter(param: IrTypeParameter) =
private fun useTypeParameter(param: IrTypeParameter) =
TypeResult(
tw.getLabelFor<DbTypevariable>(getTypeParameterLabel(param)),
useType(eraseTypeParameter(param)).javaResult.signature,
param.name.asString()
)
fun extractModifier(m: String): Label<DbModifier> {
private fun extractModifier(m: String): Label<DbModifier> {
val modifierLabel = "@\"modifier;$m\""
val id: Label<DbModifier> = tw.getLabelFor(modifierLabel, {
tw.writeModifiers(it, m)
@@ -1440,7 +1435,7 @@ open class KotlinUsesExtractor(
* Note that `Array<T>` is retained (with `T` itself erased) because these are expected to be lowered to Java
* arrays, which are not generic.
*/
fun erase (t: IrType): IrType {
private fun erase (t: IrType): IrType {
if (t is IrSimpleType) {
val classifier = t.classifier
val owner = classifier.owner
@@ -1464,7 +1459,7 @@ open class KotlinUsesExtractor(
return t
}
fun eraseTypeParameter(t: IrTypeParameter) =
private fun eraseTypeParameter(t: IrTypeParameter) =
erase(t.superTypes[0])
/**
@@ -1493,7 +1488,7 @@ open class KotlinUsesExtractor(
fun useValueParameter(vp: IrValueParameter, parent: Label<out DbCallable>?): Label<out DbParam> =
tw.getLabelFor(getValueParameterLabel(vp, parent))
fun isDirectlyExposedCompanionObjectField(f: IrField) =
private fun isDirectlyExposedCompanionObjectField(f: IrField) =
f.hasAnnotation(FqName("kotlin.jvm.JvmField")) ||
f.correspondingPropertySymbol?.owner?.let {
it.isConst || it.isLateinit

View File

@@ -1,14 +1,21 @@
package com.github.codeql
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
import org.jetbrains.kotlin.builtins.StandardNames
import org.jetbrains.kotlin.ir.declarations.IrClass
import org.jetbrains.kotlin.ir.declarations.IrPackageFragment
import org.jetbrains.kotlin.ir.types.IrSimpleType
import org.jetbrains.kotlin.ir.types.IdSignatureValues
import org.jetbrains.kotlin.ir.util.IdSignature
import org.jetbrains.kotlin.ir.types.classOrNull
import org.jetbrains.kotlin.name.FqName
class PrimitiveTypeMapping(val logger: Logger, val pluginContext: IrPluginContext) {
fun getPrimitiveInfo(s: IrSimpleType) = mapping[s.classifier.signature]
fun getPrimitiveInfo(s: IrSimpleType) =
s.classOrNull?.let {
if ((it.owner.parent as? IrPackageFragment)?.fqName == StandardNames.BUILT_INS_PACKAGE_FQ_NAME)
mapping[it.owner.name]
else
null
}
data class PrimitiveTypeInfo(
val primitiveName: String?,
@@ -60,25 +67,25 @@ class PrimitiveTypeMapping(val logger: Logger, val pluginContext: IrPluginContex
val javaLangVoid = findClass("java.lang.Void", kotlinNothing)
mapOf(
IdSignatureValues._byte to PrimitiveTypeInfo("byte", true, javaLangByte, "kotlin", "Byte"),
IdSignatureValues._short to PrimitiveTypeInfo("short", true, javaLangShort, "kotlin", "Short"),
IdSignatureValues._int to PrimitiveTypeInfo("int", true, javaLangInteger, "kotlin", "Int"),
IdSignatureValues._long to PrimitiveTypeInfo("long", true, javaLangLong, "kotlin", "Long"),
StandardNames.FqNames._byte.shortName() to PrimitiveTypeInfo("byte", true, javaLangByte, "kotlin", "Byte"),
StandardNames.FqNames._short.shortName() to PrimitiveTypeInfo("short", true, javaLangShort, "kotlin", "Short"),
StandardNames.FqNames._int.shortName() to PrimitiveTypeInfo("int", true, javaLangInteger, "kotlin", "Int"),
StandardNames.FqNames._long.shortName() to PrimitiveTypeInfo("long", true, javaLangLong, "kotlin", "Long"),
IdSignatureValues.uByte to PrimitiveTypeInfo("byte", true, kotlinUByte, "kotlin", "UByte"),
IdSignatureValues.uShort to PrimitiveTypeInfo("short", true, kotlinUShort, "kotlin", "UShort"),
IdSignatureValues.uInt to PrimitiveTypeInfo("int", true, kotlinUInt, "kotlin", "UInt"),
IdSignatureValues.uLong to PrimitiveTypeInfo("long", true, kotlinULong, "kotlin", "ULong"),
StandardNames.FqNames.uByteFqName.shortName() to PrimitiveTypeInfo("byte", true, kotlinUByte, "kotlin", "UByte"),
StandardNames.FqNames.uShortFqName.shortName() to PrimitiveTypeInfo("short", true, kotlinUShort, "kotlin", "UShort"),
StandardNames.FqNames.uIntFqName.shortName() to PrimitiveTypeInfo("int", true, kotlinUInt, "kotlin", "UInt"),
StandardNames.FqNames.uLongFqName.shortName() to PrimitiveTypeInfo("long", true, kotlinULong, "kotlin", "ULong"),
IdSignatureValues._double to PrimitiveTypeInfo("double", true, javaLangDouble, "kotlin", "Double"),
IdSignatureValues._float to PrimitiveTypeInfo("float", true, javaLangFloat, "kotlin", "Float"),
StandardNames.FqNames._double.shortName() to PrimitiveTypeInfo("double", true, javaLangDouble, "kotlin", "Double"),
StandardNames.FqNames._float.shortName() to PrimitiveTypeInfo("float", true, javaLangFloat, "kotlin", "Float"),
IdSignatureValues._boolean to PrimitiveTypeInfo("boolean", true, javaLangBoolean, "kotlin", "Boolean"),
StandardNames.FqNames._boolean.shortName() to PrimitiveTypeInfo("boolean", true, javaLangBoolean, "kotlin", "Boolean"),
IdSignatureValues._char to PrimitiveTypeInfo("char", true, javaLangCharacter, "kotlin", "Char"),
StandardNames.FqNames._char.shortName() to PrimitiveTypeInfo("char", true, javaLangCharacter, "kotlin", "Char"),
IdSignatureValues.unit to PrimitiveTypeInfo("void", false, kotlinUnit, "kotlin", "Unit"),
IdSignatureValues.nothing to PrimitiveTypeInfo(null, true, javaLangVoid, "kotlin", "Nothing"),
StandardNames.FqNames.unit.shortName() to PrimitiveTypeInfo("void", false, kotlinUnit, "kotlin", "Unit"),
StandardNames.FqNames.nothing.shortName() to PrimitiveTypeInfo(null, true, javaLangVoid, "kotlin", "Nothing"),
)
}()
}

View File

@@ -40,4 +40,4 @@ fun AutoCloseable?.closeFinallyAC(cause: Throwable?) = when {
} catch (closeException: Throwable) {
cause.addSuppressed(closeException)
}
}
}

View File

@@ -68,7 +68,7 @@ fun getIrClassVirtualFile(irClass: IrClass): VirtualFile? {
return null
}
fun getRawIrClassBinaryPath(irClass: IrClass) =
private fun getRawIrClassBinaryPath(irClass: IrClass) =
getIrClassVirtualFile(irClass)?.let {
val path = it.path
if(it.fileSystem.protocol == StandardFileSystems.JRT_PROTOCOL)
@@ -92,4 +92,4 @@ fun getContainingClassOrSelf(decl: IrDeclaration): IrClass? {
}
fun getJavaEquivalentClassId(c: IrClass) =
c.fqNameWhenAvailable?.toUnsafe()?.let { JavaToKotlinClassMap.mapKotlinToJava(it) }
c.fqNameWhenAvailable?.toUnsafe()?.let { JavaToKotlinClassMap.mapKotlinToJava(it) }

View File

@@ -55,7 +55,7 @@ private val specialFunctions = mapOf(
private val specialFunctionShortNames = specialFunctions.keys.map { it.functionName }.toSet()
fun getSpecialJvmName(f: IrFunction): String? {
private fun getSpecialJvmName(f: IrFunction): String? {
if (specialFunctionShortNames.contains(f.name) && f is IrSimpleFunction) {
f.allOverridden(true).forEach { overriddenFunc ->
overriddenFunc.parentClassOrNull?.fqNameWhenAvailable?.let { parentFqName ->
@@ -87,4 +87,4 @@ fun getJvmName(container: IrAnnotationContainer): String? {
}
}
return (container as? IrFunction)?.let { getSpecialJvmName(container) }
}
}

View File

@@ -207,20 +207,6 @@ open class LoggerBase(val logCounter: LogCounter) {
}
open class Logger(val loggerBase: LoggerBase, open val tw: TrapWriter) {
private fun getDiagnosticLocation(): String? {
val st = Exception().stackTrace
for(x in st) {
when(x.className) {
"com.github.codeql.Logger",
"com.github.codeql.FileLogger" -> {}
else -> {
return x.toString()
}
}
}
return null
}
fun flush() {
tw.flush()
loggerBase.flush()
@@ -240,7 +226,7 @@ open class Logger(val loggerBase: LoggerBase, open val tw: TrapWriter) {
loggerBase.info(tw, msg)
}
fun warn(msg: String, extraInfo: String?) {
private fun warn(msg: String, extraInfo: String?) {
loggerBase.warn(tw, msg, extraInfo)
}
fun warn(msg: String, exn: Throwable) {
@@ -250,7 +236,7 @@ open class Logger(val loggerBase: LoggerBase, open val tw: TrapWriter) {
warn(msg, null)
}
fun error(msg: String, extraInfo: String?) {
private fun error(msg: String, extraInfo: String?) {
loggerBase.error(tw, msg, extraInfo)
}
fun error(msg: String) {

View File

@@ -37,7 +37,7 @@ fun IrType.substituteTypeArguments(params: List<IrTypeParameter>, arguments: Lis
else -> this
}
fun IrSimpleType.substituteTypeArguments(substitutionMap: Map<IrTypeParameterSymbol, IrTypeArgument>): IrSimpleType {
private fun IrSimpleType.substituteTypeArguments(substitutionMap: Map<IrTypeParameterSymbol, IrTypeArgument>): IrSimpleType {
if (substitutionMap.isEmpty()) return this
val newArguments = arguments.map {
@@ -100,7 +100,7 @@ private fun subProjectedType(substitutionMap: Map<IrTypeParameterSymbol, IrTypeA
}
} ?: makeTypeProjection(t.substituteTypeArguments(substitutionMap), outerVariance)
fun IrTypeArgument.upperBound(context: IrPluginContext) =
private fun IrTypeArgument.upperBound(context: IrPluginContext) =
when(this) {
is IrStarProjection -> context.irBuiltIns.anyNType
is IrTypeProjection -> when(this.variance) {
@@ -111,7 +111,7 @@ fun IrTypeArgument.upperBound(context: IrPluginContext) =
else -> context.irBuiltIns.anyNType
}
fun IrTypeArgument.lowerBound(context: IrPluginContext) =
private fun IrTypeArgument.lowerBound(context: IrPluginContext) =
when(this) {
is IrStarProjection -> context.irBuiltIns.nothingType
is IrTypeProjection -> when(this.variance) {
@@ -200,7 +200,7 @@ fun IrTypeArgument.withQuestionMark(b: Boolean): IrTypeArgument =
typealias TypeSubstitution = (IrType, KotlinUsesExtractor.TypeContext, IrPluginContext) -> IrType
fun matchingTypeParameters(l: IrTypeParameter?, r: IrTypeParameter): Boolean {
private fun matchingTypeParameters(l: IrTypeParameter?, r: IrTypeParameter): Boolean {
if (l === r)
return true
if (l == null)

View File

@@ -1,9 +0,0 @@
package com.github.codeql.utils.versions
import com.github.codeql.KotlinUsesExtractor
import org.jetbrains.kotlin.ir.util.DeclarationStubGenerator
fun <TIrStub> KotlinUsesExtractor.getIrStubFromDescriptor(generateStub: (DeclarationStubGenerator) -> TIrStub) : TIrStub? {
logger.error("Descriptors not yet supported for Kotlin 1.7")
return null
}

View File

@@ -0,0 +1,27 @@
package com.github.codeql.utils.versions
import com.github.codeql.KotlinUsesExtractor
import org.jetbrains.kotlin.backend.common.serialization.DescriptorByIdSignatureFinderImpl
import org.jetbrains.kotlin.idea.MainFunctionDetector
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
import org.jetbrains.kotlin.ir.backend.jvm.serialization.JvmDescriptorMangler
import org.jetbrains.kotlin.ir.util.DeclarationStubGenerator
import org.jetbrains.kotlin.ir.util.SymbolTable
import org.jetbrains.kotlin.psi2ir.generators.DeclarationStubGeneratorImpl
@OptIn(ObsoleteDescriptorBasedAPI::class)
fun <TIrStub> KotlinUsesExtractor.getIrStubFromDescriptor(generateStub: (DeclarationStubGenerator) -> TIrStub) : TIrStub? =
(pluginContext.symbolTable as? SymbolTable) ?.let {
// Copying the construction seen in JvmIrLinker.kt
val mangler = JvmDescriptorMangler(MainFunctionDetector(pluginContext.bindingContext, pluginContext.languageVersionSettings))
val descriptorFinder = DescriptorByIdSignatureFinderImpl(
pluginContext.moduleDescriptor,
mangler,
DescriptorByIdSignatureFinderImpl.LookupMode.MODULE_ONLY
)
val stubGenerator = DeclarationStubGeneratorImpl(pluginContext.moduleDescriptor, it, pluginContext.irBuiltIns, descriptorFinder)
generateStub(stubGenerator)
} ?: run {
logger.error("Plugin context has no symbol table, couldn't get IR stub")
null
}

View File

@@ -1,5 +1,10 @@
import java
from MethodAccess ma
where not exists(ma.getQualifier()) and ma.getFile().isKotlinSourceFile()
// Generally Kotlin calls will always use an explicit qualifier, except for calls
// to the synthetic instance initializer <obinit>, which use an implicit `this`.
where
not exists(ma.getQualifier()) and
ma.getFile().isKotlinSourceFile() and
not ma.getCallee() instanceof InstanceInitializer
select ma

View File

@@ -0,0 +1,83 @@
a.kt:
# 0| [CompilationUnit] a
# 1| 1: [Class] A
# 0| 1: [Method] <fn>
# 0| 3: [TypeAccess] int
# 0| 5: [BlockStmt] { ... }
# 0| 0: [ReturnStmt] return ...
# 0| 0: [IntegerLiteral] 42
# 1| 2: [Constructor] A
# 1| 5: [BlockStmt] { ... }
# 1| 0: [SuperConstructorInvocationStmt] super(...)
# 1| 1: [BlockStmt] { ... }
# 2| 3: [Method] f1
# 2| 3: [TypeAccess] int
# 2| 5: [BlockStmt] { ... }
# 2| 0: [ReturnStmt] return ...
# 2| 0: [IntegerLiteral] 1
b.kt:
# 0| [CompilationUnit] b
# 1| 1: [Class] B
# 0| 1: [Method] <fn>
# 0| 3: [TypeAccess] int
# 0| 5: [BlockStmt] { ... }
# 0| 0: [ReturnStmt] return ...
# 0| 0: [UnsafeCoerceExpr] <unsafe coerce>
# 0| 0: [TypeAccess] int
# 0| 1: [IntegerLiteral] 1
# 1| 2: [Constructor] B
# 1| 5: [BlockStmt] { ... }
# 1| 0: [SuperConstructorInvocationStmt] super(...)
# 1| 1: [BlockStmt] { ... }
c.kt:
# 0| [CompilationUnit] c
# 1| 1: [Class] C
# 0| 1: [Method] <fn>
# 0| 3: [TypeAccess] Unit
#-----| 4: (Parameters)
# 0| 0: [Parameter] param
# 0| 0: [TypeAccess] ProcessBuilder
# 0| 5: [BlockStmt] { ... }
# 0| 0: [ReturnStmt] return ...
# 0| 0: [MethodAccess] start(...)
# 0| -1: [VarAccess] param
# 1| 2: [Constructor] C
# 1| 5: [BlockStmt] { ... }
# 1| 0: [SuperConstructorInvocationStmt] super(...)
# 1| 1: [BlockStmt] { ... }
d.kt:
# 0| [CompilationUnit] d
# 1| 1: [Class] D
# 0| 1: [FieldDeclaration] String bar;
# 0| -1: [TypeAccess] String
# 0| 0: [StringLiteral] Foobar
# 1| 3: [Constructor] D
# 1| 5: [BlockStmt] { ... }
# 1| 0: [SuperConstructorInvocationStmt] super(...)
# 1| 1: [BlockStmt] { ... }
e.kt:
# 0| [CompilationUnit] e
# 1| 1: [Class] E
# 0| 1: [Method] <fn_ArrayListAdd>
# 0| 3: [TypeAccess] boolean
# 0| 5: [BlockStmt] { ... }
# 0| 0: [ReturnStmt] return ...
# 0| 0: [MethodAccess] add(...)
# 0| -1: [ClassInstanceExpr] new ArrayList<Object>(...)
# 0| -3: [TypeAccess] ArrayList<Object>
# 0| 0: [IntegerLiteral] 1
# 0| 0: [NullLiteral] null
# 0| 1: [Method] <fn_LinkedHashMap>
# 0| 3: [TypeAccess] Object
# 0| 5: [BlockStmt] { ... }
# 0| 0: [ReturnStmt] return ...
# 0| 0: [MethodAccess] put(...)
# 0| -1: [ClassInstanceExpr] new LinkedHashMap<Object,Object>(...)
# 0| -3: [TypeAccess] LinkedHashMap<Object,Object>
# 0| 0: [IntegerLiteral] 1
# 0| 0: [NullLiteral] null
# 0| 1: [NullLiteral] null
# 1| 3: [Constructor] E
# 1| 5: [BlockStmt] { ... }
# 1| 0: [SuperConstructorInvocationStmt] super(...)
# 1| 1: [BlockStmt] { ... }

View File

@@ -0,0 +1 @@
semmle/code/java/PrintAst.ql

View File

@@ -0,0 +1,3 @@
class A {
fun f1() = 1
}

View File

@@ -0,0 +1,2 @@
class B {
}

View File

@@ -0,0 +1,53 @@
#!/usr/bin/env python3
import subprocess
import shutil
import os
import os.path
import sys
import shlex
def run_process(cmd):
try:
print("Running command: " + shlex.join(cmd))
return subprocess.run(cmd, check=True, capture_output=True)
except subprocess.CalledProcessError as e:
print("In: " + os.getcwd(), file=sys.stderr)
print("Command failed: " + shlex.join(cmd), file=sys.stderr)
print("stdout output:\n" + e.stdout.decode(encoding='UTF-8',
errors='strict'), file=sys.stderr)
print("stderr output:\n" + e.stderr.decode(encoding='UTF-8',
errors='strict'), file=sys.stderr)
raise e
root = '../../../../../../../../..'
sys.path.append(root + '/ql/java/kotlin-extractor')
import kotlin_plugin_versions
defaultKotlinDependencyVersion = kotlin_plugin_versions.get_single_version()
builddir = 'build'
dependency_dir = root + '/resources/kotlin-dependencies/'
dependencies = ['kotlin-stdlib-' + defaultKotlinDependencyVersion +
'.jar', 'kotlin-compiler-' + defaultKotlinDependencyVersion + '.jar']
classpath = ':'.join([dependency_dir + dep for dep in dependencies])
srcs = ['plugin/Plugin.kt']
output = 'plugin.jar'
if os.path.exists(builddir):
shutil.rmtree(builddir)
os.makedirs(builddir)
run_process(['kotlinc',
'-J-Xmx2G',
'-d', builddir,
'-module-name', 'test',
'-no-reflect', '-no-stdlib',
'-jvm-target', '1.8',
'-classpath', classpath] + srcs)
run_process(['jar', '-c', '-f', output,
'-C', builddir, '.',
'-C', 'plugin/resources', 'META-INF'])
shutil.rmtree(builddir)

View File

@@ -0,0 +1 @@
class C { }

View File

@@ -0,0 +1 @@
class D { }

View File

@@ -0,0 +1,2 @@
| CodeQL Kotlin extractor | 2 | | IrProperty without a getter | d.kt:0:0:0:0 | d.kt:0:0:0:0 |
| CodeQL Kotlin extractor | 2 | | Not rewriting trap file for: Boolean -1.0-0- -1.0-0-null test-db/trap/java/classes/kotlin/Boolean.members.trap.gz | file://:0:0:0:0 | file://:0:0:0:0 |

View File

@@ -0,0 +1,13 @@
import java
from string genBy, int severity, string tag, string msg, Location l
where
diagnostics(_, genBy, severity, tag, msg, _, l) and
(
// Different installations get different sets of these messages,
// so we filter out all but one that happens everywhere.
msg.matches("Not rewriting trap file for: %")
implies
msg.matches("Not rewriting trap file for: Boolean %")
)
select genBy, severity, tag, msg, l

View File

@@ -0,0 +1 @@
class E { }

View File

@@ -0,0 +1,7 @@
| a.kt:0:0:0:0 | <fn> | has body |
| a.kt:2:5:2:16 | f1 | has body |
| b.kt:0:0:0:0 | <fn> | has body |
| c.kt:0:0:0:0 | <fn> | has body |
| d.kt:0:0:0:0 | <clinit> | has body |
| e.kt:0:0:0:0 | <fn_ArrayListAdd> | has body |
| e.kt:0:0:0:0 | <fn_LinkedHashMap> | has body |

View File

@@ -0,0 +1,7 @@
import java
from Method m, string body
where
m.fromSource() and
if exists(m.getBody()) then body = "has body" else body = "has no body"
select m, body

View File

@@ -0,0 +1,280 @@
package com.github.codeql
import com.intellij.mock.MockProject
import org.jetbrains.kotlin.backend.common.IrElementTransformerVoidWithContext
import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
import org.jetbrains.kotlin.backend.common.ir.createImplicitParameterDeclarationWithWrappedDescriptor
import org.jetbrains.kotlin.backend.common.lower.DeclarationIrBuilder
import org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar
import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.descriptors.ClassKind
import org.jetbrains.kotlin.descriptors.DescriptorVisibilities
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.ir.IrStatement
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
import org.jetbrains.kotlin.ir.builders.declarations.*
import org.jetbrains.kotlin.ir.builders.irCall
import org.jetbrains.kotlin.ir.builders.irExprBody
import org.jetbrains.kotlin.ir.builders.irGet
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.declarations.impl.IrExternalPackageFragmentImpl
import org.jetbrains.kotlin.ir.declarations.impl.IrFactoryImpl
import org.jetbrains.kotlin.ir.expressions.IrExpression
import org.jetbrains.kotlin.ir.expressions.impl.IrCallImpl
import org.jetbrains.kotlin.ir.expressions.impl.IrConstImpl
import org.jetbrains.kotlin.ir.expressions.impl.IrConstructorCallImpl
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
import org.jetbrains.kotlin.ir.symbols.IrConstructorSymbol
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.ir.types.defaultType
import org.jetbrains.kotlin.ir.types.typeWith
import org.jetbrains.kotlin.ir.util.defaultType
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
class TestComponentRegistrar : ComponentRegistrar {
override fun registerProjectComponents(
project: MockProject,
configuration: CompilerConfiguration
) {
IrGenerationExtension.registerExtension(project, IrAdder())
}
}
@OptIn(ObsoleteDescriptorBasedAPI::class)
class IrAdder : IrGenerationExtension {
override fun generate(moduleFragment: IrModuleFragment, pluginContext: IrPluginContext) {
class AndroidSymbols {
private val irFactory: IrFactory = IrFactoryImpl
private val kotlinJvmInternalPackage: IrPackageFragment = createPackage("kotlin.jvm.internal")
private val javaUtil: IrPackageFragment = createPackage("java.util")
private fun createPackage(packageName: String): IrPackageFragment =
IrExternalPackageFragmentImpl.createEmptyExternalPackageFragment(
moduleFragment.descriptor,
FqName(packageName)
)
private fun createClass(
irPackage: IrPackageFragment,
shortName: String,
classKind: ClassKind,
classModality: Modality
): IrClassSymbol = irFactory.buildClass {
name = Name.identifier(shortName)
kind = classKind
modality = classModality
}.apply {
parent = irPackage
createImplicitParameterDeclarationWithWrappedDescriptor()
}.symbol
val unsafeCoerceIntrinsic: IrSimpleFunctionSymbol =
irFactory.buildFun {
name = Name.special("<unsafe-coerce>")
origin = IrDeclarationOrigin.IR_BUILTINS_STUB
}.apply {
parent = kotlinJvmInternalPackage
val src = addTypeParameter("T", pluginContext.irBuiltIns.anyNType)
val dst = addTypeParameter("R", pluginContext.irBuiltIns.anyNType)
addValueParameter("v", src.defaultType)
returnType = dst.defaultType
}.symbol
val javaUtilArrayList: IrClassSymbol =
createClass(javaUtil, "ArrayList", ClassKind.CLASS, Modality.OPEN)
val javaUtilLinkedHashMap: IrClassSymbol =
createClass(javaUtil, "LinkedHashMap", ClassKind.CLASS, Modality.OPEN)
val arrayListConstructor: IrConstructorSymbol = javaUtilArrayList.owner.addConstructor().apply {
addValueParameter("p_0", pluginContext.irBuiltIns.intType)
}.symbol
val arrayListAdd: IrSimpleFunctionSymbol =
javaUtilArrayList.owner.addFunction("add", pluginContext.irBuiltIns.booleanType).apply {
addValueParameter("p_0", pluginContext.irBuiltIns.anyNType)
}.symbol
val linkedHashMapConstructor: IrConstructorSymbol =
javaUtilLinkedHashMap.owner.addConstructor().apply {
addValueParameter("p_0", pluginContext.irBuiltIns.intType)
}.symbol
val linkedHashMapPut: IrSimpleFunctionSymbol =
javaUtilLinkedHashMap.owner.addFunction("put", pluginContext.irBuiltIns.anyNType).apply {
addValueParameter("p_0", pluginContext.irBuiltIns.anyNType)
addValueParameter("p_1", pluginContext.irBuiltIns.anyNType)
}.symbol
}
moduleFragment.transform(object: IrElementTransformerVoidWithContext() {
override fun visitClassNew(declaration: IrClass): IrStatement {
if (declaration.name.asString() == "A") {
addFunWithExprBody(declaration)
} else if (declaration.name.asString() == "B") {
addFunWithUnsafeCoerce(declaration)
} else if (declaration.name.asString() == "C") {
addFunWithStubClass(declaration)
} else if (declaration.name.asString() == "D") {
addStaticFieldWithExprInit(declaration)
} else if (declaration.name.asString() == "E") {
addFunWithArrayListAdd(declaration)
addFunWithLinkedHashMapPut(declaration)
}
return super.visitClassNew(declaration)
}
fun unsafeCoerce(value: IrExpression, fromType: IrType, toType: IrType): IrExpression {
return IrCallImpl.fromSymbolOwner(-1, -1, toType, AndroidSymbols().unsafeCoerceIntrinsic).apply {
putTypeArgument(0, fromType)
putTypeArgument(1, toType)
putValueArgument(0, value)
}
}
private fun arrayListAdd(): IrExpression {
// ArrayList(1).add(null)
var androidSymbols = AndroidSymbols()
return IrCallImpl.fromSymbolOwner(-1, -1, pluginContext.irBuiltIns.booleanType, androidSymbols.arrayListAdd).apply {
dispatchReceiver = IrConstructorCallImpl.fromSymbolOwner(-1,-1, androidSymbols.javaUtilArrayList.typeWith(), androidSymbols.arrayListConstructor).apply {
putValueArgument(0, IrConstImpl.int(-1, -1, pluginContext.irBuiltIns.intType, 1))
}
putValueArgument(0, IrConstImpl.constNull(-1,-1, pluginContext.irBuiltIns.anyNType))
}
}
private fun linkedHashMapPut(): IrExpression {
// LinkedHashMap(1).put(null, null)
var androidSymbols = AndroidSymbols()
return IrCallImpl.fromSymbolOwner(-1, -1, pluginContext.irBuiltIns.anyNType, androidSymbols.linkedHashMapPut).apply {
dispatchReceiver = IrConstructorCallImpl.fromSymbolOwner(-1,-1, androidSymbols.javaUtilLinkedHashMap.typeWith(), androidSymbols.linkedHashMapConstructor).apply {
putValueArgument(0, IrConstImpl.int(-1, -1, pluginContext.irBuiltIns.intType, 1))
}
putValueArgument(0, IrConstImpl.constNull(-1,-1, pluginContext.irBuiltIns.anyNType))
putValueArgument(1, IrConstImpl.constNull(-1,-1, pluginContext.irBuiltIns.anyNType))
}
}
private fun addFunWithArrayListAdd(declaration: IrClass) {
declaration.declarations.add(pluginContext.irFactory.buildFun {
name = Name.identifier("<fn_ArrayListAdd>")
returnType = pluginContext.irBuiltIns.booleanType
}. also {
it.body = DeclarationIrBuilder(pluginContext, it.symbol)
.irExprBody(
arrayListAdd()
)
it.parent = declaration
})
}
private fun addFunWithLinkedHashMapPut(declaration: IrClass) {
declaration.declarations.add(pluginContext.irFactory.buildFun {
name = Name.identifier("<fn_LinkedHashMap>")
returnType = pluginContext.irBuiltIns.anyNType
}. also {
it.body = DeclarationIrBuilder(pluginContext, it.symbol)
.irExprBody(
linkedHashMapPut()
)
it.parent = declaration
})
}
private fun addFunWithUnsafeCoerce(declaration: IrClass) {
val uintType = pluginContext.referenceClass(FqName("kotlin.UInt"))!!.owner.typeWith()
declaration.declarations.add(pluginContext.irFactory.buildFun {
name = Name.identifier("<fn>")
returnType = uintType
}. also {
it.body = DeclarationIrBuilder(pluginContext, it.symbol)
.irExprBody(
unsafeCoerce(IrConstImpl.int(-1, -1, pluginContext.irBuiltIns.intType, 1), pluginContext.irBuiltIns.intType, uintType)
)
it.parent = declaration
})
}
private fun addFunWithExprBody(declaration: IrClass) {
declaration.declarations.add(pluginContext.irFactory.buildFun {
name = Name.identifier("<fn>")
returnType = pluginContext.irBuiltIns.intType
}. also {
it.body = DeclarationIrBuilder(pluginContext, it.symbol)
.irExprBody(
IrConstImpl.int(-1, -1, pluginContext.irBuiltIns.intType, 42)
)
it.parent = declaration
})
}
private fun addStaticFieldWithExprInit(declaration: IrClass) {
declaration.declarations.add(pluginContext.irFactory.buildProperty {
name = Name.identifier("bar")
isConst = true
visibility = DescriptorVisibilities.PRIVATE
}.also { irProperty ->
irProperty.backingField = pluginContext.irFactory.buildField {
name = Name.identifier("bar")
type = pluginContext.irBuiltIns.stringType
isStatic = true
visibility = DescriptorVisibilities.PRIVATE
}.also { irField ->
irField.initializer = DeclarationIrBuilder(pluginContext, irField.symbol)
.irExprBody(
IrConstImpl.string(-1, -1, pluginContext.irBuiltIns.stringType, "Foobar")
)
irField.parent = declaration
}
irProperty.parent = declaration
})
}
val javaLangPackage = IrExternalPackageFragmentImpl.createEmptyExternalPackageFragment(pluginContext.moduleDescriptor, FqName("java.lang"))
private fun makeJavaLangClass(fnName: String) = pluginContext.irFactory.buildClass {
name = Name.identifier(fnName)
kind = ClassKind.CLASS
origin = IrDeclarationOrigin.IR_EXTERNAL_JAVA_DECLARATION_STUB
}.apply {
parent = javaLangPackage
createImplicitParameterDeclarationWithWrappedDescriptor()
}
// This adds a function with a parameter whose type is a real class without its supertypes specified,
// mimicking the behaviour of the Kotlin android extensions gradle plugin, which refers to some real
// Android classes through these sorts of synthetic, incomplete references. The extractor should
// respond by replacing them with the real version available on the classpath.
// I pick the particular java.lang class "ProcessBuilder" since it is (a) always available and
// (b) not normally extracted by this project.
private fun addFunWithStubClass(declaration: IrClass) {
declaration.declarations.add(pluginContext.irFactory.buildFun {
name = Name.identifier("<fn>")
returnType = pluginContext.irBuiltIns.unitType
}. also { addedFn ->
val processBuilderStub = makeJavaLangClass("ProcessBuilder")
val processBuilderStubType = processBuilderStub.defaultType
val startProcessMethod = processBuilderStub.addFunction {
name = Name.identifier("start")
origin = IrDeclarationOrigin.IR_EXTERNAL_JAVA_DECLARATION_STUB
modality = Modality.FINAL
returnType = pluginContext.referenceClass(FqName("java.lang.Process"))!!.owner.defaultType
}.apply {
addDispatchReceiver { type = processBuilderStubType }
}
val paramSymbol = addedFn.addValueParameter("param", processBuilderStubType)
DeclarationIrBuilder(pluginContext, addedFn.symbol).apply {
addedFn.body = irExprBody(irCall(startProcessMethod).apply { dispatchReceiver = irGet(paramSymbol) })
addedFn.parent = declaration
}
})
}
}, null)
}
}

View File

@@ -0,0 +1,4 @@
| file://:0:0:0:0 | fake.kotlin | FakeKotlinClass |
| file://:0:0:0:0 | java.lang | Object |
| file://:0:0:0:0 | kotlin | Any |
| file://:0:0:0:0 | kotlin | TypeParam |

View File

@@ -0,0 +1,5 @@
import java
from ClassOrInterface ci
where not exists(ci.getASupertype())
select ci.getPackage(), ci.toString()

View File

@@ -0,0 +1 @@
| d.kt:0:0:0:0 | bar | d.kt:0:0:0:0 | Foobar |

View File

@@ -0,0 +1,5 @@
import java
from Field f, Expr init
where init = f.getInitializer()
select f, init

View File

@@ -0,0 +1,6 @@
from create_database_utils import *
import subprocess
subprocess.call("./build_plugin", shell=True)
run_codeql_database_create(
["kotlinc -J-Xmx2G -Xplugin=plugin.jar a.kt b.kt c.kt d.kt e.kt"], lang="java")

View File

@@ -0,0 +1,2 @@
libraryPathDependencies:
- codeql-java

View File

@@ -0,0 +1,8 @@
package extlib;
public class BoundedGenericTest<T extends CharSequence> {
public void method(T t) { }
}

View File

@@ -0,0 +1,8 @@
package extlib;
public class ComplexBoundedGenericTest<A extends CharSequence, B extends A> {
public void method(A a, B b) { }
}

View File

@@ -0,0 +1,10 @@
package extlib;
public class GenericTest<T> {
public void method(T t) { }
public void takesSelfMethod(GenericTest<T> selfLike) { }
}

View File

@@ -0,0 +1,35 @@
package extlib;
import java.util.*;
public class Lib {
public void testParameterTypes(
char p1,
byte p2,
short p3,
int p4,
long p5,
float p6,
double p7,
boolean p8,
Lib simpleClass,
GenericTest<String> simpleGeneric,
BoundedGenericTest<String> boundedGeneric,
ComplexBoundedGenericTest<CharSequence, String> complexBoundedGeneric,
int[] primitiveArray,
Integer[] boxedTypeArray,
int [][] multiDimensionalPrimitiveArray,
Integer[][] multiDimensionalBoxedTypeArray,
List<String>[] genericTypeArray,
List<? extends CharSequence> producerWildcard,
List<? super CharSequence> consumerWildcard,
List<? extends List<? extends CharSequence>> nestedWildcard,
List<?> unboundedWildcard) { }
public List<Integer> returnErasureTest() { return null; }
public <T> void paramErasureTest(List<String> param) { }
}

View File

@@ -0,0 +1,52 @@
parameterTypes
| extlib.jar/extlib/GenericTest.class:0:0:0:0 | p0 | GenericTest<String> |
| javasrc/extlib/GenericTest.java:7:31:7:53 | selfLike | GenericTest |
| javasrc/extlib/Lib.java:8:5:8:11 | p1 | char |
| javasrc/extlib/Lib.java:9:5:9:11 | p2 | byte |
| javasrc/extlib/Lib.java:10:5:10:12 | p3 | short |
| javasrc/extlib/Lib.java:11:5:11:10 | p4 | int |
| javasrc/extlib/Lib.java:12:5:12:11 | p5 | long |
| javasrc/extlib/Lib.java:13:5:13:12 | p6 | float |
| javasrc/extlib/Lib.java:14:5:14:13 | p7 | double |
| javasrc/extlib/Lib.java:15:5:15:14 | p8 | boolean |
| javasrc/extlib/Lib.java:16:5:16:19 | simpleClass | Lib |
| javasrc/extlib/Lib.java:17:5:17:37 | simpleGeneric | GenericTest<String> |
| javasrc/extlib/Lib.java:18:5:18:45 | boundedGeneric | BoundedGenericTest<String> |
| javasrc/extlib/Lib.java:19:5:19:73 | complexBoundedGeneric | ComplexBoundedGenericTest<CharSequence,String> |
| javasrc/extlib/Lib.java:20:5:20:24 | primitiveArray | int[] |
| javasrc/extlib/Lib.java:21:5:21:28 | boxedTypeArray | Integer[] |
| javasrc/extlib/Lib.java:22:5:22:43 | multiDimensionalPrimitiveArray | int[][] |
| javasrc/extlib/Lib.java:23:5:23:46 | multiDimensionalBoxedTypeArray | Integer[][] |
| javasrc/extlib/Lib.java:24:5:24:35 | genericTypeArray | List<String>[] |
| javasrc/extlib/Lib.java:25:5:25:49 | producerWildcard | List<? extends CharSequence> |
| javasrc/extlib/Lib.java:26:5:26:47 | consumerWildcard | List<? super CharSequence> |
| javasrc/extlib/Lib.java:27:5:27:63 | nestedWildcard | List<? extends List<? extends CharSequence>> |
| javasrc/extlib/Lib.java:28:5:28:29 | unboundedWildcard | List<?> |
arrayTypes
| javasrc/extlib/Lib.java:20:5:20:24 | primitiveArray | file://:0:0:0:0 | int[] | int | 1 | int |
| javasrc/extlib/Lib.java:21:5:21:28 | boxedTypeArray | file://:0:0:0:0 | Integer[] | Integer | 1 | Integer |
| javasrc/extlib/Lib.java:22:5:22:43 | multiDimensionalPrimitiveArray | file://:0:0:0:0 | int[][] | int | 2 | int[] |
| javasrc/extlib/Lib.java:23:5:23:46 | multiDimensionalBoxedTypeArray | file://:0:0:0:0 | Integer[][] | Integer | 2 | Integer[] |
| javasrc/extlib/Lib.java:24:5:24:35 | genericTypeArray | file://:0:0:0:0 | List<String>[] | List<String> | 1 | List<String> |
wildcardTypes
| javasrc/extlib/Lib.java:25:5:25:49 | producerWildcard | file://:0:0:0:0 | ? extends CharSequence | upper | CharSequence |
| javasrc/extlib/Lib.java:26:5:26:47 | consumerWildcard | file://:0:0:0:0 | ? super CharSequence | lower | CharSequence |
| javasrc/extlib/Lib.java:26:5:26:47 | consumerWildcard | file://:0:0:0:0 | ? super CharSequence | upper | Object |
| javasrc/extlib/Lib.java:27:5:27:63 | nestedWildcard | file://:0:0:0:0 | ? extends List<? extends CharSequence> | upper | List<? extends CharSequence> |
| javasrc/extlib/Lib.java:28:5:28:29 | unboundedWildcard | file://:0:0:0:0 | ? | upper | Object |
parameterizedTypes
| extlib.jar/extlib/GenericTest.class:0:0:0:0 | p0 | GenericTest<String> | String |
| javasrc/extlib/GenericTest.java:7:31:7:53 | selfLike | GenericTest | T |
| javasrc/extlib/Lib.java:17:5:17:37 | simpleGeneric | GenericTest<String> | String |
| javasrc/extlib/Lib.java:18:5:18:45 | boundedGeneric | BoundedGenericTest<String> | String |
| javasrc/extlib/Lib.java:19:5:19:73 | complexBoundedGeneric | ComplexBoundedGenericTest<CharSequence,String> | CharSequence |
| javasrc/extlib/Lib.java:19:5:19:73 | complexBoundedGeneric | ComplexBoundedGenericTest<CharSequence,String> | String |
| javasrc/extlib/Lib.java:25:5:25:49 | producerWildcard | List<? extends CharSequence> | ? extends CharSequence |
| javasrc/extlib/Lib.java:26:5:26:47 | consumerWildcard | List<? super CharSequence> | ? super CharSequence |
| javasrc/extlib/Lib.java:27:5:27:63 | nestedWildcard | List<? extends List<? extends CharSequence>> | ? extends List<? extends CharSequence> |
| javasrc/extlib/Lib.java:28:5:28:29 | unboundedWildcard | List<?> | ? |
libCallables
| javasrc/extlib/Lib.java:5:14:5:16 | Lib |
| javasrc/extlib/Lib.java:7:15:7:32 | testParameterTypes |
| javasrc/extlib/Lib.java:30:24:30:40 | returnErasureTest |
| javasrc/extlib/Lib.java:32:19:32:34 | paramErasureTest |

View File

@@ -0,0 +1,40 @@
import java
class ExtLibParameter extends Parameter {
ExtLibParameter() { this.getCallable().getName() = ["testParameterTypes", "takesSelfMethod"] }
}
query predicate parameterTypes(ExtLibParameter p, string t) { p.getType().toString() = t }
query predicate arrayTypes(
ExtLibParameter p, Array at, string elementType, int dimension, string componentType
) {
p.getType() = at and
at.getElementType().toString() = elementType and
at.getDimension() = dimension and
at.getComponentType().toString() = componentType
}
query predicate wildcardTypes(ExtLibParameter p, Wildcard wc, string boundKind, string bound) {
// Expose details of wildcard types:
wc =
[
p.getType().(ParameterizedType).getATypeArgument(),
p.getType().(ParameterizedType).getATypeArgument().(ParameterizedType).getATypeArgument()
] and
(
boundKind = "upper" and bound = wc.getUpperBoundType().toString()
or
boundKind = "lower" and bound = wc.getLowerBoundType().toString()
)
}
query predicate parameterizedTypes(ExtLibParameter p, string ptstr, string typeArg) {
exists(ParameterizedType pt |
p.getType() = pt and
pt.getATypeArgument().toString() = typeArg and
ptstr = pt.toString()
)
}
query predicate libCallables(Callable c) { c.getFile().getBaseName().matches("%Lib.java") }

View File

@@ -0,0 +1,8 @@
from create_database_utils import *
import glob
os.mkdir('build')
javaccmd = " ".join(["javac"] + glob.glob("javasrc/extlib/*.java") + ["-d", "build"])
jarcmd = " ".join(["jar", "-c", "-f", "extlib.jar", "-C", "build", "extlib"])
run_codeql_database_create([javaccmd, jarcmd, "kotlinc user.kt -cp extlib.jar"], lang="java")

View File

@@ -0,0 +1,45 @@
import extlib.*
import java.util.*
fun test() {
// Pending better varargs support, avoiding listOf and mutableListOf
val stringList = ArrayList<String>()
val objectList = ArrayList<Any>()
val stringStringList = ArrayList<ArrayList<String>>()
val lib = Lib()
lib.testParameterTypes(
'a',
1,
2,
3,
4,
5.0f,
6.0,
true,
Lib(),
GenericTest<String>(),
BoundedGenericTest<String>(),
ComplexBoundedGenericTest<CharSequence, String>(),
intArrayOf(1),
arrayOf(1),
arrayOf(intArrayOf(1)),
arrayOf(arrayOf(1)),
arrayOf(stringList),
stringList,
objectList,
stringStringList,
objectList)
val returnedList = lib.returnErasureTest()
lib.paramErasureTest<Int>(listOf("Hello"))
// Check trap labelling consistency for methods that instantiate a generic type
// with its own generic parameters -- for example, class MyList<T> { void addAll(MyList<T> l) { } },
// which has the trap labelling oddity of looking like plain MyList, not MyList<T>, even though
// this is a generic instantiation.
val takesSelfTest = GenericTest<String>()
takesSelfTest.takesSelfMethod(takesSelfTest)
}

View File

@@ -0,0 +1 @@
class KotlinDefault {}

View File

@@ -0,0 +1 @@
class KotlinDisabled {}

View File

@@ -0,0 +1 @@
class KotlinEnabled {}

View File

@@ -0,0 +1,10 @@
#!/usr/bin/env python3
from create_database_utils import *
runSuccessfully(["kotlinc", "KotlinDefault.kt"])
os.environ['CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN'] = 'true'
runSuccessfully(["kotlinc", "KotlinDisabled.kt"])
del(os.environ['CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN'])
os.environ['CODEQL_EXTRACTOR_JAVA_AGENT_ENABLE_KOTLIN'] = 'true'
runSuccessfully(["kotlinc", "KotlinEnabled.kt"])

View File

@@ -0,0 +1 @@
| KotlinEnabled.kt:1:1:1:22 | KotlinEnabled |

View File

@@ -0,0 +1,5 @@
import java
from Class c
where c.fromSource()
select c

View File

@@ -0,0 +1,9 @@
from create_database_utils import *
for var in ['CODEQL_EXTRACTOR_JAVA_AGENT_ENABLE_KOTLIN',
'CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN']:
if var in os.environ:
del(os.environ[var])
run_codeql_database_create(['"%s" build.py' % sys.executable], lang="java")

View File

@@ -0,0 +1,2 @@
| code/A.kt:2:1:2:10 | A |
| code/C.kt:2:1:2:10 | C |

View File

@@ -0,0 +1,5 @@
import java
from Class c
where c.fromSource()
select c

View File

@@ -0,0 +1,3 @@
class A {}

Some files were not shown because too many files have changed in this diff Show More