Questions tagged [semmle-ql]
12 questions
4
votes
1 answer
Semmle QL: TaintTracking hasFlow() Problem with Sources that taint their Arguments
I want to do TaintTracking with functions that taint their arguments with userinput. Example:
fgets(buf, sizeof(buf), stdin); // buf is tainted
[...]
n = strlen(buf); // tainted argument to strlen
[...]
memcpy(somewhere, buf, n) // tainted call to…

themee
- 43
- 3
3
votes
1 answer
Static code analyzer not recognizing C int-types are being used
I'm using a static code analyzer on a large embedded systems project at work (C/C++). Currently, all modules have several violations for:
Typedefs that indicate size and
signedness should be used in place of the
basic types.
However, we have a…

84danie
- 95
- 1
- 8
2
votes
0 answers
How to stop LGTM from wrapping qmake
The automated code review service LGTM uses "wrapper scripts around the popular build tools like pkg-config, CMake, and qmake" to detect missing files during the build process and to install the corresponding packages automatically.
My project uses…

pasbi
- 2,037
- 1
- 20
- 32
2
votes
1 answer
Failed to add CodeQL library from a differnet folder: "Could not resolve module "
I have the following folder structure:
└── MyProj
├── Dangerous_Memcopy
│ ├── Config.qll
│ └── ...
├── MemMangementLibraries
│ ├── FFmpegMemory
│ └── ...
This is the beginning of Config.qll:
import cpp
import…

E235
- 11,560
- 24
- 91
- 141
1
vote
1 answer
Code analysis warning while parsing boolean query param (REST)
export function isLegacyResource(): boolean {
const queryParams = new URLSearchParams(window.location.search);
return isQspValueTruthy(queryParams.get('isLegacy'));
}
export function isQspValueTruthy(value: string | null): boolean {
if…

unknown_boundaries
- 1,482
- 3
- 25
- 47
1
vote
1 answer
How to create import to CodeQL
I want to create an import to my CodeQL query.
I want that this import will be named Utils and I will created inside it a predicate named isNumber.
How can I creat such import?
This how I want my code to look like:
import cpp
import Utils
where
…

E235
- 11,560
- 24
- 91
- 141
1
vote
1 answer
How can i use CodeQL on partial c source code?
I have a partial c source code of a project which as a result i can't build.
Does anyone know if possible to run codeql on that project?
Normally, to create a database, the codeql cli requires to specify the command that builds the project and i…

thevpt
- 51
- 3
0
votes
1 answer
How to check if a Java annotation has a specific property using CodeQL?
Let's say we have the following piece of code:
public class Demo {
@ABC(name = "abc")
private String field1;
@ABC
private String field2;
}
@interface ABC {
String name() default "";
}
How can I write a query that selects all…

Mansur
- 1,661
- 3
- 17
- 41
0
votes
1 answer
Way to implement CI test to check if function argument is valid?
Let's say I have a python function and dictionary as follows:
d = {"a": 1, "b": 2, "c": 3}
def foo(input):
return d[input]
Is there a way when I push my code to GitHub (presumably with some sort of continuous integration) to check that all…

William Gearty
- 166
- 1
- 8
0
votes
1 answer
codeql CLI lgtm.yml: how to customize javascript extraction?
I can use an lgtm.yml file to customize the javascript extractor when building a database with LGTM.com, but how do I provide these customizations to the codeql CLI?
Specifically, I want to include a directory that the extractor excludes by default…

emarteca
- 51
- 4
0
votes
1 answer
Can GitHub's / Semmle's CodeQL Query Executor be Self-hosted
I'd like to enable users of my service to write and execute CodeQL queries. I don't want to offload their execution to GitHub's / Semmle's servers. It's unclear whether this is doable, or whether I'd run into licensing issues.
In the security lab,…

Harry Solovay
- 483
- 3
- 14
0
votes
1 answer
Writing toString() for an algebraic data type with parameters in Semmle QL
After reading about support for algebraic datatypes in QL, I'm trying to define a List type in the lgtm console:
newtype TList =
TNil()
or
TCons(int x,TList xs)
This seems to work. But then I try to define auxiliary classes in order to have a…

danidiaz
- 26,936
- 4
- 45
- 95