Codeql C# Cannot directly invoke the abstract method

110 views Asked by At

I'm trying to execute a simple CodeQL query without any success.

The following query should just list calls to GetSanitizedName method. Small example to reproduce the error(s):

set -x

TEST_DIR="/tmp/test"
DB_HOME="/tmp/test/cq"
QUERY_TEST="/tmp/test/query1.ql"

sudo rm -r $TEST_DIR
mkdir $TEST_DIR && cd $TEST_DIR
mkdir $DB_HOME

echo "import csharp

from MethodCall call, Method method
where
  call.getTarget() = method and
  method.hasName(\"GetSanitizedName\")
select call" > $QUERY_TEST

echo "---
name: codeql/test1
dependencies:
  codeql/csharp-all: ^0.8.1" > qlpack.yml

git clone https://github.com/citrus-thunder/clisharp.git
codeql database create $DB_HOME --language=csharp --threads=0 --source-root=/tmp/test/clisharp
codeql pack install
codeql database analyze --format="csv" --output="./out.csv" $DB_HOME $QUERY_TEST

Error(s):

Compiling query plan for /tmp/test.ql.

ERROR: Cannot directly invoke the abstract method NodeImpl.getAstNode() (/Users/user/.codeql/packages/codeql/csharp-all/0.8.1/semmle/code/csharp/controlflow/ControlFlowGraph.qll:30,60-70)

ERROR: Classes may not extend parameters (/Users/user/.codeql/packages/codeql/dataflow/0.1.1/codeql/dataflow/internal/DataFlowImplCommon.qll:77,35-39)

ERROR: Classes may not extend parameters (/Users/user/.codeql/packages/codeql/dataflow/0.1.1/codeql/dataflow/internal/DataFlowImplCommon.qll:89,27-41)

ERROR: Classes may not extend outside their parameterised module (/Users/user/.codeql/packages/codeql/dataflow/0.1.1/codeql/dataflow/internal/DataFlowImplCommon.qll:93,33-37)

ERROR: Classes may not extend parameters (/Users/user/.codeql/packages/codeql/controlflow/0.1.1/codeql/controlflow/Cfg.qll:820,35-47)

ERROR: Classes may not extend parameters (/Users/user/.codeql/packages/codeql/controlflow/0.1.1/codeql/controlflow/Cfg.qll:1252,47-65)

ERROR: Classes may not extend parameters (/Users/user/.codeql/packages/codeql/controlflow/0.1.1/codeql/controlflow/Cfg.qll:1258,47-65)

ERROR: Classes may not extend parameters (/Users/user/.codeql/packages/codeql/controlflow/0.1.1/codeql/controlflow/Cfg.qll:130,42-54)

ERROR: Classes may not extend parameters (/Users/user/.codeql/packages/codeql/controlflow/0.1.1/codeql/controlflow/Cfg.qll:338,36-46)

ERROR: Predicate getAstNode has result type ControlFlowElement, which does not match the overridden predicate's result type AstNode (/Users/user/.codeql/packages/codeql/csharp-all/0.8.1/semmle/code/csharp/controlflow/ControlFlowGraph.qll:30,30-40)

0

There are 0 answers