CodeQL for Java and KotlinΒΆ
Experiment and learn how to write effective and efficient queries for CodeQL databases generated from Java and Kotlin codebases.
Enabling Kotlin support
CodeQL treats Java and Kotlin as parts of the same language, so to enable Kotlin support you should enable
java-kotlin
as a language.
- Basic query for Java and Kotlin code: Learn to write and run a simple CodeQL query.
- CodeQL library for Java and Kotlin: When analyzing Java/Kotlin code, you can use the large collection of classes in the CodeQL library for Java/Kotlin.
- Analyzing data flow in Java and Kotlin: You can use CodeQL to track the flow of data through a Java/Kotlin program to its use.
- CodeQL CTF: CodeQL and Chill: Follow the steps that members of GitHub Security Lab went through to track the flow of tainted data from user-controlled bean properties to custom error messages, and identify the known injection vulnerabilities.
- Java and Kotlin types: You can use CodeQL to find out information about data types used in Java/Kotlin code. This allows you to write queries to identify specific type-related issues.
- Overflow-prone comparisons in Java and Kotlin: You can use CodeQL to check for comparisons in Java/Kotlin code where one side of the comparison is prone to overflow.
- Navigating the call graph: CodeQL has classes for identifying code that calls other code, and code that can be called from elsewhere. This allows you to find, for example, methods that are never used.
- Annotations in Java and Kotlin: CodeQL databases of Java/Kotlin projects contain information about all annotations attached to program elements.
- Javadoc: You can use CodeQL to find errors in Javadoc comments in Java code.
- Working with source locations: You can use the location of entities within Java/Kotlin code to look for potential errors. Locations allow you to deduce the presence, or absence, of white space which, in some cases, may indicate a problem.
- Abstract syntax tree classes for working with Java and Kotlin programs: CodeQL has a large selection of classes for representing the abstract syntax tree of Java/Kotlin programs.
- Customizing library models for Java and Kotlin: You can model frameworks and libraries that your code base depends on using data extensions and publish them as CodeQL model packs.