Skip to content

Accepting configuration information from user in a CodeQL query #10307

Answered by intrigus-lgtm
r4k3-sh asked this question in Q&A
Discussion options

You must be logged in to vote

(The CodeQL language does not provide any way to read files that are not included in a database as far as I'm aware)

You could consider using an external predicate and supply a CSV file with the threshold value(s) for that predicate when running the query.

external string getAThreshold();
> codeql query run --help
Usage: codeql query run [OPTIONS] -- <file.ql>
Run a single query.
...
      --external=<pred>=<file.csv>
                             A CSV file that contains rows for external
                               predicate <pred>. Multiple --external options
                               can be supplied.
...

(Adapted from #9758 (comment) by @aibaars)

I don't think there is current…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@r4k3-sh
Comment options

@MathiasVP
Comment options

@r4k3-sh
Comment options

Answer selected by r4k3-sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants