mirror of
https://github.com/hohn/codeql-lab.git
synced 2025-12-16 01:53:03 +01:00
Add jedis local codeql db build and README
This commit is contained in:
BIN
assets/jedis-db-local.zip
(Stored with Git LFS)
Normal file
BIN
assets/jedis-db-local.zip
(Stored with Git LFS)
Normal file
Binary file not shown.
51
codeql-jedis/README.org
Normal file
51
codeql-jedis/README.org
Normal file
@@ -0,0 +1,51 @@
|
||||
* Jedis Codeql Setup
|
||||
- fork at https://github.com/hohn/jedis
|
||||
- github db build: enable code scanning, advanced config
|
||||
- only java-kotlin, build-mode: none.
|
||||
- creates https://github.com/hohn/jedis/blob/master/.github/workflows/codeql.yml
|
||||
- action run at https://github.com/hohn/jedis/actions/workflows/codeql.yml
|
||||
- db download
|
||||
#+BEGIN_SRC sh
|
||||
# list dbs
|
||||
curl -H "Authorization: token $GITHUB_TOKEN" \
|
||||
https://api.github.com/repos/hohn/jedis/code-scanning/analyses
|
||||
|
||||
|
||||
# Get DB via curl
|
||||
cd ~/work-gh/codeql-lab/assets
|
||||
curl -H "Authorization: token $GITHUB_TOKEN" \
|
||||
-H "Accept: application/zip" \
|
||||
-L \
|
||||
https://api.github.com/repos/hohn/jedis/code-scanning/codeql/databases/java \
|
||||
-o jedis-database-gh.zip
|
||||
#+END_SRC
|
||||
- db at ~/work-gh/codeql-lab/assets/jedis-database-gh.zip
|
||||
- local db build:
|
||||
#+BEGIN_SRC sh
|
||||
cd ~/work-gh/codeql-lab/
|
||||
|
||||
# Add the submodule
|
||||
git submodule add https://github.com/hohn/jedis extern/jedis
|
||||
|
||||
# Initialize and clone the submodule
|
||||
git submodule update --init --recursive
|
||||
|
||||
|
||||
# Build directly once to resolve any errors
|
||||
cd ~/work-gh/codeql-lab/extern/jedis
|
||||
mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V
|
||||
|
||||
# Build under codeql
|
||||
# Step 1: Clean any prior Maven builds
|
||||
cd ~/work-gh/codeql-lab/extern/jedis
|
||||
mvn clean
|
||||
|
||||
# Step 2: Run CodeQL DB creation with mvn install
|
||||
cd ~/work-gh/codeql-lab
|
||||
codeql database create assets/jedis-db-local \
|
||||
--overwrite \
|
||||
--language=java \
|
||||
--command="mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V" \
|
||||
--source-root=extern/jedis
|
||||
#+END_SRC
|
||||
|
||||
4
codeql-jedis/codeql-pack.lock.yml
Normal file
4
codeql-jedis/codeql-pack.lock.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
---
|
||||
lockVersion: 1.0.0
|
||||
dependencies: {}
|
||||
compiled: false
|
||||
12
codeql-jedis/example.ql
Normal file
12
codeql-jedis/example.ql
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @name Empty block
|
||||
* @kind problem
|
||||
* @problem.severity warning
|
||||
* @id java/example/empty-block
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
from BlockStmt b
|
||||
where b.getNumStmt() = 0
|
||||
select b, "This is an empty block."
|
||||
6
codeql-jedis/qlpack.yml
Normal file
6
codeql-jedis/qlpack.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
name: codeql-jedis/codeql-extra-queries-java
|
||||
version: 0.0.0
|
||||
dependencies:
|
||||
# This uses the latest version of the codeql/java-all library.
|
||||
# You may want to change to a more precise semver string.
|
||||
codeql/java-all: "*"
|
||||
Reference in New Issue
Block a user