Dependencies:
- Docker
- Visual Studio Code + Remote - Container extension
In the first example use case we will use an already available database.
- Clone this repository -
git clone https://github.com/rvermeulen/codeql-development-container code-and-chill
- Open the repository in Visual Studio Code -
code code-and-chill
(This assumes you installed thecode
command) - With the Remote Container extension installed, Visual Studio Code will detect the dev container configuration and ask to
Reopen in Container
.
With the project now running in the dev container we are ready to start the CTF.
- Head over to https://securitylab.github.com/ctf/codeql-and-chill.
- In the Setup instructions section you can find the link to the database. Download the database and move it into the existing database folder.
- In Visual Studio Code start a new Terminal. You will see a prompt similar to
codeql@98bf68344db6:/workspaces/code-and-chill$
- Change the directory to
databases
and unzip the databaseunzip titus-control-plane-db.zip
- Now activate the database by performing a
right click
on thetitus-control-plane-db
subfolder in the Visual Code Explorer and click on the menu itemCodeQL: Set current database
With an active database we are ready to query the database.
- Add a folder
queries
to the project via the Visual Studio Code Explorer. - Copy the
qlpack.yml
from thejava
subfolder residing in theexamples
folder to thequeries
folder. - Create a new file
solution.ql
in thequeries
folder.
To test the setup you can run the following query. It should return 6 results.
import java
from ParameterizedType pt, ClassOrInterface c
where pt.getGenericType().hasName("ConstraintValidator") and
c.extendsOrImplements(pt)
select c